IHostMemoryManager::VirtualQuery Method

Serves as a logical wrapper for the corresponding Win32 function. The Win32 implementation of VirtualQuery retrieves information about a range of pages in the virtual address space of the calling process.

HRESULT VirtualQuery (
    [in]  void*    lpAddress,
    [out] void*    lpBuffer,
    [in]  SIZE_T   dwLength,
    [out] SIZE_T*  pResult


[in] A pointer to the address in virtual memory to be queried.


[out] A pointer to a structure that contains information about the specified memory region.


[in] The size, in bytes, of the buffer that lpBuffer points to.


[out] A pointer to the number of bytes returned by the information buffer.




VirtualQuery returned successfully.


The common language runtime (CLR) has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.


The call timed out.


The caller does not own the lock.


An event was canceled while a blocked thread or fiber was waiting on it.


An unknown catastrophic failure occurred. When a method returns E_FAIL, the CLR is no longer usable within the process. Subsequent calls to hosting methods return HOST_E_CLRNOTAVAILABLE.

VirtualQuery provides information about a range of pages in the virtual address space of the calling process. This implementation sets the value of the pResult parameter to the number of bytes returned in the information buffer, and returns an HRESULT value. In the Win32 VirtualQuery function, the return value is the buffer size. For more information, see the Windows Platform documentation.

Important noteImportant Note:

The operating system's implementation of VirtualQuery does not incur deadlock and can run to completion with random threads suspended in user code. Use great caution when implementing a hosted version of this method.

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: MSCorEE.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Version: 2.0

Community Additions