The NdisAllocateMdl function allocates an MDL that describes the memory buffer at the specified virtual address.
PMDL NdisAllocateMdl( NDIS_HANDLE NdisHandle, PVOID VirtualAddress, UINT Length );
An NDIS handle that was obtained during caller initialization. For more information, see Obtaining Pool Handles.
A pointer to the base virtual address of the buffer that the MDL is to describe.
The VirtualAddress parameter for NdisAllocateMdl only accepts memory from the nonpaged pool. In other words, it requires memory from ExAllocatePool*(NonPagedNx), NdisAllocateMemoryWithTagPriority, or NdisMAllocateSharedMemory. In particular, it should not be used with memory from the stack, paged pool, driver global data, or other memory regions.
If a driver needs to build an MDL for one of these non-nonpaged pool regions, it should use the appropriate kernel APIs for that type of memory, such as IoAllocateMdl combined with MmProbeAndLockPages.
The size, in bytes, of the memory buffer.
NdisAllocateMdl returns a pointer to the allocated MDL. If the allocation fails, the return value is NULL.
All MDLs that are allocated by calling NdisAllocateMdl must be freed by calling the NdisFreeMdl function.
NdisAllocateMdl allocates memory and builds the MDL in one step. This process is different from IoAllocateMdl, which only allocates memory for the MDL, meaning the caller must build the MDL by calling either MmBuildMdlForNonPagedPool or MmProbeAndLockPages.
|Minimum supported client||Supported in NDIS 6.0 and later.|
|Header||ndis.h (include Ndis.h)|
|DDI compliance rules||Irql_NetBuffer_Function, NdisAllocateMdl|