Examine read buffer!

RE: [ntfsd] RE: Getting user nameCan someone show me how to examine the read buffer (IRP_MJ_READ) in the completion routine? A sample code would be very helpful.

Actually I have trouble to lock the Irp->UserBuffer in the Dispatch routine using MmProbeAndLockPages. My driver is a file system filter driver. Thanks for any information!

Cheers,
Sin Lam


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Try this, if it is what you need.

PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);

try {

ProbeForREad( Irp->UserBuffer,
currentIrpStack->Parameters.Read.Length,
sizeof( CHAR ));

// Or ProbeForWrite

} except( EXCEPTION_EXECUTE_HANDLER ){

return FALSE;
}
return TRUE;

and then - MmLockXXXXXXXXXX

TSL> RE: [ntfsd] RE: Getting user nameCan someone show me how to examine the read buffer (IRP_MJ_READ) in the completion routine? A sample code would be very helpful.

TSL> Actually I have trouble to lock the Irp->UserBuffer in the Dispatch routine using MmProbeAndLockPages. My driver is a file system filter driver. Thanks for any information!

TSL> Cheers,
TSL> Sin Lam


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi Ilia,
Thanks for the code sample, I will try it later.

Best regards,
Sin Lam

Try this, if it is what you need.

PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);

try {

ProbeForREad( Irp->UserBuffer,
currentIrpStack->Parameters.Read.Length,
sizeof( CHAR ));

// Or ProbeForWrite

} except( EXCEPTION_EXECUTE_HANDLER ){

return FALSE;
}
return TRUE;

and then - MmLockXXXXXXXXXX

TSL> RE: [ntfsd] RE: Getting user nameCan someone show me how to examine
the read buffer (IRP_MJ_READ) in the completion routine? A sample code would
be very helpful.

TSL> Actually I have trouble to lock the Irp->UserBuffer in the Dispatch
routine using MmProbeAndLockPages. My driver is a file system filter driver.
Thanks for any information!

TSL> Cheers,
TSL> Sin Lam


You are currently subscribed to ntfsd as: xxxxx@krdl.org.sg
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You should place the MmProbeAndLockPages inside the try block as well.
This eliminates a race between the ProbeForRead and the
MmProbeAndLockPages where another thread could free the virtual memory.

-----Original Message-----
From: Ilia Rabinovich [mailto:xxxxx@chat.ru]
Sent: Saturday, August 25, 2001 6:53 AM
To: File Systems Developers
Subject: [ntfsd] Re: Examine read buffer!

Try this, if it is what you need.

PIO_STACK_LOCATION currentIrpStack =
IoGetCurrentIrpStackLocation(Irp);

try {

ProbeForREad( Irp->UserBuffer,
currentIrpStack->Parameters.Read.Length,
sizeof( CHAR ));

// Or ProbeForWrite

} except( EXCEPTION_EXECUTE_HANDLER ){

return FALSE;
}
return TRUE;

and then - MmLockXXXXXXXXXX

TSL> RE: [ntfsd] RE: Getting user nameCan someone show me how
to examine the read buffer (IRP_MJ_READ) in the completion
routine? A sample code would be very helpful.

TSL> Actually I have trouble to lock the Irp->UserBuffer in
the Dispatch routine using MmProbeAndLockPages. My driver is
a file system filter driver. Thanks for any information!

TSL> Cheers,
TSL> Sin Lam


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com