MmMapMdl function (wdm.h)

This function maps physical pages described by a memory descriptor list (MDL) into the system virtual address space.

Syntax

NTSTATUS MmMapMdl(
  [in] PMDL            MemoryDescriptorList,
  [in] ULONG           Protection,
  [in] PMM_MDL_ROUTINE DriverRoutine,
  [in] PVOID           DriverContext
);

Parameters

[in] MemoryDescriptorList

A pointer to a valid MDL.

[in] Protection

A bitwise of flags that indicates the protection to set for the pages. Possible values are PAGE_Xxx constants defined in Wdm.h.

[in] DriverRoutine

A pointer to a driver-supplied callback routine (MM_MDL_ROUTINE) that is invoked after the MDL is mapped.

[in] DriverContext

A pointer to a driver-defined context. The driver's callback function can store any status information in the driver context and then examine the value, when the callback is invoked.

Return value

If the callback function pointed to by DriverRoutine was invoked, this function returns STATUS_SUCCESS. The function returns an appropriate NTSTATUS value if the MDL could not be mapped or the callback function could not be invoked.

Remarks

MmMapMdl maps the MDL (if it's not already mapped), invokes the callback, then releases the mapping (if one was created). The caller does not need to perform any cleanup.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1709
Minimum supported server Windows Server 2016
Target Platform Windows
Header wdm.h
Library NtosKrnl.lib
DLL NtosKrnl.exe (kernel mode)
IRQL <=DISPATCH_LEVEL

See also

MM_MDL_ROUTINE