Win32 Thread Information Block

Win32 Thread Information Block

In computing, the Win32 Thread Information Block (TIB) is a data structure in Win32 on x86 that stores info about the currently running thread.

The TIB is officially undocumented for Windows 9x. The Windows NT series DDK includes a struct NT_TIB in winnt.h that documents the subsystem independent part. Wine includes declarations for the extended (subsystem-specific part of) TIB. Yet so many Win32 programs use undocumented fields that it is effectively a part of the API.

The TIB can be used to get a lot of information on the process without calling win32 API. Examples include emulating GetLastError(), GetVersion(). Through the pointer to the PEB one can obtain access to the import tables (IAT), process startup arguments, image name, etc.

Contents of the TIB

FS maps to a TIB which is embedded in a data block known as the TDB (thread data base). The TIB contains the thread-specific exception handling chain and pointer to the TLS (thread local storage.) The thread local storage is not the same as C local storage.

Accessing the TIB

The TIB can be accessed as an offset of segment register FS.

It is common to not access TIB fields by offset from FS: [0] , but rather first getting a the linear self-referencing pointer to the stored at FS: [0x18] . That pointer is used in means of pointer arithmetics or cast to a struct pointer.

Example in C inlined-assembly for 32-bit x86:

// gcc (AT&T-style inline assembly).void *getTIB(){ void *pTib; __asm__("movl %%fs:0x18, %0" : "=r" (pTib) : : ); return pTib;}// Microsoft Cvoid *getTib(){ void *pTib; __asm { mov EAX, FS: [18h] mov [pTib] , EAX } return pTib;}

External links

* [http://www.microsoft.com/msj/archive/S2CE.aspx Under The Hood - MSJ, May 1996]
* [http://www.winehq.org - Wine HQ]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Win32 Thread Information Block — Esta página o sección está siendo traducida del idioma inglés a partir del artículo Win32 Thread Information Block, razón por la cual puede haber lagunas de contenidos, errores sintácticos o escritos sin traducir. Puedes colaborar con… …   Wikipedia Español

  • Thread (computer science) — This article is about the concurrency concept. For the multithreading in hardware, see Multithreading (computer architecture). For the form of code consisting entirely of subroutine calls, see Threaded code. For other uses, see Thread… …   Wikipedia

  • List of Microsoft Windows components — The following is a list of Microsoft Windows components. Contents 1 Configuration and maintenance 2 User interface 3 Applications and utilities 4 Windows Server components …   Wikipedia

  • TIB — may mean:* Therapy Interfering Behavior * Forbundet Træ Industri Byg i Danmark, the Danish Timber Industry and Construction Workers Union * Tibet * the Win32 Thread Information Block *Tebibit (Tib), a unit of information used, for example, to… …   Wikipedia

  • Microsoft-specific exception handling mechanisms — Microsoft Windows OS family employs some exception handling mechanisms that are based on the operation system specifics. Contents 1 Structured Exception Handling 1.1 Usage 1.2 Implementation 1.3 …   Wikipedia

  • Структурная обработка исключений — (англ. SEH Structured Exception Handling)  механизм обработки программных и аппаратных исключений в ОС Microsoft Windows, позволяющий программистам контролировать обработку исключений, а также являющийся отладочным средством[1].… …   Википедия

  • Technical features new to Windows Vista — This article is part of a series on Windows Vista New features Overview Technical and core system Security and safety Networking technologies I/O technologies Management and administration Removed features …   Wikipedia

  • Comparison of operating systems — Usage share of web client operating systems. (Source: Median values from Usage share of operating systems for August 2011.)   Windows XP (35.21%) …   Wikipedia

  • Oxygene (programming language) — Oxygene Developer RemObjects Software Stable release 3.0.21 (August 29, 2009; 2 years ago (2009 08 29)) Influenced by Object Pas …   Wikipedia

  • Comparison of C Sharp and Java — The correct title of this article is Comparison of C# and Java. The substitution or omission of the # sign is because of technical restrictions. Programming language comparisons General comparison Basic syntax Basic instructions …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”