// ntddk.h
PPHYSICAL_MEMORY_RANGE MmGetPhysicalMemoryRangesEx2(
PVOID PartitionObject,
ULONG Flags
);
View the official Windows Driver Kit DDI referenceNo description available.
The MmGetPhysicalMemoryRangesEx2 routine returns the virtual address of a nonpaged pool block which contains the physical memory ranges in the system.
PartitionObjectOptional pointer to the partition object to query.
FlagsWhether the caller is interested in FileOnly ranges, and whether to include all partitions.
NULL on failure.
The returned block contains physical address and page count pairs. The last entry contains zero for both.
The caller must understand that although the returned block cannot change after it is returned, the actual memory configuration can change (due to hot-add/remove) at any time.
It is the caller's responsibility to free this block.