ReactOS 0.4.15-dev-8109-gd7be748
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)
65typedef struct _IMAGE_DOS_HEADER {
68 WORD e_cp;
73 WORD e_ss;
74 WORD e_sp;
76 WORD e_ip;
77 WORD e_cs;
80 WORD e_res[4];
83 WORD e_res2[10];
86#pragma pack(pop)
87
88#pragma pack(push,4)
89typedef struct _IMAGE_FILE_HEADER {
98#pragma pack(pop)
99
100typedef struct _IMAGE_DATA_DIRECTORY {
102 DWORD Size;
104
138
139typedef struct _IMAGE_OPTIONAL_HEADER64 {
171
172#ifdef _TARGET_PE64
175#else
178#endif
179
181{
186
187typedef struct _IMAGE_NT_HEADERS64
188{
193
194#ifdef _TARGET_PE64
197#else
200#endif
201
202typedef struct _IMAGE_SECTION_HEADER {
204 union {
217
218#pragma pack(push,4)
219typedef 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)
231typedef struct _IMAGE_RELOCATION {
232 union {
235 };
240#pragma pack(pop)
241
242#pragma pack(push,2)
243typedef struct _IMAGE_SYMBOL {
244 union {
246 struct {
251 } N;
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))
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
struct _IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS32
struct _IMAGE_OPTIONAL_HEADER64 * PIMAGE_OPTIONAL_HEADER64
IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
Definition: pecoff.h:198
struct _IMAGE_RELOCATION IMAGE_RELOCATION
struct _IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER64
struct _IMAGE_OPTIONAL_HEADER32 * PIMAGE_OPTIONAL_HEADER32
IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
Definition: pecoff.h:176
struct _IMAGE_DATA_DIRECTORY IMAGE_DATA_DIRECTORY
struct _IMAGE_BASE_RELOCATION IMAGE_BASE_RELOCATION
struct _IMAGE_SECTION_HEADER * PIMAGE_SECTION_HEADER
struct _IMAGE_BASE_RELOCATION * PIMAGE_BASE_RELOCATION
struct _IMAGE_FILE_HEADER IMAGE_FILE_HEADER
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: pecoff.h:199
struct _IMAGE_RELOCATION UNALIGNED * PIMAGE_RELOCATION
Definition: pecoff.h:239
struct _IMAGE_NT_HEADERS64 * PIMAGE_NT_HEADERS64
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
struct _IMAGE_SYMBOL IMAGE_SYMBOL
struct _IMAGE_DATA_DIRECTORY * PIMAGE_DATA_DIRECTORY
#define UNALIGNED
Definition: pecoff.h:227
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
Definition: pecoff.h:177
struct _IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS64
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:258
struct _IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER32
struct _IMAGE_FILE_HEADER * PIMAGE_FILE_HEADER
struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER
struct _IMAGE_NT_HEADERS32 * PIMAGE_NT_HEADERS32
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
WORD e_res2[10]
Definition: ntddk_ex.h:117
DWORD NumberOfSymbols
Definition: ntddk_ex.h:126
DWORD PointerToSymbolTable
Definition: ntddk_ex.h:125
WORD SizeOfOptionalHeader
Definition: ntddk_ex.h:127
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: pecoff.h:184
IMAGE_FILE_HEADER FileHeader
Definition: pecoff.h:183
IMAGE_OPTIONAL_HEADER64 OptionalHeader
Definition: ntimage.h:396
IMAGE_FILE_HEADER FileHeader
Definition: ntimage.h:395
WORD MajorOperatingSystemVersion
Definition: pecoff.h:118
WORD MinorOperatingSystemVersion
Definition: pecoff.h:119
DWORD SizeOfUninitializedData
Definition: pecoff.h:111
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: pecoff.h:136
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntimage.h:370
ULONGLONG SizeOfStackReserve
Definition: ntimage.h:364
ULONGLONG SizeOfHeapCommit
Definition: ntimage.h:367
ULONGLONG SizeOfStackCommit
Definition: ntimage.h:365
DWORD SizeOfUninitializedData
Definition: pecoff.h:145
WORD MajorOperatingSystemVersion
Definition: pecoff.h:151
ULONGLONG SizeOfHeapReserve
Definition: ntimage.h:366
WORD MinorOperatingSystemVersion
Definition: pecoff.h:152
DWORD RelocCount
Definition: pecoff.h:234
DWORD VirtualAddress
Definition: pecoff.h:233
DWORD SymbolTableIndex
Definition: pecoff.h:236
DWORD PointerToLinenumbers
Definition: pedump.c:292
DWORD PointerToRelocations
Definition: pedump.c:291
DWORD PointerToRawData
Definition: pedump.c:290
WORD NumberOfLinenumbers
Definition: pedump.c:294
WORD NumberOfRelocations
Definition: pedump.c:293
union _IMAGE_SECTION_HEADER::@1560 Misc
DWORD LongName[2]
Definition: pecoff.h:250
WORD Type
Definition: pecoff.h:254
BYTE NumberOfAuxSymbols
Definition: pecoff.h:256
DWORD Value
Definition: pecoff.h:252
struct _IMAGE_SYMBOL::@2296::@2297 Name
BYTE StorageClass
Definition: pecoff.h:255
DWORD Long
Definition: pecoff.h:248
DWORD Short
Definition: pecoff.h:247
BYTE ShortName[8]
Definition: pecoff.h:245
union _IMAGE_SYMBOL::@2296 N
SHORT SectionNumber
Definition: pecoff.h:253
uint64_t ULONGLONG
Definition: typedefs.h:67
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES
Definition: winnt_old.h:638
#define IMAGE_SIZEOF_SHORT_NAME
Definition: winnt_old.h:642
unsigned char BYTE
Definition: xxhash.c:193