Dear All:
I am developing a fastfat filter driver for nt/200. I want intercept the
data when reading. When Irp->MdlAddress != NULL, if I access the buffer
discribed by the Mdl, then crashed the system. If Irp->MdlAddress == NULL,
I can access the Irp->UserBuffer and the data is there. why? How can I
access the data?
The code as folling:
NTSTATUS
FilterReadDone
(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
)
{
PUCHAR buffer;
if(Irp->MdlAddress){
buffer = (PUCHAR)MmGetMdlVirtualAddress(Irp->MdlAddress);
//
//Here it is, when I access the buffer, then crashed the system.
//It seem that the current irql is APC_LEVEL
//
//*buffer = 1;
}
else{
//
//Now I can access the buffer and have no problem.
//
*Irp->UserBuffer = 1;
}
…
}
//
//Read dispatch routine is here
//
{
…
IoSetCompletionRoutine( Irp, FilterReadDone, NULL, TRUE, TRUE, TRUE );
return IoCallDriver( FileSystemDevice, Irp );
…
}
thanks in advance!
xuye
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 not be calling MmGetMdlVirtualAddress. This could be a user-mode
pointer, and you may not be in the user’s context in your completion
routine. Instead, you should be calling MmProbeAndLockPages followed by
MmMapLockedPages to get a kernel virtual address to the buffer.
-----Original Message-----
From: xxxxx@genius-soft.com [mailto:xxxxx@genius-soft.com]
Sent: Thursday, June 28, 2001 7:00 PM
To: File Systems Developers
Subject: [ntfsd] Where do I retrive the data from buffer?
Dear All:
I am developing a fastfat filter driver for nt/200. I want
intercept the
data when reading. When Irp->MdlAddress != NULL, if I access
the buffer
discribed by the Mdl, then crashed the system. If
Irp->MdlAddress == NULL,
I can access the Irp->UserBuffer and the data is there. why?
How can I
access the data?
The code as folling:
NTSTATUS
FilterReadDone
(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context
)
{
PUCHAR buffer;
if(Irp->MdlAddress){
buffer = (PUCHAR)MmGetMdlVirtualAddress(Irp->MdlAddress);
//
//Here it is, when I access the buffer, then crashed the system.
//It seem that the current irql is APC_LEVEL
//
//*buffer = 1;
}
else{
//
//Now I can access the buffer and have no problem.
//
*Irp->UserBuffer = 1;
}
…
}
//
//Read dispatch routine is here
//
{
…
IoSetCompletionRoutine( Irp, FilterReadDone, NULL, TRUE, TRUE, TRUE );
return IoCallDriver( FileSystemDevice, Irp );
…
}
thanks in advance!
xuye
You are currently subscribed to ntfsd as: xxxxx@nsisw.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
Thaks very much, but the method you indtruct me is seemly not the case. I
also can’t retrive the data. ther return value of MmMapLockedPages function
is 0xfxxxxxxx, the address is violation. Thanks.
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