Hi All,
Hope someone can help me out here.
I am modifying a existing driver which “exports” two IOCTL’s. Based on
these IOCTL’s the device object on which we are layered receives a
IRP_MJ_SCSI. The “old” driver stored a Mdl in the Irp, Irp->MdlAddress
described the User Mode buffer, and Srb->DataBuffer pointing to this
User Mode buffer. This worked. (which I don’t really understand because
the User Mode address stored in the Srb may be invalid when another
process gets scheduled. Isn’t that a fact ?)
The modified driver is now no longer a filter driver and the above
parameters, e.g. Irp->MdlAddress describing an user mode address and
Srb->DataBuffer pointing to this databuffer no longer seems to work. It
doesn’t crash but no data is returned to me even though
IoStatus.Information says it did.
So does someone know how the ScsiPort driver uses the Mdl stored in
Irp->MdlAddress and the address stored in Srb->DataBuffer. Do they have
to point to the same buffer, this seems like doing the same thing twice
to me ?
I have tried using MmGetSystemAddressFromMdl and store this in the
Srb->DataBuffer fiedl but that causes a blue screen.
Does someone know how I can pass my buffer addresses in the Irp ? I am
especially worried about how I can copy back the result of the IOCTL
back to the user as I can’t be sure which process is the current one. So
I cant be sure where this user mode address is pointing to.
Thanks all.
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi,
You can answer all your questions yourself if you’ll reverse-engineer class
driver from DDK. Check for classpnp.c and function called SplitRequest().
You’ll get how class driver sends the data to SCSI port driver and what
srb->DataBuffer is used for.
Regards,
Anton Kolomyetsev
CoolDev.Com - Toolkits for Network & Storage Kernel Software Developers
“KoolSockets” & “KoolStorage” - TDI Client, Kernel Sockets, SCSI
port/miniport
http://www.CoolDev.Com xxxxx@CoolDev.Com
xxxxx@CoolDev.Com
On 07/07/01, “Jos Scherders ” wrote:
> Hi All,
>
> Hope someone can help me out here.
>
> I am modifying a existing driver which “exports” two IOCTL’s. Based on
> these IOCTL’s the device object on which we are layered receives a
> IRP_MJ_SCSI. The “old” driver stored a Mdl in the Irp, Irp->MdlAddress
> described the User Mode buffer, and Srb->DataBuffer pointing to this
> User Mode buffer. This worked. (which I don’t really understand because
> the User Mode address stored in the Srb may be invalid when another
> process gets scheduled. Isn’t that a fact ?)
>
> The modified driver is now no longer a filter driver and the above
> parameters, e.g. Irp->MdlAddress describing an user mode address and
> Srb->DataBuffer pointing to this databuffer no longer seems to work. It
> doesn’t crash but no data is returned to me even though
> IoStatus.Information says it did.
>
> So does someone know how the ScsiPort driver uses the Mdl stored in
> Irp->MdlAddress and the address stored in Srb->DataBuffer. Do they have
> to point to the same buffer, this seems like doing the same thing twice
> to me ?
>
> I have tried using MmGetSystemAddressFromMdl and store this in the
> Srb->DataBuffer fiedl but that causes a blue screen.
>
> Does someone know how I can pass my buffer addresses in the Irp ? I am
> especially worried about how I can copy back the result of the IOCTL
> back to the user as I can’t be sure which process is the current one. So
> I cant be sure where this user mode address is pointing to.
>
> Thanks all.
>
>
>
> —
> You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi Jos
I tried to do some reverse engineering for the ScsiPort.
I think that the orignal address of Srb->DataBuffer is stored and restored
before completing the Irp.
Try to do this:
OrigDataBuffer = Srb->DataBuffer;
Srb->DataBuffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
.
.
.
Srb->DataBuffer = OrigDataBuffer;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
I hope it can help
Miki
On Sat, 7 Jul 2001, Jos Scherders wrote:
Hi All,
Hope someone can help me out here.
I am modifying a existing driver which “exports” two IOCTL’s. Based on
these IOCTL’s the device object on which we are layered receives a
IRP_MJ_SCSI. The “old” driver stored a Mdl in the Irp, Irp->MdlAddress
described the User Mode buffer, and Srb->DataBuffer pointing to this
User Mode buffer. This worked. (which I don’t really understand because
the User Mode address stored in the Srb may be invalid when another
process gets scheduled. Isn’t that a fact ?)
The modified driver is now no longer a filter driver and the above
parameters, e.g. Irp->MdlAddress describing an user mode address and
Srb->DataBuffer pointing to this databuffer no longer seems to work. It
doesn’t crash but no data is returned to me even though
IoStatus.Information says it did.
So does someone know how the ScsiPort driver uses the Mdl stored in
Irp->MdlAddress and the address stored in Srb->DataBuffer. Do they have
to point to the same buffer, this seems like doing the same thing twice
to me ?
I have tried using MmGetSystemAddressFromMdl and store this in the
Srb->DataBuffer fiedl but that causes a blue screen.
Does someone know how I can pass my buffer addresses in the Irp ? I am
especially worried about how I can copy back the result of the IOCTL
back to the user as I can’t be sure which process is the current one. So
I cant be sure where this user mode address is pointing to.
Thanks all.
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com