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]

Reserved for internal use by the operating system.

ProcessEnvironmentBlock

A pointer to the PEB structure that contains information for the process as a whole.

Reserved2[399]

Reserved for internal use by the operating system.

Reserved3[1952]

Reserved for internal use by the operating system.

TlsSlots[64]

Data for Thread Local Storage. Call the TlsGetValue function to access it.

Reserved4[8]

Reserved for internal use by the operating system.

Reserved5[26]

Reserved for internal use by the operating system.

ReservedForOle

Do not use. Call CoGetContextToken instead.

Reserved6[4]

Reserved for internal use by the operating system.

TlsExpansionSlots

Additional data for Thread Local Storage. Call the TlsGetValue function to access it.

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 fields, call TlsGetValue. To access the value of the ReservedForOle field, 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