Previous Next

MmMapLockedPages

The MmMapLockedPages routine is obsolete for Microsoft® Windows® 2000 and later, and for Windows Me. It is supported only for WDM drivers that must run on Windows 98. Otherwise, use MmMapLockedPagesSpecifyCache.

The MmMapLockedPages routine maps the physical pages that are described by a given MDL.

PVOID 
  MmMapLockedPages(
    IN PMDL  MemoryDescriptorList,
    IN KPROCESSOR_MODE  AccessMode
    );

Parameters

MemoryDescriptorList
Pointer to an MDL that was updated by MmProbeAndLockPages.
AccessMode
Specifies the access mode in which to map the MDL, either KernelMode or UserMode. Almost all drivers should use KernelMode.

Return Value

MmMapLockedPages returns the starting address of the mapped pages. (For NT-based operating systems prior to Windows NT 4.0 Service Pack 4 (SP4), MmMapLockedPages returns the beginning address of the first page of the mapped pages.)

Headers

Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

Use MmUnmapLockedPages to unmap the physical pages that were mapped by MmMapLockedPages.

If AccessMode is KernelMode and MmMapLockedPages cannot map the specified pages, the system issues a bug check. (For this reason, drivers should use MmMapLockedPagesSpecifyCache when available; that routine returns NULL on failure, rather than causing a bug check.) If AccessMode is UserMode and the specified pages cannot be mapped, the routine raises an exception. Callers that specify UserMode must wrap the call to MmMapLockedPages in a try/except block. For more information, see Handling Exceptions.

Callers of MmMapLockedPages must be running at IRQL <= DISPATCH_LEVEL if AccessMode is KernelMode. Otherwise, the caller must be running at IRQL < DISPATCH_LEVEL.

See Also

MmGetSystemAddressForMdl, MmGetSystemAddressForMdlSafe, MmMapLockedPagesSpecifyCache, MmProbeAndLockPages, MmUnmapLockedPages