ReactOS  0.4.15-dev-3303-g1ade494
pecoff.h
Go to the documentation of this file.
1 #pragma once
2 
3 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x010b
4 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x020b
5 
6 #define IMAGE_DOS_MAGIC 0x5a4d
7 #define IMAGE_PE_MAGIC 0x00004550
8 #define IMAGE_SIZEOF_SHORT_NAME 8
9 
10 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
11 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
12 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
13 
14 #define IMAGE_FILE_MACHINE_I386 0x14c
15 #define IMAGE_FILE_MACHINE_AMD64 0x8664
16 #define IMAGE_FILE_MACHINE_IA64 0x0200
17 
18 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
19 
20 #define IMAGE_SCN_TYPE_NOLOAD 0x00000002
21 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008
22 #define IMAGE_SCN_CNT_CODE 0x00000020
23 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
24 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
25 #define IMAGE_SCN_LNK_OTHER 0x00000100
26 #define IMAGE_SCN_LNK_INFO 0x00000200
27 #define IMAGE_SCN_LNK_REMOVE 0x00000800
28 #define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000
29 #define IMAGE_SCN_GPREL 0x00008000
30 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
31 #define IMAGE_SCN_MEM_LOCKED 0x00040000
32 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
33 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
34 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
35 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
36 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
37 #define IMAGE_SCN_MEM_SHARED 0x10000000
38 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
39 #define IMAGE_SCN_MEM_READ 0x40000000
40 #define IMAGE_SCN_MEM_WRITE 0x80000000
41 
42 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
43 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
44 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
45 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
46 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000
47 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
48 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
49 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
50 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
51 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
52 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
53 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
54 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
55 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
56 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
57 
58 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
59 
60 #define IMAGE_REL_I386_ABSOLUTE 0x0001
61 #define IMAGE_REL_I386_REL16 0x0002
62 #define IMAGE_REL_I386_DIR32 0x0006
63 
64 #pragma pack(push,2)
65 typedef struct _IMAGE_DOS_HEADER {
66  WORD e_magic;
67  WORD e_cblp;
68  WORD e_cp;
69  WORD e_crlc;
73  WORD e_ss;
74  WORD e_sp;
75  WORD e_csum;
76  WORD e_ip;
77  WORD e_cs;
78  WORD e_lfarlc;
79  WORD e_ovno;
80  WORD e_res[4];
81  WORD e_oemid;
83  WORD e_res2[10];
84  LONG e_lfanew;
86 #pragma pack(pop)
87 
88 #pragma pack(push,4)
89 typedef struct _IMAGE_FILE_HEADER {
90  WORD Machine;
98 #pragma pack(pop)
99 
100 typedef struct _IMAGE_DATA_DIRECTORY {
102  DWORD Size;
104 
105 typedef struct _IMAGE_OPTIONAL_HEADER32 {
138 
139 typedef struct _IMAGE_OPTIONAL_HEADER64 {
171 
172 #ifdef _TARGET_PE64
175 #else
178 #endif
179 
180 typedef struct _IMAGE_NT_HEADERS32
181 {
186 
187 typedef struct _IMAGE_NT_HEADERS64
188 {
193 
194 #ifdef _TARGET_PE64
197 #else
200 #endif
201 
202 typedef struct _IMAGE_SECTION_HEADER {
204  union {
207  } Misc;
217 
218 #pragma pack(push,4)
219 typedef struct _IMAGE_BASE_RELOCATION {
222  // Followed by: WORD TypeOffset[ANYSIZE_ARRAY];
224 #pragma pack(pop)
225 
226 #ifndef UNALIGNED
227 #define UNALIGNED
228 #endif
229 
230 #pragma pack(push,2)
231 typedef struct _IMAGE_RELOCATION {
232  union {
235  };
240 #pragma pack(pop)
241 
242 #pragma pack(push,2)
243 typedef struct _IMAGE_SYMBOL {
244  union {
246  struct {
249  } Name;
251  } N;
257 } IMAGE_SYMBOL;
259 #pragma pack(pop)
260 
261 #define IMAGE_DOS_SIGNATURE 0x5A4D
262 #define IMAGE_OS2_SIGNATURE 0x454E
263 #define IMAGE_OS2_SIGNATURE_LE 0x454C
264 #define IMAGE_VXD_SIGNATURE 0x454C
265 #define IMAGE_NT_SIGNATURE 0x00004550
266 
267 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
struct _IMAGE_BASE_RELOCATION IMAGE_BASE_RELOCATION
ULONGLONG SizeOfStackReserve
Definition: ntimage.h:364
DWORD SizeOfUninitializedData
Definition: pecoff.h:111
WORD NumberOfRelocations
Definition: pedump.c:293
ULONGLONG SizeOfStackCommit
Definition: ntimage.h:365
struct _IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER64
BYTE StorageClass
Definition: pecoff.h:255
WORD MinorOperatingSystemVersion
Definition: pecoff.h:119
WORD MajorOperatingSystemVersion
Definition: pecoff.h:151
struct _IMAGE_BASE_RELOCATION * PIMAGE_BASE_RELOCATION
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES
Definition: pecoff.h:58
DWORD PointerToRawData
Definition: pedump.c:290
DWORD SymbolTableIndex
Definition: pecoff.h:236
struct _IMAGE_SYMBOL::@2236::@2237 Name
struct _IMAGE_NT_HEADERS32 * PIMAGE_NT_HEADERS32
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: pecoff.h:199
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
struct _IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS64
struct _IMAGE_RELOCATION IMAGE_RELOCATION
DWORD Value
Definition: pecoff.h:252
IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
Definition: pecoff.h:176
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
WORD SizeOfOptionalHeader
Definition: ntddk_ex.h:127
struct _IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER32
WORD MajorOperatingSystemVersion
Definition: pecoff.h:118
IMAGE_OPTIONAL_HEADER64 OptionalHeader
Definition: ntimage.h:396
struct _IMAGE_DATA_DIRECTORY IMAGE_DATA_DIRECTORY
ULONGLONG SizeOfHeapCommit
Definition: ntimage.h:367
struct _IMAGE_NT_HEADERS64 * PIMAGE_NT_HEADERS64
struct _IMAGE_SYMBOL IMAGE_SYMBOL
WORD NumberOfLinenumbers
Definition: pedump.c:294
DWORD NumberOfSymbols
Definition: ntddk_ex.h:126
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
DWORD PointerToLinenumbers
Definition: pedump.c:292
uint64_t ULONGLONG
Definition: typedefs.h:67
#define IMAGE_SIZEOF_SHORT_NAME
Definition: pecoff.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
WORD Type
Definition: pecoff.h:254
WORD e_res2[10]
Definition: ntddk_ex.h:117
struct _IMAGE_FILE_HEADER IMAGE_FILE_HEADER
DWORD LongName[2]
Definition: pecoff.h:250
DWORD VirtualAddress
Definition: pecoff.h:233
DWORD SizeOfUninitializedData
Definition: pecoff.h:145
ULONGLONG SizeOfHeapReserve
Definition: ntimage.h:366
struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER
PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
Definition: pecoff.h:177
struct _IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS32
struct _IMAGE_DATA_DIRECTORY * PIMAGE_DATA_DIRECTORY
unsigned char BYTE
Definition: xxhash.c:193
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: pecoff.h:136
struct _IMAGE_FILE_HEADER * PIMAGE_FILE_HEADER
DWORD Short
Definition: pecoff.h:247
union _IMAGE_SYMBOL::@2236 N
BYTE ShortName[8]
Definition: pecoff.h:245
DWORD PointerToSymbolTable
Definition: ntddk_ex.h:125
struct _IMAGE_OPTIONAL_HEADER64 * PIMAGE_OPTIONAL_HEADER64
SHORT SectionNumber
Definition: pecoff.h:253
struct _IMAGE_RELOCATION UNALIGNED * PIMAGE_RELOCATION
Definition: pecoff.h:239
IMAGE_FILE_HEADER FileHeader
Definition: pecoff.h:183
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntimage.h:370
DWORD RelocCount
Definition: pecoff.h:234
union _IMAGE_SECTION_HEADER::@1510 Misc
IMAGE_FILE_HEADER FileHeader
Definition: ntimage.h:395
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: pecoff.h:184
WORD MinorOperatingSystemVersion
Definition: pecoff.h:152
IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
Definition: pecoff.h:198
DWORD Long
Definition: pecoff.h:248
struct _IMAGE_OPTIONAL_HEADER32 * PIMAGE_OPTIONAL_HEADER32
#define UNALIGNED
Definition: pecoff.h:227
DWORD PointerToRelocations
Definition: pedump.c:291
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:258
BYTE NumberOfAuxSymbols
Definition: pecoff.h:256