QueryVirtualMemoryInformation function (memoryapi.h)

The QueryVirtualMemoryInformation function returns information about a page or a set of pages within the virtual address space of the specified process.

Syntax

BOOL QueryVirtualMemoryInformation(
  [in]            HANDLE                         Process,
  [in]            const VOID                     *VirtualAddress,
  [in]            WIN32_MEMORY_INFORMATION_CLASS MemoryInformationClass,
  [out]           PVOID                          MemoryInformation,
  [in]            SIZE_T                         MemoryInformationSize,
  [out, optional] PSIZE_T                        ReturnSize
);

Parameters

[in] Process

A handle for the process in whose context the pages to be queried reside.

[in] VirtualAddress

The address of the region of pages to be queried. This value is rounded down to the next host-page-address boundary.

[in] MemoryInformationClass

The memory information class about which to retrieve information. The only supported value is MemoryRegionInfo.

[out] MemoryInformation

A pointer to a buffer that receives the specified information.

If the MemoryInformationClass parameter has a value of MemoryRegionInfo, this parameter must point to a WIN32_MEMORY_REGION_INFORMATION structure.

[in] MemoryInformationSize

Specifies the length in bytes of the memory information buffer.

[out, optional] ReturnSize

An optional pointer which, if specified, receives the number of bytes placed in the memory information buffer.

Return value

Returns TRUE on success. Returns FALSE for failure. To get extended error information, call GetLastError.

Remarks

If the MemoryInformationClass parameter has a value of MemoryRegionInfo, the MemoryInformation parameter must point to a WIN32_MEMORY_REGION_INFORMATION structure. The VirtualAddress parameter must point to an address within a valid memory allocation. If the VirtualAddress parameter points to an unallocated memory region, the function fails.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1607 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header memoryapi.h (include Windows.h)
Library Onecore.lib
DLL Api-ms-win-core-memory-l1-1-4.dll

See also

GetLastError

MEMORY_BASIC_INFORMATION

WIN32_MEMORY_REGION_INFORMATION