Hardware Dev Center

IDebugSystemObjects::GetCurrentThreadTeb method

The GetCurrentThreadTeb method returns the location of the thread environment block (TEB) for the current thread.


HRESULT GetCurrentThreadTeb(
  [out] PULONG64 Offset


Offset [out]

Receives the location in the target's virtual address space of the TEB for the current thread.

Return value

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

Return codeDescription

The method was successful.



In user-mode debugging, this method provides the same information as GetCurrentThreadDataOffset.

In kernel-mode debugging, the location returned is of the TEB 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, the current thread is always a virtual thread the debugger created for a processor in the target computer. Because events may occur in different system threads, the TEB location for a virtual thread may change.

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


Target platform



Dbgeng.h (include Dbgeng.h)



Send comments about this topic to Microsoft

© 2015 Microsoft