From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:PE (Portable Executable)" |
|---|
| claim | "The TLS directory (data directory 9) is IMAGE_TLS_DIRECTORY32 (24 bytes) or IMAGE_TLS_DIRECTORY64 (40 bytes); its first four fields are virtual addresses, not RVAs." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:PE (Portable Executable)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "IMAGE_TLS_DIRECTORY64" |
|---|
| size | 40 |
|---|
| variant | "PE32+ (PE32: same order, four 4-byte VA fields, total 24 bytes)" |
|---|
| fields | | offset | 0 |
|---|
| size | 8 |
|---|
| type | "VA" |
|---|
| name | "StartAddressOfRawData" |
|---|
|
| offset | 8 |
|---|
| size | 8 |
|---|
| type | "VA" |
|---|
| name | "EndAddressOfRawData" |
|---|
|
| offset | 16 |
|---|
| size | 8 |
|---|
| type | "VA" |
|---|
| name | "AddressOfIndex" |
|---|
| notes | "receives the TLS index" |
|---|
|
| offset | 24 |
|---|
| size | 8 |
|---|
| type | "VA" |
|---|
| name | "AddressOfCallBacks" |
|---|
| notes | "VA of a NULL-terminated array of callback VAs" |
|---|
|
| offset | 32 |
|---|
| size | 4 |
|---|
| type | "uint32" |
|---|
| name | "SizeOfZeroFill" |
|---|
|
| offset | 36 |
|---|
| size | 4 |
|---|
| type | "uint32" |
|---|
| name | "Characteristics" |
|---|
| notes | "bits 20-23 IMAGE_SCN_ALIGN_*" |
|---|
|
|
|---|
| endianness | "little" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "__IMAGE_TLS_DIRECTORY_format__ and the 64-bit variant; relocate_image adds the relocation delta to AddressOfCallBacks (so they are VAs)" |
|---|
| repo | "https://github.com/erocarrera/pefile" |
|---|
| commit | "58186a92164842cf758822e067bc79c59b3c80d9" |
|---|
| path | "pefile.py" |
|---|
| lines | "2713-2735, 7595-7600" |
|---|
|
| type | "source" |
|---|
| detail | "IMAGE_TLS_DIRECTORY64/32 and PIMAGE_TLS_CALLBACK(DllHandle, Reason, Reserved)" |
|---|
| repo | "https://github.com/wine-mirror/wine" |
|---|
| commit | "7298a818b79446bae153b8d5aa27235ab3703bf9" |
|---|
| path | "include/winnt.h" |
|---|
| lines | "3959-3979" |
|---|
|
| type | "source" |
|---|
| detail | "Structure.__init__: 'Format is forced little endian', __format_str__ = "<"" |
|---|
| repo | "https://github.com/erocarrera/pefile" |
|---|
| commit | "58186a92164842cf758822e067bc79c59b3c80d9" |
|---|
| path | "pefile.py" |
|---|
| lines | "942-945" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "IMAGE_TLS_DIRECTORY" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T08:09:42.367Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T12:26:38.575Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read pefile.py at the cited commit: __IMAGE_TLS_DIRECTORY_format__ is four 'I' address fields + SizeOfZeroFill + Characteristics (24 bytes); the 64-bit format has four 'Q' fields then two 'I' (40 bytes). Same field names and order as the fact." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T12:52:45.706Z" |
|---|
| summary | "Byte order set: pefile forces '<' (little) for every PE structure" |
|---|
| changed | |
|---|
|
|
|---|