Well you are missing something kind of important here! There is no call
to MmBuildMdlForNonPagedPool for a start.
You are also not updating the UserBuffer pointer:
Irp->UserBuffer = MmGetMdlVirtualAddress( pNewMdl );
Also, be careful when replacing the buffer for an irp with the
IRP_NOCACHE flag set. The allocation size of the MDL should be aligned
to the sector size of the disk AFAIK.
You also do not show the cleanup code, so I will assume you are not
calling IoFreeMdl and the buffer you allocated for your modified code.
I may have missed something else but that should get on the right track
Regards
Ben Curley
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Vishnu P
Sent: 15 June 2005 10:29
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] MDL Address
thanx for the reply
i tried to create MDL and assign it to Irp->MdlAddress field but it is
not working.
see the code below
if(FlagOn(Irp->Flags,IRP_PAGING_IO) &&
FlagOn(Irp->Flags,IRP_NOCACHE))
{
syncToDispatch = TRUE;
bIsWriteFromVM = TRUE;
// Create MDL and assign it to Irp->MdlAddress
// 1. Allocate memory from non paged pool.
pModifiedData = ExAllocatePoolWithTag(NonPagedPool,
pIrpSp->Parameters.Write.Length,
FILESPY_MDLADDRESS_TAG);
ASSERT(NULL != pModifiedData);
RtlZeroMemory(pModifiedData,pIrpSp->Parameters.Write.Length);
// 2. Create Mdl
pNewMdl = IoAllocateMdl( pModifiedData,
pIrpSp->Parameters.Write.Length,
FALSE,
FALSE,
NULL);
ASSERT(NULL != pNewMdl);
pOriginalData = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
NormalPagePriority);
// 3. Modify the data
if(NULL != pOriginalData)
for(index = 0; index < pIrpSp->Parameters.Write.Length;
index++)
pModifiedData[index] = pOriginalData[index]+1;
// 4. change the MdlAddress
pOriginalMdl = Irp->MdlAddress;
Irp->MdlAddress = pNewMdl;
}
later im restoring the original MdlAddress
if(bIsWriteFromVM)
Irp->MdlAddress = pOriginalMdl;
With this code system gets hang.
Is there any thing i should do to make it work?
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@des.co.uk To unsubscribe
send a blank email to xxxxx@lists.osr.com