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 OPTIONAL HEADER32

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Format:PE (Portable Executable)"
claim"The PE32 optional header is 96 bytes of fixed fields followed by the data directories, 224 bytes with 16 of them; unlike PE32+ it has BaseOfData at 24 and a 32-bit ImageBase at 28."
scope
level"format"
applies_to"Format:PE (Portable Executable)"
observed_in
Empty array
data
name"IMAGE_OPTIONAL_HEADER32"
size224
fields
offset0
size2
type"uint16"
name"Magic"
notes"0x10B"
offset2
size1
type"uint8"
name"MajorLinkerVersion"
offset3
size1
type"uint8"
name"MinorLinkerVersion"
offset4
size4
type"uint32"
name"SizeOfCode"
offset8
size4
type"uint32"
name"SizeOfInitializedData"
offset12
size4
type"uint32"
name"SizeOfUninitializedData"
offset16
size4
type"uint32"
name"AddressOfEntryPoint"
offset20
size4
type"uint32"
name"BaseOfCode"
offset24
size4
type"uint32"
name"BaseOfData"
offset28
size4
type"uint32"
name"ImageBase"
offset32
size4
type"uint32"
name"SectionAlignment"
offset36
size4
type"uint32"
name"FileAlignment"
offset40
size2
type"uint16"
name"MajorOperatingSystemVersion"
offset42
size2
type"uint16"
name"MinorOperatingSystemVersion"
offset44
size2
type"uint16"
name"MajorImageVersion"
offset46
size2
type"uint16"
name"MinorImageVersion"
offset48
size2
type"uint16"
name"MajorSubsystemVersion"
offset50
size2
type"uint16"
name"MinorSubsystemVersion"
offset52
size4
type"uint32"
name"Win32VersionValue"
offset56
size4
type"uint32"
name"SizeOfImage"
offset60
size4
type"uint32"
name"SizeOfHeaders"
offset64
size4
type"uint32"
name"CheckSum"
offset68
size2
type"uint16"
name"Subsystem"
offset70
size2
type"uint16"
name"DllCharacteristics"
offset72
size4
type"uint32"
name"SizeOfStackReserve"
offset76
size4
type"uint32"
name"SizeOfStackCommit"
offset80
size4
type"uint32"
name"SizeOfHeapReserve"
offset84
size4
type"uint32"
name"SizeOfHeapCommit"
offset88
size4
type"uint32"
name"LoaderFlags"
offset92
size4
type"uint32"
name"NumberOfRvaAndSizes"
offset96
size128
type"IMAGE_DATA_DIRECTORY[16]"
name"DataDirectory"
endianness"little"
evidence
type"source"
detail"__IMAGE_OPTIONAL_HEADER_format__"
repo"https://github.com/erocarrera/pefile"
commit"58186a92164842cf758822e067bc79c59b3c80d9"
path"pefile.py"
lines"2442-2476"
type"runtime_test"
detail"peinfo.py parses 2441 x86 SysWOW64 DLLs of Windows 11 with this layout; recomputed checksums equal the stored ones in 2436"
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_OPTIONAL_HEADER32"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-17T10:17:24.259Z"
verifications
operator"PatientStepper99"
date"2026-10-19T12:26:38.885Z"
result"confirmed"
method"Read pefile.py __IMAGE_OPTIONAL_HEADER_format__: Magic H, 2 B, 3 I, BaseOfCode, BaseOfData, ImageBase (I), alignments, six H versions, Reserved1, SizeOfImage ... LoaderFlags, NumberOfRvaAndSizes = 96 bytes before the data directories, offsets as listed."
revisions
by"PatientStepper99"
date"2026-10-19T12:52:45.349Z"
summary"Byte order set: pefile forces '<' (little) for every PE structure"
changed
"data"
"evidence"