Hi all:
In a completion to IRP_MJ_WRITE I want to copy the cache content to
a buffer and do something on it and then copy it back.The following is my
codes.I find that nothing is copyed to me buffer.Could anybody tell me the
right way to do it?
Length=PtrCurrentStackLocation->Parameters.Write.Length;
MdlBuffer = MmGetSystemAddressForMdl(PtrIrp->MdlAddress);
if(MdlBuffer!=NULL)
{
Buffer=ExAllocatePool(NonPagedPool,Length);
RtlCopyMemory(Buffer,MdlBuffer,Length);
//do something on Buffer
RtlCopyMemory(MdlBuffer,Buffer,Length);
ExFreePool(Buffer);
}
Thanks!
Jim
BTW:I do the same thing in dispatch routine and it works well.
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.msn.com/cn
This code is broken in so many ways, not the least that you are walking
all over the caller’s memory buffer. If you tell us what you’re trying
to do, we can help find an alternative solution.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Zhong Jim
Sent: Tuesday, June 17, 2003 8:54 PM
To: File Systems Developers
Subject: [ntfsd] How to copy the cache content in a
completion routine?
Hi all:
In a completion to IRP_MJ_WRITE I want to copy the
cache content to
a buffer and do something on it and then copy it back.The
following is my
codes.I find that nothing is copyed to me buffer.Could
anybody tell me the
right way to do it?
Length=PtrCurrentStackLocation->Parameters.Write.Length;
MdlBuffer = MmGetSystemAddressForMdl(PtrIrp->MdlAddress);
if(MdlBuffer!=NULL)
{
Buffer=ExAllocatePool(NonPagedPool,Length);
RtlCopyMemory(Buffer,MdlBuffer,Length);
//do something on Buffer
RtlCopyMemory(MdlBuffer,Buffer,Length);
ExFreePool(Buffer);
}
Thanks!
Jim
BTW:I do the same thing in dispatch routine and it works well.
???ѽ??н???ʹ?? MSN Messenger:
http://messenger.msn.com/cn
You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com