// wdfmemory.h
VOID WDF_MEMORY_DESCRIPTOR_INIT_MDL(
[out] PWDF_MEMORY_DESCRIPTOR Descriptor,
[in] PMDL Mdl,
[in] ULONG BufferLength
);
View the official Windows Driver Kit DDI reference
No description available.
[Applies to KMDF and UMDF]
The WDF_MEMORY_DESCRIPTOR_INIT_MDL function initializes a WDF_MEMORY_DESCRIPTOR structure so that it describes a specified memory descriptor list (MDL).
Descriptor
[out]A pointer to a WDF_MEMORY_DESCRIPTOR structure.
Mdl
[in]A pointer to an MDL that describes a buffer.
BufferLength
[in]The size, in bytes, of the buffer that Mdl specifies.
The WDF_MEMORY_DESCRIPTOR_INIT_MDL function zeros the specified WDF_MEMORY_DESCRIPTOR structure and sets the structure's Type member to WdfMemoryDescriptorTypeMdl. Then it sets the structure's u.MdlType.Mdl and u.MdlType.BufferLength members to the values that the Mdl and BufferLength parameters specify, respectively.
The following code example allocates a buffer, creates an MDL for the buffer, and uses the MDL to initialize a WDF_MEMORY_DESCRIPTOR structure.
PVOID pBuffer = NULL;
PMDL pMdl = NULL;
pBuffer = ExAllocatePoolWithTag(
NonPagedPool,
BUFFER_LENGTH,
IOTARGET_DRIVER_TAG
);
if (pBuffer == NULL){
Status = STATUS_UNSUCCESSFUL;
goto Cleanup;
}
pMdl = IoAllocateMdl(
pBuffer,
BUFFER_LENGTH,
FALSE,
TRUE,
NULL
);
if (pMdl == NULL){
Status = STATUS_UNSUCCESSFUL;
goto Cleanup;
}
MmBuildMdlForNonPagedPool(pMdl);
WDF_MEMORY_DESCRIPTOR_INIT_MDL(
pInputBuffer,
pMdl,
BUFFER_LENGTH
);
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
WDF_MEMORY_DESCRIPTOR_INIT_HANDLE