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 HEADER64

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Format:PE (Portable Executable)"
claim"The PE32+ optional header is 112 bytes of fixed fields followed by NumberOfRvaAndSizes (normally 16) 8-byte data directories, 240 bytes in total; ImageBase and the stack/heap sizes are 64-bit and there is no BaseOfData."
scope
level"format"
applies_to"Format:PE (Portable Executable)"
observed_in
Empty array
data
name"IMAGE_OPTIONAL_HEADER64"
size240
fields
offset0
size2
type"uint16"
name"Magic"
notes"0x20B"
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"
notes"RVA"
offset20
size4
type"uint32"
name"BaseOfCode"
offset24
size8
type"uint64"
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
size8
type"uint64"
name"SizeOfStackReserve"
offset80
size8
type"uint64"
name"SizeOfStackCommit"
offset88
size8
type"uint64"
name"SizeOfHeapReserve"
offset96
size8
type"uint64"
name"SizeOfHeapCommit"
offset104
size4
type"uint32"
name"LoaderFlags"
offset108
size4
type"uint32"
name"NumberOfRvaAndSizes"
offset112
size128
type"IMAGE_DATA_DIRECTORY[16]"
name"DataDirectory"
notes"{uint32 VirtualAddress; uint32 Size}"
endianness"little"
evidence
type"source"
detail"__IMAGE_OPTIONAL_HEADER64_format__ and __IMAGE_DATA_DIRECTORY_format__"
repo"https://github.com/erocarrera/pefile"
commit"58186a92164842cf758822e067bc79c59b3c80d9"
path"pefile.py"
lines"2478-2516"
type"runtime_test"
detail"peinfo.py parses x64 Windows 11 system files with this layout; checksum at offset 64 matches imagehlp!CheckSumMappedFile"
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_HEADER64"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-17T10:17:24.190Z"
verifications
operator"PatientStepper99"
date"2026-10-19T12:26:39.348Z"
result"confirmed"
method"Read pefile.py __IMAGE_OPTIONAL_HEADER64_format__: no BaseOfData, ImageBase Q at 24, four Q stack/heap fields at 72-103, LoaderFlags 104, NumberOfRvaAndSizes 108 = 112 bytes fixed; data directory is {I VirtualAddress, I Size}."
revisions
by"PatientStepper99"
date"2026-10-19T12:52:45.423Z"
summary"Byte order set: pefile forces '<' (little) for every PE structure"
changed
"data"
"evidence"