Debugging Tools for Windows

GetNearInstruction

The GetNearInstruction method returns the location of a processor instruction relative to a given location.

HRESULT
  IDebugControl::GetNearInstruction(
    IN ULONG64  Offset,
    IN LONG  Delta,
    OUT PULONG64  NearOffset
    );

Parameters

Offset
Specifies the location in the process's virtual address space from which to start looking for the desired instruction.
Delta
Specifies the number of instructions from Offset of the desired instruction. If Delta is negative, the returned offset is before Offset (see the Comments section for more information).
NearOffset
Receives the location in the process's virtual address space of the instruction that is Delta instructions away from Offset.

Return Value

S_OK
The method was successful.

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

Interface Version

GetNearInstruction is available in all versions of IDebugControl.

Comments

On some architectures, like x86 and x64, the size of an instruction may vary. On these architectures, when Delta is negative, the desired instruction location might not be uniquely defined. In this case, the debugger engine will search backward from Offset until it encounters a location such that there are the Delta number of instructions between that location and Offset.

Requirements

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

Build machine: CAPEBUILD