Hi,
I have a Windows WDM driver which runs successfully on Windows 2000 and
Windows XP but not Windows Server 2003 (Built using 2003 DDK & Platform
SDK). In this driver I have allocated a DMA Adapter and further obtained
a contiguous buffer via AllocateCommonBuffer. I want to map this buffer
into the user applications address space so that it can read from that
buffer. The items given below are the order in which I am allocating and
trying to map the buffer. This scheme appears to be working in Windows
2000 and Windows XP, but not in Windows Server 2003.
MmMapLockedPagesSpecifyCache raises an exception code of0xC0000141 which
is STATUS_INVALID_ADDRESS.
I am unable to understand this exception as AllocateCommonBuffer was
successful in allocating the buffer as it did not return NULL. I have
allocated a buffer of size 4k.
Could anyone help as to why the OS is unable to map the buffer into user
space? Any help is appreciated.
Thank you,
Amit
- I am using AllocateCommonBuffer to allocate a buffer to be mapped
into user space.
fDx->XYZ.VirtualBuffer =
fDx->DmaAdapter->DmaOperations->AllocateCommonBuffer(fDx->DmaAdapter,
(fDx->XYZ.Length = packet->RequestedLength),
&fDx->XYZ.PhysicalBuffer,
FALSE);
2) Allocating a MDL using IoAllocateMdl
fDx->XYZ.MDL = IoAllocateMdl(fDx->XYZ.VirtualBuffer,
packet->RequestedLength,
FALSE,
FALSE,
NULL);
- Setting up the MDL using MmBuildMdlForNonPagedPool
MmBuildMdlForNonPagedPool(fDx->XYZ.MDL);
- Finally for mapping the buffer into user address
MmMapLockedPagesSpecifyCache(fDx->XYZ.MDL,
UserMode,
MmNonCached,
NULL,
FALSE,
NormalPagePriority
);