Okay, I did this, and it works pretty well, except that I just
got this assert in MmProbeAndLockPages():
*** Assertion failed: Pfn1->u3.e1.LockCharged == 1
*** Source File: d:\xpsp1\base\ntos\mm\iosup.c, line 1083
Does anyone have any clue what I did wrong?? I’ve
got no clue what this means.
The code snippet follows:
// Extract system buffer address and length
void* pRxBuffer = ::RxLowIoGetBufferAddress(RxContext);
ULONG uLength = RxContext->LowIoContext.ParamsFor.ReadWrite.ByteCount;
// Build meself a new MDL that I can use to map the memory
// into the helper process…
info.pMdl = ::IoAllocateMdl(pRxBuffer, uLength, FALSE, FALSE, 0);
if ( info.pMdl == 0 )
::ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES);
::MmProbeAndLockPages(info.pMdl, KernelMode, IoWriteAccess);
void* pBuffer = ::MmMapLockedPagesSpecifyCache(info.pMdl,
UserMode,
MmCached,
NULL,
FALSE,
NormalPagePriority);
Thanks,
Joseph
Maxim S. Shatskih wrote:
Build a new MDL from scratch from the mapped system-space region.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: “Joseph Galbraith”
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, August 18, 2004 10:05 PM
> Subject: [ntdev] Using MmMapLockedPagesSpecifyCache when
> MDL_MAPPED_TO_SYSTEM_VA
>
>
>
>>I have a MDL which another component, which I don’t control,
>>has already mapped to a system va (at least MDL_MAPPED_TO_SYSTEM_VA
>>is set.)
>>
>>I wanted to map the MDL into a helper process, so I called
>>MmMapLockedPagesSpecifyCache, but I’m getting an
>>ASSERT() because MDL_MAPPED_TO_SYSTEM_VA is set.
>>
>>I tried copying the Mdl using IoAllocateMdl() and
>>IoBuildPartialMdl(), however, this appears to have
>>preserved the MDL_MAPPED_TO_SYSTEM_VA flag.
>>
>>Is there a way I can get this memory mapped into
>>my helper process, or do I just need a completely
>>different solution?
>>
>>Is their a better way to copy the MDL?
>>
>>Would it be a stupid thing to clear MDL_MAPPED_TO_SYSTEM_VA
>>and MappedSystemVa fields? (I can gaurentee that the original
>>MDL will still be valid when I IoFreeMdl() my copy.)
>>
>>Thanks for any insight,