MmGetSystemAddressForMdl Problem ?

Hi all

Once again I have a problem. I am writing an encryption filter driver that
refuses to work correctly with floppies and the problem appears to be with
the MmGetSystemAddressForMdl not paging in memory from the swap file when I
try to encrypt it.

I have a file that is filled with ‘0’ so that xor 1 will give all ‘1’. The
code I have which is processed in the IRP_MJ_WRITE (without the error
checking) is as follows

PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
DWORD Length = IrpSp->Parameters.Write.Length;
LPBYTE ToEnc = ExAllocatePool(NonPagedPool, Length);
LPBYTE UserBuffer = (LPBYTE)MmGetSystemAddressForMdl(Irp->MdlAddress);
RTLCopyMemory(ToEnc, UserBuffer, Length);

Now if I check ToEnc to make sure it is filled with ‘0’ then after 1024
bytes the buffer becomes corrupt for 1024 and then is correct for the rest
of the buffer which can be upto 65536 bytes long. I get no errors while
encrypting and the file after encryption has is correct except for this 1K
block. What am I doing wrong ? I have tried changing the MDLFlags so that
the MAP_CAN_FAIL Flag is removed (although I have never seen it set). It
appears that the buffer I am copying from is not in memory and is not
getting paged in, Am I going mad or is there a logical explanation ?

Please help before I become total bald

TTFN
Paul Delivett

Hi

Problem solved. I was corrupting the buffer myself.

Thanks for all the help

TTFN
Paul Delivett

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Paul Delivett
Sent: Wednesday, 06 September 2000 1:09 pm
To: File Systems Developers
Subject: [ntfsd] MmGetSystemAddressForMdl Problem ?

Hi all

Once again I have a problem. I am writing an encryption filter driver that
refuses to work correctly with floppies and the problem appears to be with
the MmGetSystemAddressForMdl not paging in memory from the swap
file when I
try to encrypt it.

I have a file that is filled with ‘0’ so that xor 1 will give all ‘1’. The
code I have which is processed in the IRP_MJ_WRITE (without the error
checking) is as follows

PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
DWORD Length = IrpSp->Parameters.Write.Length;
LPBYTE ToEnc = ExAllocatePool(NonPagedPool, Length);
LPBYTE UserBuffer = (LPBYTE)MmGetSystemAddressForMdl(Irp->MdlAddress);
RTLCopyMemory(ToEnc, UserBuffer, Length);

Now if I check ToEnc to make sure it is filled with ‘0’ then after 1024
bytes the buffer becomes corrupt for 1024 and then is correct for the rest
of the buffer which can be upto 65536 bytes long. I get no errors while
encrypting and the file after encryption has is correct except for this 1K
block. What am I doing wrong ? I have tried changing the MDLFlags so that
the MAP_CAN_FAIL Flag is removed (although I have never seen it set). It
appears that the buffer I am copying from is not in memory and is not
getting paged in, Am I going mad or is there a logical explanation ?

Please help before I become total bald

TTFN
Paul Delivett


You are currently subscribed to ntfsd as: xxxxx@Carraig.co.uk
To unsubscribe send a blank email to $subst(‘Email.Unsub’)