Debugging Tools for Windows

GetCurrentThreadAddr

The GetCurrentThreadAddr function returns the location of the system data that describes the current thread.

VOID
 GetCurrentThreadAddr(
    DWORD  Processor,
    PULONG64  Address
    );

Parameters

Processor
Specifies the index of the thread whose system data will be returned.

In kernel-mode debugging, this is the index of a virtual thread, which is the index of a processor on the target computer.

Address
Receives the location of the system data for the thread.

Return Value

None

Comments

In user-mode debugging, GetCurrentThreadAddr returns the location of the thread's Thread Environment Block (TEB). This is the same location that GetTebAddress returns.

In kernel-mode debugging, GetCurrentThreadAddr returns the location of the KTHREAD structure of the operating system thread that was executing on the processor when the last event occurred.

For details on the KTHREAD and TEB structures, see Microsoft Windows Internals by David Solomon and Mark Russinovich.

Requirements

Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).

See Also

GetTebAddress

Build machine: CAPEBUILD