Debugging Tools for Windows

GetVirtualTranslationPhysicalOffsets

The GetVirtualTranslationPhysicalOffsets method returns the physical addresses of the system paging structures at different levels of the paging hierarchy.

HRESULT
  IDebugDataSpaces2::GetVirtualTranslationPhysicalOffsets(
    IN ULONG64  Virtual,
    OUT OPTIONAL PULONG64  Offsets,
    IN ULONG  OffsetsSize,
    OUT OPTIONAL PULONG  Levels
    );

Parameters

Virtual
Specifies the location in the target's virtual address space to translate.
Offsets
Receives the physical addresses for the system paging structures. If it is set to NULL, this information is not returned.
OffsetsSize
Specifies the number of elements the array Offsets holds. This is the maximum number of addresses that will be returned.
Levels
Receives the number of levels in the paging hierarchy for the specified address. If this is NULL, this information is not returned.

Return Value

S_OK
The method was successful.
HRESULT_FROM_NT(STATUS_NO_PAGEFILE)
No physical page containing the specified address could be found.

This method can also return error values. See Return Values for more details.

Interface Version

GetVirtualTranslationPhysicalOffsets is available in IDebugDataSpaces2 and later versions.

Comments

This method is only available in kernel-mode debugging.

Translating a virtual address to a physical address requires Windows to walk down the paging hierarchy. At each level it reads paging information from physical memory. This method returns the offsets for these physical pages. The number of levels in the paging hierarchy may be different for different addresses.

The address at the last level of the hierarchy is the physical address corresponding to the specified virtual address. This is what VirtualToPhysical would return.

For details on how virtual addresses are translated into physical addresses, see Microsoft Windows Internals by David Solomon and Mark Russinovich.

Requirements

Headers: Defined in Dbgeng.h. Include Dbgeng.h.

Build machine: CAPEBUILD