From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:DOS MZ executable" |
|---|
| claim | "The MZ header of DOS and Windows executables is the 64-byte IMAGE_DOS_HEADER: 'MZ', 13 uint16 DOS loader fields (e_cblp ... e_ovno), reserved words, e_oemid/e_oeminfo, and at 0x3C the uint32 e_lfanew, the file offset of the PE/NE/LE header." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:DOS MZ executable" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "IMAGE_DOS_HEADER" |
|---|
| size | 64 |
|---|
| fields | | offset | 0 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_magic" |
|---|
| notes | "0x5A4D 'MZ'" |
|---|
|
| offset | 2 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_cblp" |
|---|
| notes | "bytes on last 512-byte page" |
|---|
|
| offset | 4 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_cp" |
|---|
| notes | "512-byte pages in the DOS image" |
|---|
|
| offset | 6 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_crlc" |
|---|
| notes | "relocation count" |
|---|
|
| offset | 8 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_cparhdr" |
|---|
| notes | "header size in paragraphs" |
|---|
|
| offset | 10 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_minalloc" |
|---|
|
| offset | 12 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_maxalloc" |
|---|
|
| offset | 14 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_ss" |
|---|
|
| offset | 16 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_sp" |
|---|
|
| offset | 18 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_csum" |
|---|
|
| offset | 20 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_ip" |
|---|
|
| offset | 22 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_cs" |
|---|
|
| offset | 24 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_lfarlc" |
|---|
| notes | "relocation table offset, 0x40 in Windows files" |
|---|
|
| offset | 26 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_ovno" |
|---|
|
| offset | 28 |
|---|
| size | 8 |
|---|
| type | "uint16[4]" |
|---|
| name | "e_res" |
|---|
|
| offset | 36 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_oemid" |
|---|
|
| offset | 38 |
|---|
| size | 2 |
|---|
| type | "uint16" |
|---|
| name | "e_oeminfo" |
|---|
|
| offset | 40 |
|---|
| size | 20 |
|---|
| type | "uint16[10]" |
|---|
| name | "e_res2" |
|---|
|
| offset | 60 |
|---|
| size | 4 |
|---|
| type | "uint32" |
|---|
| name | "e_lfanew" |
|---|
| notes | "file offset of 'PE\0\0' / 'NE' / 'LE'" |
|---|
|
|
|---|
| endianness | "little" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "__IMAGE_DOS_HEADER_format__" |
|---|
| repo | "https://github.com/erocarrera/pefile" |
|---|
| commit | "58186a92164842cf758822e067bc79c59b3c80d9" |
|---|
| path | "pefile.py" |
|---|
| lines | "2402-2424" |
|---|
|
| type | "documentation" |
|---|
| detail | "Microsoft PE Format, MS-DOS Stub: 'At location 0x3c, the stub has the file offset to the PE signature.'" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "parsed with a Python script on about 8000 PE files of a Windows 11 installation; e_lfanew pointed to PE\0\0 in all" |
|---|
|
| type | "source" |
|---|
| detail | "Structure.__format_str__ = "<" (little-endian struct formats for IMAGE_DOS_HEADER)" |
|---|
| repo | "https://github.com/erocarrera/pefile" |
|---|
| commit | "58186a92164842cf758822e067bc79c59b3c80d9" |
|---|
| path | "pefile.py" |
|---|
| lines | "894, 944" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "IMAGE_DOS_HEADER" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T10:17:23.615Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T12:39:39.191Z" |
|---|
| summary | "Set byte order little: pefile Structure formats start with '<'." |
|---|
| changed | |
|---|
|
|
|---|