Debugging Tools for Windows

GetCurrentThreadDataOffset

The GetCurrentThreadDataOffset method returns the location of the system data structure for the current thread.

HRESULT
  IDebugSystemObjects::GetCurrentThreadDataOffset(
    OUT PULONG64  Offset
    );

Parameters

Offset
Receives the location of the system data structure for the current thread.

Return Value

S_OK
The method was successful.

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

Interface Version

GetCurrentThreadDataOffset is available in all versions of IDebugSystemObjects.

Comments

In user-mode debugging, the location returned is of the thread environment block (TEB) for the current thread. This is the same location returned by GetCurrentThreadTeb.

In kernel-mode debugging, the location returned is of the KTHREAD structure of the system thread that was executing on the processor represented by the current thread when the last event occurred.

Note  In kernel mode debugging, the current thread is always a virtual thread the debugger engine created for a processor in the target computer. Because events may occur in different system threads, the KTHREAD location for a virtual thread may change.

For more information about threads, see Threads and Processes. For details on the KTHREAD and TEB structures, see Microsoft Windows Internals by David Solomon and Mark Russinovich.

Requirements

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

Build machine: CAPEBUILD