Skip to main content
QueryVirtualMemoryInformation function

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

Syntax


BOOL WINAPI QueryVirtualMemoryInformation(
  _In_            HANDLE                                      Process,
  _In_      const VOID                                        *VirtualAddress,
  _In_            WIN32_MEMORY_INFORMATION_CLASS              MemoryInformationClass,
  _Out_           _writes_bytes_(MemoryInformationSize) PVOID MemoryInformation,
  _In_            SIZE_T                                      MemoryInformationSize,
  _Out_opt_       PSIZE_T                                     ReturnSize
);

Parameters

Process [in]

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

VirtualAddress [in]

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

MemoryInformationClass [in]

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

MemoryInformation [out]

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.

MemoryInformationSize [in]

Specifies the length in bytes of the memory information buffer.

ReturnSize [out, optional]

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

Minimum supported client

Windows 10, version 1607 [desktop apps only]

Minimum supported server

Windows Server 2016 [desktop apps only]

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