The VirtualQueryEx function provides information about a range of pages within the virtual address space of a specified process.
SIZE_T VirtualQueryEx(
HANDLE hProcess,
LPCVOID lpAddress,
PMEMORY_BASIC_INFORMATION lpBuffer,
SIZE_T dwLength
);
Parameters
hProcess
[in] Handle to the process whose memory information is queried. The handle must have been opened with PROCESS_QUERY_INFORMATION, which enables using the handle to read information from the process object.
lpAddress
[in] Pointer to the base address of the region of pages to be queried. This value is rounded down to the next page boundary. To determine the size of a page on the host computer, use the GetSystemInfo function.
lpBuffer
[out] Pointer to a MEMORY_BASIC_INFORMATION structure in which information about the specified page range is returned.
dwLength
[in] Size of the buffer pointed to by the lpBuffer parameter, in bytes.
Return Values
The return value is the actual number of bytes returned in the information buffer.
Passing a kernel-mode pointer to this function can result in no information being returned, due to security issues. In this case, the return value is zero.
www.pinvoke.net
去MSDN上面查呗