25#define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
26#define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
27#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
28#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
33#define IMAGE_FILE_MACHINE_I386 0x014c
34#define IMAGE_FILE_MACHINE_IA64 0x0200
35#define IMAGE_FILE_MACHINE_EBC 0x0EBC
36#define IMAGE_FILE_MACHINE_X64 0x8664
37#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x01c2
38#define IMAGE_FILE_MACHINE_ARM64 0xAA64
39#define IMAGE_FILE_MACHINE_RISCV32 0x5032
40#define IMAGE_FILE_MACHINE_RISCV64 0x5064
41#define IMAGE_FILE_MACHINE_RISCV128 0x5128
42#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
43#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
48#define EFI_IMAGE_DOS_SIGNATURE SIGNATURE_16('M', 'Z')
49#define EFI_IMAGE_OS2_SIGNATURE SIGNATURE_16('N', 'E')
50#define EFI_IMAGE_OS2_SIGNATURE_LE SIGNATURE_16('L', 'E')
51#define EFI_IMAGE_NT_SIGNATURE SIGNATURE_32('P', 'E', '\0', '\0')
84 UINT16 NumberOfSections;
86 UINT32 PointerToSymbolTable;
87 UINT32 NumberOfSymbols;
88 UINT16 SizeOfOptionalHeader;
89 UINT16 Characteristics;
95#define EFI_IMAGE_SIZEOF_FILE_HEADER 20
100#define EFI_IMAGE_FILE_RELOCS_STRIPPED BIT0
101#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE BIT1
102#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED BIT2
103#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED BIT3
104#define EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE BIT5
105#define EFI_IMAGE_FILE_BYTES_REVERSED_LO BIT7
106#define EFI_IMAGE_FILE_32BIT_MACHINE BIT8
107#define EFI_IMAGE_FILE_DEBUG_STRIPPED BIT9
108#define EFI_IMAGE_FILE_SYSTEM BIT12
109#define EFI_IMAGE_FILE_DLL BIT13
110#define EFI_IMAGE_FILE_BYTES_REVERSED_HI BIT15
116 UINT32 VirtualAddress;
123#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT 0
124#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT 1
125#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE 2
126#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
127#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY 4
128#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC 5
129#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG 6
130#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
131#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
132#define EFI_IMAGE_DIRECTORY_ENTRY_TLS 9
133#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
135#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
143#define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
153 UINT8 MajorLinkerVersion;
154 UINT8 MinorLinkerVersion;
156 UINT32 SizeOfInitializedData;
157 UINT32 SizeOfUninitializedData;
158 UINT32 AddressOfEntryPoint;
165 UINT32 SectionAlignment;
166 UINT32 FileAlignment;
167 UINT16 MajorOperatingSystemVersion;
168 UINT16 MinorOperatingSystemVersion;
169 UINT16 MajorImageVersion;
170 UINT16 MinorImageVersion;
171 UINT16 MajorSubsystemVersion;
172 UINT16 MinorSubsystemVersion;
173 UINT32 Win32VersionValue;
175 UINT32 SizeOfHeaders;
178 UINT16 DllCharacteristics;
179 UINT32 SizeOfStackReserve;
180 UINT32 SizeOfStackCommit;
181 UINT32 SizeOfHeapReserve;
182 UINT32 SizeOfHeapCommit;
184 UINT32 NumberOfRvaAndSizes;
194#define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
204 UINT8 MajorLinkerVersion;
205 UINT8 MinorLinkerVersion;
207 UINT32 SizeOfInitializedData;
208 UINT32 SizeOfUninitializedData;
209 UINT32 AddressOfEntryPoint;
215 UINT32 SectionAlignment;
216 UINT32 FileAlignment;
217 UINT16 MajorOperatingSystemVersion;
218 UINT16 MinorOperatingSystemVersion;
219 UINT16 MajorImageVersion;
220 UINT16 MinorImageVersion;
221 UINT16 MajorSubsystemVersion;
222 UINT16 MinorSubsystemVersion;
223 UINT32 Win32VersionValue;
225 UINT32 SizeOfHeaders;
228 UINT16 DllCharacteristics;
229 UINT64 SizeOfStackReserve;
230 UINT64 SizeOfStackCommit;
231 UINT64 SizeOfHeapReserve;
232 UINT64 SizeOfHeapCommit;
234 UINT32 NumberOfRvaAndSizes;
248#define EFI_IMAGE_SIZEOF_NT_OPTIONAL32_HEADER sizeof (EFI_IMAGE_NT_HEADERS32)
260#define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
265#define EFI_IMAGE_SUBSYSTEM_UNKNOWN 0
266#define EFI_IMAGE_SUBSYSTEM_NATIVE 1
267#define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
268#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3
269#define EFI_IMAGE_SUBSYSTEM_OS2_CUI 5
270#define EFI_IMAGE_SUBSYSTEM_POSIX_CUI 7
275#define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA 0x0020
276#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
277#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
278#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
279#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
280#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
281#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
282#define IMAGE_DLLCHARACTERISTICS_APPCONTAINER 0x1000
283#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
284#define IMAGE_DLLCHARACTERISTICS_GUARD_CF 0x4000
285#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
290#define EFI_IMAGE_SIZEOF_SHORT_NAME 8
298 UINT32 PhysicalAddress;
301 UINT32 VirtualAddress;
302 UINT32 SizeOfRawData;
303 UINT32 PointerToRawData;
304 UINT32 PointerToRelocations;
305 UINT32 PointerToLinenumbers;
306 UINT16 NumberOfRelocations;
307 UINT16 NumberOfLinenumbers;
308 UINT32 Characteristics;
314#define EFI_IMAGE_SIZEOF_SECTION_HEADER 40
319#define EFI_IMAGE_SCN_TYPE_NO_PAD BIT3
320#define EFI_IMAGE_SCN_CNT_CODE BIT5
321#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA BIT6
322#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA BIT7
324#define EFI_IMAGE_SCN_LNK_OTHER BIT8
325#define EFI_IMAGE_SCN_LNK_INFO BIT9
326#define EFI_IMAGE_SCN_LNK_REMOVE BIT11
327#define EFI_IMAGE_SCN_LNK_COMDAT BIT12
329#define EFI_IMAGE_SCN_ALIGN_1BYTES BIT20
330#define EFI_IMAGE_SCN_ALIGN_2BYTES BIT21
331#define EFI_IMAGE_SCN_ALIGN_4BYTES (BIT20|BIT21)
332#define EFI_IMAGE_SCN_ALIGN_8BYTES BIT22
333#define EFI_IMAGE_SCN_ALIGN_16BYTES (BIT20|BIT22)
334#define EFI_IMAGE_SCN_ALIGN_32BYTES (BIT21|BIT22)
335#define EFI_IMAGE_SCN_ALIGN_64BYTES (BIT20|BIT21|BIT22)
337#define EFI_IMAGE_SCN_MEM_DISCARDABLE BIT25
338#define EFI_IMAGE_SCN_MEM_NOT_CACHED BIT26
339#define EFI_IMAGE_SCN_MEM_NOT_PAGED BIT27
340#define EFI_IMAGE_SCN_MEM_SHARED BIT28
341#define EFI_IMAGE_SCN_MEM_EXECUTE BIT29
342#define EFI_IMAGE_SCN_MEM_READ BIT30
343#define EFI_IMAGE_SCN_MEM_WRITE BIT31
348#define EFI_IMAGE_SIZEOF_SYMBOL 18
354#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0
355#define EFI_IMAGE_SYM_ABSOLUTE (UINT16) -1
356#define EFI_IMAGE_SYM_DEBUG (UINT16) -2
361#define EFI_IMAGE_SYM_TYPE_NULL 0
362#define EFI_IMAGE_SYM_TYPE_VOID 1
363#define EFI_IMAGE_SYM_TYPE_CHAR 2
364#define EFI_IMAGE_SYM_TYPE_SHORT 3
365#define EFI_IMAGE_SYM_TYPE_INT 4
366#define EFI_IMAGE_SYM_TYPE_LONG 5
367#define EFI_IMAGE_SYM_TYPE_FLOAT 6
368#define EFI_IMAGE_SYM_TYPE_DOUBLE 7
369#define EFI_IMAGE_SYM_TYPE_STRUCT 8
370#define EFI_IMAGE_SYM_TYPE_UNION 9
371#define EFI_IMAGE_SYM_TYPE_ENUM 10
372#define EFI_IMAGE_SYM_TYPE_MOE 11
373#define EFI_IMAGE_SYM_TYPE_BYTE 12
374#define EFI_IMAGE_SYM_TYPE_WORD 13
375#define EFI_IMAGE_SYM_TYPE_UINT 14
376#define EFI_IMAGE_SYM_TYPE_DWORD 15
381#define EFI_IMAGE_SYM_DTYPE_NULL 0
382#define EFI_IMAGE_SYM_DTYPE_POINTER 1
383#define EFI_IMAGE_SYM_DTYPE_FUNCTION 2
384#define EFI_IMAGE_SYM_DTYPE_ARRAY 3
389#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION ((UINT8) -1)
390#define EFI_IMAGE_SYM_CLASS_NULL 0
391#define EFI_IMAGE_SYM_CLASS_AUTOMATIC 1
392#define EFI_IMAGE_SYM_CLASS_EXTERNAL 2
393#define EFI_IMAGE_SYM_CLASS_STATIC 3
394#define EFI_IMAGE_SYM_CLASS_REGISTER 4
395#define EFI_IMAGE_SYM_CLASS_EXTERNAL_DEF 5
396#define EFI_IMAGE_SYM_CLASS_LABEL 6
397#define EFI_IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
398#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
399#define EFI_IMAGE_SYM_CLASS_ARGUMENT 9
400#define EFI_IMAGE_SYM_CLASS_STRUCT_TAG 10
401#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
402#define EFI_IMAGE_SYM_CLASS_UNION_TAG 12
403#define EFI_IMAGE_SYM_CLASS_TYPE_DEFINITION 13
404#define EFI_IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
405#define EFI_IMAGE_SYM_CLASS_ENUM_TAG 15
406#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
407#define EFI_IMAGE_SYM_CLASS_REGISTER_PARAM 17
408#define EFI_IMAGE_SYM_CLASS_BIT_FIELD 18
409#define EFI_IMAGE_SYM_CLASS_BLOCK 100
410#define EFI_IMAGE_SYM_CLASS_FUNCTION 101
411#define EFI_IMAGE_SYM_CLASS_END_OF_STRUCT 102
412#define EFI_IMAGE_SYM_CLASS_FILE 103
413#define EFI_IMAGE_SYM_CLASS_SECTION 104
414#define EFI_IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
419#define EFI_IMAGE_N_BTMASK 017
420#define EFI_IMAGE_N_TMASK 060
421#define EFI_IMAGE_N_TMASK1 0300
422#define EFI_IMAGE_N_TMASK2 0360
423#define EFI_IMAGE_N_BTSHFT 4
424#define EFI_IMAGE_N_TSHIFT 2
429#define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES 1
430#define EFI_IMAGE_COMDAT_SELECT_ANY 2
431#define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE 3
432#define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH 4
433#define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
438#define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
439#define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
440#define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
446 UINT32 VirtualAddress;
447 UINT32 SymbolTableIndex;
454#define EFI_IMAGE_SIZEOF_RELOCATION 10
459#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000
460#define EFI_IMAGE_REL_I386_DIR16 0x0001
461#define EFI_IMAGE_REL_I386_REL16 0x0002
462#define EFI_IMAGE_REL_I386_DIR32 0x0006
463#define EFI_IMAGE_REL_I386_DIR32NB 0x0007
464#define EFI_IMAGE_REL_I386_SEG12 0x0009
465#define EFI_IMAGE_REL_I386_SECTION 0x000A
466#define EFI_IMAGE_REL_I386_SECREL 0x000B
467#define EFI_IMAGE_REL_I386_REL32 0x0014
472#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
473#define IMAGE_REL_AMD64_ADDR64 0x0001
474#define IMAGE_REL_AMD64_ADDR32 0x0002
475#define IMAGE_REL_AMD64_ADDR32NB 0x0003
476#define IMAGE_REL_AMD64_REL32 0x0004
477#define IMAGE_REL_AMD64_REL32_1 0x0005
478#define IMAGE_REL_AMD64_REL32_2 0x0006
479#define IMAGE_REL_AMD64_REL32_3 0x0007
480#define IMAGE_REL_AMD64_REL32_4 0x0008
481#define IMAGE_REL_AMD64_REL32_5 0x0009
482#define IMAGE_REL_AMD64_SECTION 0x000A
483#define IMAGE_REL_AMD64_SECREL 0x000B
484#define IMAGE_REL_AMD64_SECREL7 0x000C
485#define IMAGE_REL_AMD64_TOKEN 0x000D
486#define IMAGE_REL_AMD64_SREL32 0x000E
487#define IMAGE_REL_AMD64_PAIR 0x000F
488#define IMAGE_REL_AMD64_SSPAN32 0x0010
494 UINT32 VirtualAddress;
501#define EFI_IMAGE_SIZEOF_BASE_RELOCATION 8
506#define EFI_IMAGE_REL_BASED_ABSOLUTE 0
507#define EFI_IMAGE_REL_BASED_HIGH 1
508#define EFI_IMAGE_REL_BASED_LOW 2
509#define EFI_IMAGE_REL_BASED_HIGHLOW 3
510#define EFI_IMAGE_REL_BASED_HIGHADJ 4
511#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR 5
512#define EFI_IMAGE_REL_BASED_ARM_MOV32A 5
513#define EFI_IMAGE_REL_BASED_ARM_MOV32T 7
514#define EFI_IMAGE_REL_BASED_IA64_IMM64 9
515#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR16 9
516#define EFI_IMAGE_REL_BASED_DIR64 10
521#define EFI_IMAGE_REL_BASED_RISCV_HI20 5
522#define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
523#define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
528#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
529#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
545#define EFI_IMAGE_SIZEOF_LINENUMBER 6
550#define EFI_IMAGE_ARCHIVE_START_SIZE 8
551#define EFI_IMAGE_ARCHIVE_START "!<arch>\n"
552#define EFI_IMAGE_ARCHIVE_END "`\n"
553#define EFI_IMAGE_ARCHIVE_PAD "\n"
554#define EFI_IMAGE_ARCHIVE_LINKER_MEMBER "/ "
555#define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
573#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
583 UINT32 Characteristics;
584 UINT32 TimeDateStamp;
589 UINT32 NumberOfFunctions;
590 UINT32 NumberOfNames;
591 UINT32 AddressOfFunctions;
592 UINT32 AddressOfNames;
593 UINT32 AddressOfNameOrdinals;
599#define EFI_IMAGE_EXPORT_ORDINAL_BASE 1
600#define EFI_IMAGE_EXPORT_ADDR_SIZE 4
601#define EFI_IMAGE_EXPORT_ORDINAL_SIZE 2
622#define EFI_IMAGE_ORDINAL_FLAG BIT31
623#define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
624#define EFI_IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
630 UINT32 Characteristics;
631 UINT32 TimeDateStamp;
632 UINT32 ForwarderChain;
641 UINT32 Characteristics;
642 UINT32 TimeDateStamp;
651#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2
652#define EFI_IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 20
657#define CODEVIEW_SIGNATURE_NB10 SIGNATURE_32('N', 'B', '1', '0')
671#define CODEVIEW_SIGNATURE_RSDS SIGNATURE_32('R', 'S', 'D', 'S')
687#define CODEVIEW_SIGNATURE_MTOC SIGNATURE_32('M', 'T', 'O', 'C')
700 UINT32 FunctionStartAddress;
701 UINT32 FunctionEndAddress;
702 UINT32 UnwindInfoAddress;
709 UINT8 CountOfUnwindCodes;
710 UINT8 FrameRegister : 4;
711 UINT8 FrameRegisterOffset : 4;
717#define EFI_IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT 0x0001
718#define EFI_IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT 0x0040
721 UINT32 DllCharacteristicsEx;
728 UINT32 Characteristics;
729 UINT32 TimeDateStamp;
732 UINT16 NumberOfNamedEntries;
733 UINT16 NumberOfIdEntries;
745 UINT32 NameOffset : 31;
746 UINT32 NameIsString : 1;
753 UINT32 OffsetToDirectory : 31;
754 UINT32 DataIsDirectory : 1;
792#define EFI_TE_IMAGE_HEADER_SIGNATURE SIGNATURE_16('V', 'Z')
797#define EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC 0
798#define EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG 1
#define EFI_IMAGE_SIZEOF_SHORT_NAME
UINT32 FileOffset
The file pointer to the debug data.
UINT32 RVA
The address of the debug data when loaded, relative to the image base.
UINT16 e_oemid
OEM identifier (for e_oeminfo).
UINT16 e_oeminfo
OEM information; e_oemid specific.
UINT16 e_maxalloc
Maximum extra paragraphs needed.
UINT32 e_lfanew
File address of new exe header.
UINT16 e_crlc
Relocations.
UINT16 e_ip
Initial IP value.
UINT16 e_cparhdr
Size of header in paragraphs.
UINT16 e_magic
Magic number.
UINT16 e_minalloc
Minimum extra paragraphs needed.
UINT16 e_sp
Initial SP value.
UINT16 e_cblp
Bytes on last page of file.
UINT16 e_ss
Initial (relative) SS value.
UINT16 e_ovno
Overlay number.
UINT16 e_cp
Pages in file.
UINT16 e_lfarlc
File address of relocation table.
UINT16 e_cs
Initial (relative) CS value.
UINT32 SymbolTableIndex
Symbol table index of function name if Linenumber is 0.
UINT32 VirtualAddress
Virtual address of line number.
UINT16 Linenumber
Line number.
UINT32 AddressOfEntryPoint
Offset to entry point – from original optional header.
UINT16 Signature
The signature for TE format = "VZ".
UINT8 Subsystem
From original optional header.
UINT64 ImageBase
From original file header.
UINT32 BaseOfCode
From original image – required for ITP debug.
UINT16 StrippedSize
Number of bytes we removed from the header.
UINT8 NumberOfSections
From the original file header.
UINT16 Machine
From the original file header.