Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Fact:PE (Portable Executable)/struct/IMAGE TLS DIRECTORY

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
Empty array
data
name"IMAGE_TLS_DIRECTORY64"
size40
variant"PE32+ (PE32: same order, four 4-byte VA fields, total 24 bytes)"
fields
offset0
size8
type"VA"
name"StartAddressOfRawData"
offset8
size8
type"VA"
name"EndAddressOfRawData"
offset16
size8
type"VA"
name"AddressOfIndex"
notes"receives the TLS index"
offset24
size8
type"VA"
name"AddressOfCallBacks"
notes"VA of a NULL-terminated array of callback VAs"
offset32
size4
type"uint32"
name"SizeOfZeroFill"
offset36
size4
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
Empty array
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
"data"
"evidence"