TEB structure (winternl.h)

[This structure may be altered in future versions of Windows. Applications should use the alternate functions listed in this topic.]

The Thread Environment Block (TEB structure) describes the state of a thread.

Syntax

typedef struct _TEB {
  PVOID Reserved1[12];
  PPEB  ProcessEnvironmentBlock;
  PVOID Reserved2[399];
  BYTE  Reserved3[1952];
  PVOID TlsSlots[64];
  BYTE  Reserved4[8];
  PVOID Reserved5[26];
  PVOID ReservedForOle;
  PVOID Reserved6[4];
  PVOID TlsExpansionSlots;
} TEB, *PTEB;

Members

Reserved1[12]

ProcessEnvironmentBlock

Reserved2[399]

Reserved3[1952]

TlsSlots[64]

Reserved4[8]

Reserved5[26]

ReservedForOle

Reserved6[4]

TlsExpansionSlots

Remarks

The definition of this structure may change from one version of Windows to the next. Do not assume a maximum size for this structure. To see the members of this structure, refer to winternal.h.

You should not directly access this structure. To access the values of the TlsSlots and TlsExpansionSlots members, call TlsGetValue. To access the value of the ReservedForOle member, call CoGetContextToken.

In the following versions of Windows, the offset of the 32-bit TEB address within the 64-bit TEB is 0. This can be used to directly access the 32-bit TEB of a WOW64 thread. This might change in later versions of Windows.

Windows Vista Windows Server 2008
Windows 7 Windows Server 2008 R2
Windows 8 Windows Server 2012
Windows 8.1 Windows Server 2012 R2

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header winternl.h

See also

TlsGetValue