ReactOS  0.4.15-dev-1033-gd7d716a
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_NUMBEROF_DIRECTORY_ENTRIES 16
43 
44 #define IMAGE_REL_I386_ABSOLUTE 0x0001
45 #define IMAGE_REL_I386_DIR32 0x0006
46 
47 #pragma pack(push,2)
48 typedef struct _IMAGE_DOS_HEADER {
49  WORD e_magic;
50  WORD e_cblp;
51  WORD e_cp;
52  WORD e_crlc;
56  WORD e_ss;
57  WORD e_sp;
58  WORD e_csum;
59  WORD e_ip;
60  WORD e_cs;
61  WORD e_lfarlc;
62  WORD e_ovno;
63  WORD e_res[4];
64  WORD e_oemid;
66  WORD e_res2[10];
67  LONG e_lfanew;
69 #pragma pack(pop)
70 
71 #pragma pack(push,4)
72 typedef struct _IMAGE_FILE_HEADER {
73  WORD Machine;
81 #pragma pack(pop)
82 
83 typedef struct _IMAGE_DATA_DIRECTORY {
85  DWORD Size;
87 
88 typedef struct _IMAGE_OPTIONAL_HEADER32 {
121 
122 typedef struct _IMAGE_OPTIONAL_HEADER64 {
154 
155 #ifdef _TARGET_PE64
158 #else
161 #endif
162 
163 typedef struct _IMAGE_NT_HEADERS32
164 {
169 
170 typedef struct _IMAGE_NT_HEADERS64
171 {
176 
177 #ifdef _TARGET_PE64
180 #else
183 #endif
184 
185 typedef struct _IMAGE_SECTION_HEADER {
187  union {
190  } Misc;
200 
201 #pragma pack(push,4)
202 typedef struct _IMAGE_BASE_RELOCATION {
205  // Followed by: WORD TypeOffset[ANYSIZE_ARRAY];
207 #pragma pack(pop)
208 
209 #ifndef UNALIGNED
210 #define UNALIGNED
211 #endif
212 
213 #pragma pack(push,2)
214 typedef struct _IMAGE_RELOCATION {
215  union {
218  };
223 #pragma pack(pop)
224 
225 #pragma pack(push,2)
226 typedef struct _IMAGE_SYMBOL {
227  union {
229  struct {
232  } Name;
234  } N;
240 } IMAGE_SYMBOL;
242 #pragma pack(pop)
243 
244 #define IMAGE_DOS_SIGNATURE 0x5A4D
245 #define IMAGE_OS2_SIGNATURE 0x454E
246 #define IMAGE_OS2_SIGNATURE_LE 0x454C
247 #define IMAGE_VXD_SIGNATURE 0x454C
248 #define IMAGE_NT_SIGNATURE 0x00004550
249 
250 #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:94
WORD NumberOfRelocations
Definition: pedump.c:293
ULONGLONG SizeOfStackCommit
Definition: ntimage.h:365
struct _IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER64
BYTE StorageClass
Definition: pecoff.h:238
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: pecoff.h:174
WORD MinorOperatingSystemVersion
Definition: pecoff.h:102
WORD MajorOperatingSystemVersion
Definition: pecoff.h:134
struct _IMAGE_BASE_RELOCATION * PIMAGE_BASE_RELOCATION
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES
Definition: pecoff.h:42
DWORD PointerToRawData
Definition: pedump.c:290
DWORD SymbolTableIndex
Definition: pecoff.h:219
struct _IMAGE_NT_HEADERS32 * PIMAGE_NT_HEADERS32
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: pecoff.h:182
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
struct _IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS64
struct _IMAGE_SYMBOL::@2259::@2260 Name
struct _IMAGE_RELOCATION IMAGE_RELOCATION
DWORD Value
Definition: pecoff.h:235
IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
Definition: pecoff.h:159
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
union _IMAGE_SECTION_HEADER::@1553 Misc
WORD SizeOfOptionalHeader
Definition: ntddk_ex.h:127
struct _IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER32
WORD MajorOperatingSystemVersion
Definition: pecoff.h:101
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 SizeOfInitializedData
Definition: pecoff.h:93
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:237
WORD e_res2[10]
Definition: ntddk_ex.h:117
struct _IMAGE_FILE_HEADER IMAGE_FILE_HEADER
DWORD LongName[2]
Definition: pecoff.h:233
DWORD VirtualAddress
Definition: pecoff.h:216
DWORD SizeOfUninitializedData
Definition: pecoff.h:128
ULONGLONG SizeOfHeapReserve
Definition: ntimage.h:366
struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER
PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
Definition: pecoff.h:160
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:119
struct _IMAGE_FILE_HEADER * PIMAGE_FILE_HEADER
DWORD Short
Definition: pecoff.h:230
BYTE ShortName[8]
Definition: pecoff.h:228
DWORD PointerToSymbolTable
Definition: ntddk_ex.h:125
struct _IMAGE_OPTIONAL_HEADER64 * PIMAGE_OPTIONAL_HEADER64
SHORT SectionNumber
Definition: pecoff.h:236
struct _IMAGE_RELOCATION UNALIGNED * PIMAGE_RELOCATION
Definition: pecoff.h:222
IMAGE_FILE_HEADER FileHeader
Definition: pecoff.h:166
struct _IMAGE_DOS_HEADER IMAGE_DOS_HEADER
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntimage.h:370
DWORD RelocCount
Definition: pecoff.h:217
union _IMAGE_SYMBOL::@2259 N
IMAGE_FILE_HEADER FileHeader
Definition: ntimage.h:395
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: pecoff.h:167
WORD MinorOperatingSystemVersion
Definition: pecoff.h:135
IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
Definition: pecoff.h:181
DWORD Long
Definition: pecoff.h:231
struct _IMAGE_OPTIONAL_HEADER32 * PIMAGE_OPTIONAL_HEADER32
#define UNALIGNED
Definition: pecoff.h:210
DWORD PointerToRelocations
Definition: pedump.c:291
struct _IMAGE_SYMBOL UNALIGNED * PIMAGE_SYMBOL
Definition: pecoff.h:241
BYTE NumberOfAuxSymbols
Definition: pecoff.h:239