Is it ok to build partial mdl like the following:
mdlSize = PAGE_SIZE;
totalBytes = MmGetMdlByteCount(Irp->MdlAddress);
totalPages = BYTES_TO_PAGES(totalBytes);
if(totalBytes? {??? ???
??? ??? mdlSize = totalBytes;??? ???
? }
lMdlCurrent = IoAllocateMdl( NULL, mdlSize, FALSE, TRUE, NULL );
if(lMdlCurrent)??? ??? ??? ???
{
??? IoBuildPartialMdl( Irp->MdlAddress, lMdlCurrent,virtualAddss+pagesOffset , mdlSize );
??? currentAddress = MmGetSystemAddressForMdlSafe( lMdlCurrent, NormalPagePriority );??? ??? ??? ??? ???
}
pagesOffset+=PAGE_SIZE;
totalPages–;
It shows TARGET_MDL_TOO_SMALL on both Windbg & BSOD for total pages >1. I didn’t understand whats the problem on IoBuildPartialMdl.
Thanks in advance,
Ashraf
Now, it is not OK.
Pass the same pointer/length values to IoAllocateMdl as to IoBuildPartialMdl, like:
lMdlCurrent = IoAllocateMdl( virtualAddss+pagesOffset , mdlSize, FALSE, TRUE, NULL );
“Ashraf” wrote in message news:xxxxx@ntdev…
Is it ok to build partial mdl like the following:
mdlSize = PAGE_SIZE;
totalBytes = MmGetMdlByteCount(Irp->MdlAddress);
totalPages = BYTES_TO_PAGES(totalBytes);
if(totalBytes {
mdlSize = totalBytes;
}
lMdlCurrent = IoAllocateMdl( NULL, mdlSize, FALSE, TRUE, NULL );
if(lMdlCurrent)
{
IoBuildPartialMdl( Irp->MdlAddress, lMdlCurrent,virtualAddss+pagesOffset , mdlSize );
currentAddress = MmGetSystemAddressForMdlSafe( lMdlCurrent, NormalPagePriority );
}
pagesOffset+=PAGE_SIZE;
totalPages–;
It shows TARGET_MDL_TOO_SMALL on both Windbg & BSOD for total pages >1. I didn’t understand whats the problem on IoBuildPartialMdl.
Thanks in advance,
Ashraf
Many many thanks its works.
— On Wed, 2/25/09, Maxim S. Shatskih wrote:
From: Maxim S. Shatskih
Subject: Re:[ntdev] TARGET_MDL_TOO_SMALL
To: “Windows System Software Devs Interest List”
Date: Wednesday, February 25, 2009, 2:46 PM
??? Now, it is not OK.
?
??? Pass the same pointer/length values to
IoAllocateMdl as to IoBuildPartialMdl, like:
?
??? lMdlCurrent = IoAllocateMdl(
virtualAddss+pagesOffset , mdlSize, FALSE, TRUE, NULL
);
???
“Ashraf” wrote in message
news:xxxxx@ntdev…
Is it ok to build partial mdl like the following:
mdlSize = PAGE_SIZE;
totalBytes =
MmGetMdlByteCount(Irp->MdlAddress);
totalPages =
BYTES_TO_PAGES(totalBytes);
if(totalBytes?
{??? ???
???
??? mdlSize = totalBytes;???
???
? }
lMdlCurrent = IoAllocateMdl( NULL,
mdlSize, FALSE, TRUE, NULL );
if(lMdlCurrent)???
??? ??? ???
{
??? IoBuildPartialMdl( Irp->MdlAddress,
lMdlCurrent,virtualAddss+pagesOffset , mdlSize );
???
currentAddress = MmGetSystemAddressForMdlSafe( lMdlCurrent,
NormalPagePriority );??? ???
??? ??? ???
}
pagesOffset+=PAGE_SIZE;
totalPages–;
It shows
TARGET_MDL_TOO_SMALL on both Windbg & BSOD for total pages >1. I
didn’t understand whats the problem on
IoBuildPartialMdl.
Thanks in
advance,
Ashraf
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer