MapUserPhysicalPagesScatter function

Maps previously allocated physical memory pages at a specified address in an Address Windowing Extensions (AWE) region.

64-bit Windows on Itanium-based systems:  Due to the difference in page sizes, MapUserPhysicalPagesScatter is not supported for 32-bit applications.


BOOL MapUserPhysicalPagesScatter(
  PVOID      *VirtualAddresses,
  ULONG_PTR  NumberOfPages,
  PULONG_PTR PageArray



A pointer to an array of starting addresses of the regions of memory to remap.

Each entry in VirtualAddresses must be within the address range that the VirtualAlloc function returns when the Address Windowing Extensions (AWE) region is allocated. The value in NumberOfPages indicates the size of the array. Entries can be from multiple Address Windowing Extensions (AWE) regions.


The size of the physical memory and virtual address space for which to establish translations, in pages.

The array at VirtualAddresses specifies the virtual address range.


A pointer to an array of values that indicates how each corresponding page in VirtualAddresses should be treated.

A 0 (zero) indicates that the corresponding entry in VirtualAddresses should be unmapped, and any nonzero value that it has should be mapped.

If this parameter is NULL, then every address in the VirtualAddresses array is unmapped.

The value in NumberOfPages indicates the size of the array.

Return Value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE, and the function does not map or unmap—partial or otherwise. To get extended error information, call GetLastError.


The physical pages may be unmapped, but they are not freed. You must call FreeUserPhysicalPages to free the physical pages.

You can specify any number of physical memory pages, but the memory cannot extend outside the virtual address space that is allocated by VirtualAlloc. Any existing address maps are automatically overwritten with the new translations, and the old translations are unmapped.

You cannot map physical memory pages outside the range that is specified in AllocateUserPhysicalPages. You can map multiple regions simultaneously, but they cannot overlap.

Physical pages can be located at any physical address, but do not make assumptions about the contiguity of the physical pages.

In a multiprocessor environment, this function maintains hardware translation buffer coherence. On return from this function, all threads on all processors are guaranteed to see the correct mapping.

To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later. For more information, see Using the Windows Headers.


Windows version Windows XP [desktop apps only] Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

Address Windowing Extensions




Memory Management Functions