2 * Copyright (c) 2018 Virtuozzo International GmbH
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
13 typedef struct IMAGE_DOS_HEADER
{
14 uint16_t e_magic
; /* 0x00: MZ Header signature */
15 uint16_t e_cblp
; /* 0x02: Bytes on last page of file */
16 uint16_t e_cp
; /* 0x04: Pages in file */
17 uint16_t e_crlc
; /* 0x06: Relocations */
18 uint16_t e_cparhdr
; /* 0x08: Size of header in paragraphs */
19 uint16_t e_minalloc
; /* 0x0a: Minimum extra paragraphs needed */
20 uint16_t e_maxalloc
; /* 0x0c: Maximum extra paragraphs needed */
21 uint16_t e_ss
; /* 0x0e: Initial (relative) SS value */
22 uint16_t e_sp
; /* 0x10: Initial SP value */
23 uint16_t e_csum
; /* 0x12: Checksum */
24 uint16_t e_ip
; /* 0x14: Initial IP value */
25 uint16_t e_cs
; /* 0x16: Initial (relative) CS value */
26 uint16_t e_lfarlc
; /* 0x18: File address of relocation table */
27 uint16_t e_ovno
; /* 0x1a: Overlay number */
28 uint16_t e_res
[4]; /* 0x1c: Reserved words */
29 uint16_t e_oemid
; /* 0x24: OEM identifier (for e_oeminfo) */
30 uint16_t e_oeminfo
; /* 0x26: OEM information; e_oemid specific */
31 uint16_t e_res2
[10]; /* 0x28: Reserved words */
32 uint32_t e_lfanew
; /* 0x3c: Offset to extended header */
33 } __attribute__ ((packed
)) IMAGE_DOS_HEADER
;
35 typedef struct IMAGE_FILE_HEADER
{
37 uint16_t NumberOfSections
;
38 uint32_t TimeDateStamp
;
39 uint32_t PointerToSymbolTable
;
40 uint32_t NumberOfSymbols
;
41 uint16_t SizeOfOptionalHeader
;
42 uint16_t Characteristics
;
43 } __attribute__ ((packed
)) IMAGE_FILE_HEADER
;
45 typedef struct IMAGE_DATA_DIRECTORY
{
46 uint32_t VirtualAddress
;
48 } __attribute__ ((packed
)) IMAGE_DATA_DIRECTORY
;
50 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
52 typedef struct IMAGE_OPTIONAL_HEADER64
{
53 uint16_t Magic
; /* 0x20b */
54 uint8_t MajorLinkerVersion
;
55 uint8_t MinorLinkerVersion
;
57 uint32_t SizeOfInitializedData
;
58 uint32_t SizeOfUninitializedData
;
59 uint32_t AddressOfEntryPoint
;
62 uint32_t SectionAlignment
;
63 uint32_t FileAlignment
;
64 uint16_t MajorOperatingSystemVersion
;
65 uint16_t MinorOperatingSystemVersion
;
66 uint16_t MajorImageVersion
;
67 uint16_t MinorImageVersion
;
68 uint16_t MajorSubsystemVersion
;
69 uint16_t MinorSubsystemVersion
;
70 uint32_t Win32VersionValue
;
72 uint32_t SizeOfHeaders
;
75 uint16_t DllCharacteristics
;
76 uint64_t SizeOfStackReserve
;
77 uint64_t SizeOfStackCommit
;
78 uint64_t SizeOfHeapReserve
;
79 uint64_t SizeOfHeapCommit
;
81 uint32_t NumberOfRvaAndSizes
;
82 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
83 } __attribute__ ((packed
)) IMAGE_OPTIONAL_HEADER64
;
85 typedef struct IMAGE_NT_HEADERS64
{
87 IMAGE_FILE_HEADER FileHeader
;
88 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
89 } __attribute__ ((packed
)) IMAGE_NT_HEADERS64
;
91 typedef struct IMAGE_EXPORT_DIRECTORY
{
92 uint32_t Characteristics
;
93 uint32_t TimeDateStamp
;
94 uint16_t MajorVersion
;
95 uint16_t MinorVersion
;
98 uint32_t NumberOfFunctions
;
99 uint32_t NumberOfNames
;
100 uint32_t AddressOfFunctions
;
101 uint32_t AddressOfNames
;
102 uint32_t AddressOfNameOrdinals
;
103 } __attribute__ ((packed
)) IMAGE_EXPORT_DIRECTORY
;
105 typedef struct IMAGE_DEBUG_DIRECTORY
{
106 uint32_t Characteristics
;
107 uint32_t TimeDateStamp
;
108 uint16_t MajorVersion
;
109 uint16_t MinorVersion
;
112 uint32_t AddressOfRawData
;
113 uint32_t PointerToRawData
;
114 } __attribute__ ((packed
)) IMAGE_DEBUG_DIRECTORY
;
116 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
119 #define IMAGE_FILE_EXPORT_DIRECTORY 0
120 #define IMAGE_FILE_DEBUG_DIRECTORY 6
122 typedef struct guid_t
{
128 } __attribute__ ((packed
)) guid_t
;
130 typedef struct OMFSignatureRSDS
{
135 } __attribute__ ((packed
)) OMFSignatureRSDS
;