VirtualBox

source: vbox/trunk/include/iprt/formats/pecoff.h@ 73374

Last change on this file since 73374 was 73374, checked in by vboxsync, 6 years ago

iprt/formats/pecoff.h: Added IMAGE_RUNTIME_FUNCTION_ENTRY.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 88.1 KB
Line 
1/* $Id: pecoff.h 73374 2018-07-27 07:59:20Z vboxsync $ */
2/** @file
3 * IPRT - Windows NT PE & COFF Structures and Constants.
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___iprt_formats_pecoff_h
28#define ___iprt_formats_pecoff_h
29
30#include <iprt/types.h>
31#include <iprt/assertcompile.h>
32
33
34/** @defgroup grp_rt_formats_pecoff PE & Microsoft COFF structures and definitions
35 * @ingroup grp_rt_formats
36 * @{
37 */
38
39
40/**
41 * PE & COFF file header.
42 *
43 * This starts COFF files, while in PE files it's preceeded by the PE signature
44 * (see IMAGE_NT_HEADERS32, IMAGE_NT_HEADERS64).
45 */
46typedef struct _IMAGE_FILE_HEADER
47{
48 uint16_t Machine; /**< 0x00 */
49 uint16_t NumberOfSections; /**< 0x02 */
50 uint32_t TimeDateStamp; /**< 0x04 */
51 uint32_t PointerToSymbolTable; /**< 0x08 */
52 uint32_t NumberOfSymbols; /**< 0x0c */
53 uint16_t SizeOfOptionalHeader; /**< 0x10 */
54 uint16_t Characteristics; /**< 0x12 */
55} IMAGE_FILE_HEADER; /* size: 0x14 */
56AssertCompileSize(IMAGE_FILE_HEADER, 0x14);
57typedef IMAGE_FILE_HEADER *PIMAGE_FILE_HEADER;
58typedef IMAGE_FILE_HEADER const *PCIMAGE_FILE_HEADER;
59
60
61/** @name PE & COFF machine types.
62 * Used by IMAGE_FILE_HEADER::Machine and IMAGE_SEPARATE_DEBUG_HEADER::Machine.
63 * @{ */
64/** X86 compatible CPU, 32-bit instructions. */
65#define IMAGE_FILE_MACHINE_I386 UINT16_C(0x014c)
66/** AMD64 compatible CPU, 64-bit instructions. */
67#define IMAGE_FILE_MACHINE_AMD64 UINT16_C(0x8664)
68
69/** Unknown target CPU. */
70#define IMAGE_FILE_MACHINE_UNKNOWN UINT16_C(0x0000)
71/** Basic-16 (whatever that is). */
72#define IMAGE_FILE_MACHINE_BASIC_16 UINT16_C(0x0142)
73/** Basic-16 (whatever that is) w/ transfer vector(s?) (TV). */
74#define IMAGE_FILE_MACHINE_BASIC_16_TV UINT16_C(0x0143)
75/** Intel iAPX 16 (8086?). */
76#define IMAGE_FILE_MACHINE_IAPX16 UINT16_C(0x0144)
77/** Intel iAPX 16 (8086?) w/ transfer vector(s?) (TV). */
78#define IMAGE_FILE_MACHINE_IAPX16_TV UINT16_C(0x0145)
79/** Intel iAPX 20 (80286?). */
80#define IMAGE_FILE_MACHINE_IAPX20 UINT16_C(0x0144)
81/** Intel iAPX 20 (80286?) w/ transfer vector(s?) (TV). */
82#define IMAGE_FILE_MACHINE_IAPX20_TV UINT16_C(0x0145)
83/** X86 compatible CPU, 8086. */
84#define IMAGE_FILE_MACHINE_I8086 UINT16_C(0x0148)
85/** X86 compatible CPU, 8086 w/ transfer vector(s?) (TV). */
86#define IMAGE_FILE_MACHINE_I8086_TV UINT16_C(0x0149)
87/** X86 compatible CPU, 80286 small model program. */
88#define IMAGE_FILE_MACHINE_I286_SMALL UINT16_C(0x014a)
89/** Motorola 68000. */
90#define IMAGE_FILE_MACHINE_MC68 UINT16_C(0x0150)
91/** Motorola 68000 w/ writable text sections. */
92#define IMAGE_FILE_MACHINE_MC68_WR UINT16_C(0x0150)
93/** Motorola 68000 w/ transfer vector(s?). */
94#define IMAGE_FILE_MACHINE_MC68_TV UINT16_C(0x0151)
95/** Motorola 68000 w/ demand paged text.
96 * @note shared with 80286 large model program. */
97#define IMAGE_FILE_MACHINE_MC68_PG UINT16_C(0x0152)
98/** X86 compatible CPU, 80286 large model program.
99 * @note shared with MC68000 w/ demand paged text */
100#define IMAGE_FILE_MACHINE_I286_LARGE UINT16_C(0x0152)
101/** IBM 370 (writable text). */
102#define IMAGE_FILE_MACHINE_U370_WR UINT16_C(0x0158)
103/** Amdahl 470/580 (writable text). */
104#define IMAGE_FILE_MACHINE_AMDAHL_470_WR UINT16_C(0x0159)
105/** Amdahl 470/580 (read only text). */
106#define IMAGE_FILE_MACHINE_AMDAHL_470_RO UINT16_C(0x015c)
107/** IBM 370 (read only text). */
108#define IMAGE_FILE_MACHINE_U370_RO UINT16_C(0x015d)
109/** MIPS R4000 CPU, little endian. */
110#define IMAGE_FILE_MACHINE_R4000 UINT16_C(0x0166)
111/** MIPS CPU, little endian, Windows CE (?) v2 designation. */
112#define IMAGE_FILE_MACHINE_WCEMIPSV2 UINT16_C(0x0169)
113/** VAX-11/750 and VAX-11/780 (writable text). */
114#define IMAGE_FILE_MACHINE_VAX_WR UINT16_C(0x0178)
115/** VAX-11/750 and VAX-11/780 (read-only text). */
116#define IMAGE_FILE_MACHINE_VAX_RO UINT16_C(0x017d)
117/** Hitachi SH3 CPU. */
118#define IMAGE_FILE_MACHINE_SH3 UINT16_C(0x01a2)
119/** Hitachi SH3 DSP. */
120#define IMAGE_FILE_MACHINE_SH3DSP UINT16_C(0x01a3)
121/** Hitachi SH4 CPU. */
122#define IMAGE_FILE_MACHINE_SH4 UINT16_C(0x01a6)
123/** Hitachi SH5 CPU. */
124#define IMAGE_FILE_MACHINE_SH5 UINT16_C(0x01a8)
125/** Little endian ARM CPU. */
126#define IMAGE_FILE_MACHINE_ARM UINT16_C(0x01c0)
127/** ARM or Thumb stuff. */
128#define IMAGE_FILE_MACHINE_THUMB UINT16_C(0x01c2)
129/** ARMv7 or higher CPU, Thumb mode. */
130#define IMAGE_FILE_MACHINE_ARMNT UINT16_C(0x01c4)
131/** Matshushita AM33 CPU. */
132#define IMAGE_FILE_MACHINE_AM33 UINT16_C(0x01d3)
133/** Power PC CPU, little endian. */
134#define IMAGE_FILE_MACHINE_POWERPC UINT16_C(0x01f0)
135/** Power PC CPU with FPU, also little endian? */
136#define IMAGE_FILE_MACHINE_POWERPCFP UINT16_C(0x01f1)
137/** "Itanic" CPU. */
138#define IMAGE_FILE_MACHINE_IA64 UINT16_C(0x0200)
139/** MIPS CPU, compact 16-bit instructions only? */
140#define IMAGE_FILE_MACHINE_MIPS16 UINT16_C(0x0266)
141/** MIPS CPU with FPU, full 32-bit instructions only? */
142#define IMAGE_FILE_MACHINE_MIPSFPU UINT16_C(0x0366)
143/** MIPS CPU with FPU, compact 16-bit instructions? */
144#define IMAGE_FILE_MACHINE_MIPSFPU16 UINT16_C(0x0466)
145/** EFI byte code. */
146#define IMAGE_FILE_MACHINE_EBC UINT16_C(0x0ebc)
147/** Mitsubishi M32R CPU, little endian. */
148#define IMAGE_FILE_MACHINE_M32R UINT16_C(0x9041)
149/** ARMv8 CPU, 64-bit mode. */
150#define IMAGE_FILE_MACHINE_ARM64 UINT16_C(0xaa64)
151/** @} */
152
153/** @name File header characteristics (IMAGE_FILE_HEADER::Characteristics)
154 * @{ */
155#define IMAGE_FILE_RELOCS_STRIPPED UINT16_C(0x0001)
156#define IMAGE_FILE_EXECUTABLE_IMAGE UINT16_C(0x0002)
157#define IMAGE_FILE_LINE_NUMS_STRIPPED UINT16_C(0x0004)
158#define IMAGE_FILE_LOCAL_SYMS_STRIPPED UINT16_C(0x0008)
159#define IMAGE_FILE_AGGRESIVE_WS_TRIM UINT16_C(0x0010)
160#define IMAGE_FILE_LARGE_ADDRESS_AWARE UINT16_C(0x0020)
161#define IMAGE_FILE_16BIT_MACHINE UINT16_C(0x0040)
162#define IMAGE_FILE_BYTES_REVERSED_LO UINT16_C(0x0080)
163#define IMAGE_FILE_32BIT_MACHINE UINT16_C(0x0100)
164#define IMAGE_FILE_DEBUG_STRIPPED UINT16_C(0x0200)
165#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP UINT16_C(0x0400)
166#define IMAGE_FILE_NET_RUN_FROM_SWAP UINT16_C(0x0800)
167#define IMAGE_FILE_SYSTEM UINT16_C(0x1000) /**< (COFF/IAPX*: Used to indicate 80186 instructions) */
168#define IMAGE_FILE_DLL UINT16_C(0x2000) /**< (COFF/IAPX*: Used to indicate 80286 instructions) */
169#define IMAGE_FILE_UP_SYSTEM_ONLY UINT16_C(0x4000)
170#define IMAGE_FILE_BYTES_REVERSED_HI UINT16_C(0x8000)
171/** @} */
172
173
174/**
175 * PE data directory.
176 *
177 * This is used to locate data in the loaded image so the dynamic linker or
178 * others can make use of it. However, in the case of
179 * IMAGE_DIRECTORY_ENTRY_SECURITY it is referring to raw file offsets.
180 */
181typedef struct _IMAGE_DATA_DIRECTORY
182{
183 uint32_t VirtualAddress;
184 uint32_t Size;
185} IMAGE_DATA_DIRECTORY;
186AssertCompileSize(IMAGE_DATA_DIRECTORY, 0x8);
187typedef IMAGE_DATA_DIRECTORY *PIMAGE_DATA_DIRECTORY;
188typedef IMAGE_DATA_DIRECTORY const *PCIMAGE_DATA_DIRECTORY;
189
190/** The standard number of data directories in the optional header.
191 * I.e. the dimensions of IMAGE_OPTIONAL_HEADER32::DataDirectory and
192 * IMAGE_OPTIONAL_HEADER64::DataDirectory.
193 */
194#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 0x10
195
196
197/**
198 * PE optional header, 32-bit version.
199 */
200typedef struct _IMAGE_OPTIONAL_HEADER32
201{
202 uint16_t Magic; /**< 0x00 */
203 uint8_t MajorLinkerVersion; /**< 0x02 */
204 uint8_t MinorLinkerVersion; /**< 0x03 */
205 uint32_t SizeOfCode; /**< 0x04 */
206 uint32_t SizeOfInitializedData; /**< 0x08 */
207 uint32_t SizeOfUninitializedData; /**< 0x0c */
208 uint32_t AddressOfEntryPoint; /**< 0x10 */
209 uint32_t BaseOfCode; /**< 0x14 */
210 uint32_t BaseOfData; /**< 0x18 */
211 uint32_t ImageBase; /**< 0x1c */
212 uint32_t SectionAlignment; /**< 0x20 */
213 uint32_t FileAlignment; /**< 0x24 */
214 uint16_t MajorOperatingSystemVersion; /**< 0x28 */
215 uint16_t MinorOperatingSystemVersion; /**< 0x2a */
216 uint16_t MajorImageVersion; /**< 0x2c */
217 uint16_t MinorImageVersion; /**< 0x2e */
218 uint16_t MajorSubsystemVersion; /**< 0x30 */
219 uint16_t MinorSubsystemVersion; /**< 0x32 */
220 uint32_t Win32VersionValue; /**< 0x34 */
221 uint32_t SizeOfImage; /**< 0x38 */
222 uint32_t SizeOfHeaders; /**< 0x3c */
223 uint32_t CheckSum; /**< 0x40 */
224 uint16_t Subsystem; /**< 0x44 */
225 uint16_t DllCharacteristics; /**< 0x46 */
226 uint32_t SizeOfStackReserve; /**< 0x48 */
227 uint32_t SizeOfStackCommit; /**< 0x4c */
228 uint32_t SizeOfHeapReserve; /**< 0x50 */
229 uint32_t SizeOfHeapCommit; /**< 0x54 */
230 uint32_t LoaderFlags; /**< 0x58 */
231 uint32_t NumberOfRvaAndSizes; /**< 0x5c */
232 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /**< 0x60; 0x10*8 = 0x80 */
233} IMAGE_OPTIONAL_HEADER32; /* size: 0xe0 */
234AssertCompileSize(IMAGE_OPTIONAL_HEADER32, 0xe0);
235typedef IMAGE_OPTIONAL_HEADER32 *PIMAGE_OPTIONAL_HEADER32;
236typedef IMAGE_OPTIONAL_HEADER32 const *PCIMAGE_OPTIONAL_HEADER32;
237
238/**
239 * PE optional header, 64-bit version.
240 */
241typedef struct _IMAGE_OPTIONAL_HEADER64
242{
243 uint16_t Magic; /**< 0x00 */
244 uint8_t MajorLinkerVersion; /**< 0x02 */
245 uint8_t MinorLinkerVersion; /**< 0x03 */
246 uint32_t SizeOfCode; /**< 0x04 */
247 uint32_t SizeOfInitializedData; /**< 0x08 */
248 uint32_t SizeOfUninitializedData; /**< 0x0c */
249 uint32_t AddressOfEntryPoint; /**< 0x10 */
250 uint32_t BaseOfCode; /**< 0x14 */
251 uint64_t ImageBase; /**< 0x18 */
252 uint32_t SectionAlignment; /**< 0x20 */
253 uint32_t FileAlignment; /**< 0x24 */
254 uint16_t MajorOperatingSystemVersion; /**< 0x28 */
255 uint16_t MinorOperatingSystemVersion; /**< 0x2a */
256 uint16_t MajorImageVersion; /**< 0x2c */
257 uint16_t MinorImageVersion; /**< 0x2e */
258 uint16_t MajorSubsystemVersion; /**< 0x30 */
259 uint16_t MinorSubsystemVersion; /**< 0x32 */
260 uint32_t Win32VersionValue; /**< 0x34 */
261 uint32_t SizeOfImage; /**< 0x38 */
262 uint32_t SizeOfHeaders; /**< 0x3c */
263 uint32_t CheckSum; /**< 0x40 */
264 uint16_t Subsystem; /**< 0x44 */
265 uint16_t DllCharacteristics; /**< 0x46 */
266 uint64_t SizeOfStackReserve; /**< 0x48 */
267 uint64_t SizeOfStackCommit; /**< 0x50 */
268 uint64_t SizeOfHeapReserve; /**< 0x58 */
269 uint64_t SizeOfHeapCommit; /**< 0x60 */
270 uint32_t LoaderFlags; /**< 0x68 */
271 uint32_t NumberOfRvaAndSizes; /**< 0x6c */
272 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /**< 0x70; 0x10*8 = 0x80 */
273} IMAGE_OPTIONAL_HEADER64; /* size: 0xf0 */
274AssertCompileSize(IMAGE_OPTIONAL_HEADER64, 0xf0);
275typedef IMAGE_OPTIONAL_HEADER64 *PIMAGE_OPTIONAL_HEADER64;
276typedef IMAGE_OPTIONAL_HEADER64 const *PCIMAGE_OPTIONAL_HEADER64;
277
278/** @name Optional header magic values.
279 * @{ */
280#define IMAGE_NT_OPTIONAL_HDR32_MAGIC UINT16_C(0x010b)
281#define IMAGE_NT_OPTIONAL_HDR64_MAGIC UINT16_C(0x020b)
282/** @} */
283
284/** @name IMAGE_SUBSYSTEM_XXX - Optional header subsystems.
285 * IMAGE_OPTIONAL_HEADER32::Subsystem, IMAGE_OPTIONAL_HEADER64::Subsystem
286 * @{ */
287#define IMAGE_SUBSYSTEM_UNKNOWN UINT16_C(0x0000)
288#define IMAGE_SUBSYSTEM_NATIVE UINT16_C(0x0001)
289#define IMAGE_SUBSYSTEM_WINDOWS_GUI UINT16_C(0x0002)
290#define IMAGE_SUBSYSTEM_WINDOWS_CUI UINT16_C(0x0003)
291#define IMAGE_SUBSYSTEM_OS2_GUI UINT16_C(0x0004)
292#define IMAGE_SUBSYSTEM_OS2_CUI UINT16_C(0x0005)
293#define IMAGE_SUBSYSTEM_POSIX_CUI UINT16_C(0x0007)
294/** @} */
295
296/** @name Optional header characteristics.
297 * @{ */
298#define IMAGE_LIBRARY_PROCESS_INIT UINT16_C(0x0001)
299#define IMAGE_LIBRARY_PROCESS_TERM UINT16_C(0x0002)
300#define IMAGE_LIBRARY_THREAD_INIT UINT16_C(0x0004)
301#define IMAGE_LIBRARY_THREAD_TERM UINT16_C(0x0008)
302#define IMAGE_DLLCHARACTERISTICS_RESERVED UINT16_C(0x0010)
303#define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA UINT16_C(0x0020)
304#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE UINT16_C(0x0040)
305#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY UINT16_C(0x0080)
306#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT UINT16_C(0x0100)
307#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION UINT16_C(0x0200)
308#define IMAGE_DLLCHARACTERISTICS_NO_SEH UINT16_C(0x0400)
309#define IMAGE_DLLCHARACTERISTICS_NO_BIND UINT16_C(0x0800)
310#define IMAGE_DLLCHARACTERISTICS_APPCONTAINER UINT16_C(0x1000)
311#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER UINT16_C(0x2000)
312#define IMAGE_DLLCHARACTERISTICS_GUARD_CF UINT16_C(0x4000)
313#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE UINT16_C(0x8000)
314/** @} */
315
316
317/** @name IMAGE_DIRECTORY_ENTRY_XXX - Data directory indexes.
318 * Used to index IMAGE_OPTIONAL_HEADER32::DataDirectory and
319 * IMAGE_OPTIONAL_HEADER64::DataDirectory
320 * @{ */
321#define IMAGE_DIRECTORY_ENTRY_EXPORT 0x0
322#define IMAGE_DIRECTORY_ENTRY_IMPORT 0x1
323#define IMAGE_DIRECTORY_ENTRY_RESOURCE 0x2
324#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 0x3
325#define IMAGE_DIRECTORY_ENTRY_SECURITY 0x4
326#define IMAGE_DIRECTORY_ENTRY_BASERELOC 0x5
327#define IMAGE_DIRECTORY_ENTRY_DEBUG 0x6
328#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 0x7
329#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT IMAGE_DIRECTORY_ENTRY_ARCHITECTURE
330#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 0x8
331#define IMAGE_DIRECTORY_ENTRY_TLS 0x9
332#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 0xa
333#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 0xb
334#define IMAGE_DIRECTORY_ENTRY_IAT 0xc
335#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 0xd
336#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 0xe
337/** @} */
338
339
340/**
341 * PE (NT) headers, 32-bit version.
342 */
343typedef struct _IMAGE_NT_HEADERS32
344{
345 uint32_t Signature; /**< 0x00 */
346 IMAGE_FILE_HEADER FileHeader; /**< 0x04 */
347 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /**< 0x18 */
348} IMAGE_NT_HEADERS32; /* size: 0xf8 */
349AssertCompileSize(IMAGE_NT_HEADERS32, 0xf8);
350AssertCompileMemberOffset(IMAGE_NT_HEADERS32, FileHeader, 4);
351AssertCompileMemberOffset(IMAGE_NT_HEADERS32, OptionalHeader, 24);
352typedef IMAGE_NT_HEADERS32 *PIMAGE_NT_HEADERS32;
353typedef IMAGE_NT_HEADERS32 const *PCIMAGE_NT_HEADERS32;
354
355/**
356 * PE (NT) headers, 64-bit version.
357 */
358typedef struct _IMAGE_NT_HEADERS64
359{
360 uint32_t Signature; /**< 0x00 */
361 IMAGE_FILE_HEADER FileHeader; /**< 0x04 */
362 IMAGE_OPTIONAL_HEADER64 OptionalHeader; /**< 0x18 */
363} IMAGE_NT_HEADERS64; /**< 0x108 */
364AssertCompileSize(IMAGE_NT_HEADERS64, 0x108);
365AssertCompileMemberOffset(IMAGE_NT_HEADERS64, FileHeader, 4);
366AssertCompileMemberOffset(IMAGE_NT_HEADERS64, OptionalHeader, 24);
367typedef IMAGE_NT_HEADERS64 *PIMAGE_NT_HEADERS64;
368typedef IMAGE_NT_HEADERS64 const *PCIMAGE_NT_HEADERS64;
369
370/** The PE signature.
371 * Used by IMAGE_NT_HEADERS32::Signature, IMAGE_NT_HEADERS64::Signature. */
372#define IMAGE_NT_SIGNATURE UINT32_C(0x00004550)
373
374
375/** Section header short name length (IMAGE_SECTION_HEADER::Name). */
376#define IMAGE_SIZEOF_SHORT_NAME 0x8
377
378/**
379 * PE & COFF section header.
380 */
381typedef struct _IMAGE_SECTION_HEADER
382{
383 uint8_t Name[IMAGE_SIZEOF_SHORT_NAME];
384 union
385 {
386 uint32_t PhysicalAddress;
387 uint32_t VirtualSize;
388 } Misc;
389 uint32_t VirtualAddress;
390 uint32_t SizeOfRawData;
391 uint32_t PointerToRawData;
392 uint32_t PointerToRelocations;
393 uint32_t PointerToLinenumbers;
394 uint16_t NumberOfRelocations;
395 uint16_t NumberOfLinenumbers;
396 uint32_t Characteristics;
397} IMAGE_SECTION_HEADER;
398AssertCompileSize(IMAGE_SECTION_HEADER, 40);
399typedef IMAGE_SECTION_HEADER *PIMAGE_SECTION_HEADER;
400typedef IMAGE_SECTION_HEADER const *PCIMAGE_SECTION_HEADER;
401
402/** @name IMAGE_SCN_XXX - Section header characteristics.
403 * Used by IMAGE_SECTION_HEADER::Characteristics.
404 * @{ */
405#define IMAGE_SCN_TYPE_REG UINT32_C(0x00000000)
406#define IMAGE_SCN_TYPE_DSECT UINT32_C(0x00000001)
407#define IMAGE_SCN_TYPE_NOLOAD UINT32_C(0x00000002)
408#define IMAGE_SCN_TYPE_GROUP UINT32_C(0x00000004)
409#define IMAGE_SCN_TYPE_NO_PAD UINT32_C(0x00000008)
410#define IMAGE_SCN_TYPE_COPY UINT32_C(0x00000010)
411
412#define IMAGE_SCN_CNT_CODE UINT32_C(0x00000020)
413#define IMAGE_SCN_CNT_INITIALIZED_DATA UINT32_C(0x00000040)
414#define IMAGE_SCN_CNT_UNINITIALIZED_DATA UINT32_C(0x00000080)
415
416#define IMAGE_SCN_LNK_OTHER UINT32_C(0x00000100)
417#define IMAGE_SCN_LNK_INFO UINT32_C(0x00000200)
418#define IMAGE_SCN_TYPE_OVER UINT32_C(0x00000400)
419#define IMAGE_SCN_LNK_REMOVE UINT32_C(0x00000800)
420#define IMAGE_SCN_LNK_COMDAT UINT32_C(0x00001000)
421#define IMAGE_SCN_MEM_PROTECTED UINT32_C(0x00004000)
422#define IMAGE_SCN_NO_DEFER_SPEC_EXC UINT32_C(0x00004000)
423#define IMAGE_SCN_GPREL UINT32_C(0x00008000)
424#define IMAGE_SCN_MEM_FARDATA UINT32_C(0x00008000)
425#define IMAGE_SCN_MEM_SYSHEAP UINT32_C(0x00010000)
426#define IMAGE_SCN_MEM_PURGEABLE UINT32_C(0x00020000)
427#define IMAGE_SCN_MEM_16BIT UINT32_C(0x00020000)
428#define IMAGE_SCN_MEM_LOCKED UINT32_C(0x00040000)
429#define IMAGE_SCN_MEM_PRELOAD UINT32_C(0x00080000)
430
431#define IMAGE_SCN_ALIGN_1BYTES UINT32_C(0x00100000)
432#define IMAGE_SCN_ALIGN_2BYTES UINT32_C(0x00200000)
433#define IMAGE_SCN_ALIGN_4BYTES UINT32_C(0x00300000)
434#define IMAGE_SCN_ALIGN_8BYTES UINT32_C(0x00400000)
435#define IMAGE_SCN_ALIGN_16BYTES UINT32_C(0x00500000)
436#define IMAGE_SCN_ALIGN_32BYTES UINT32_C(0x00600000)
437#define IMAGE_SCN_ALIGN_64BYTES UINT32_C(0x00700000)
438#define IMAGE_SCN_ALIGN_128BYTES UINT32_C(0x00800000)
439#define IMAGE_SCN_ALIGN_256BYTES UINT32_C(0x00900000)
440#define IMAGE_SCN_ALIGN_512BYTES UINT32_C(0x00A00000)
441#define IMAGE_SCN_ALIGN_1024BYTES UINT32_C(0x00B00000)
442#define IMAGE_SCN_ALIGN_2048BYTES UINT32_C(0x00C00000)
443#define IMAGE_SCN_ALIGN_4096BYTES UINT32_C(0x00D00000)
444#define IMAGE_SCN_ALIGN_8192BYTES UINT32_C(0x00E00000)
445#define IMAGE_SCN_ALIGN_MASK UINT32_C(0x00F00000)
446#define IMAGE_SCN_ALIGN_SHIFT 20
447
448#define IMAGE_SCN_LNK_NRELOC_OVFL UINT32_C(0x01000000)
449#define IMAGE_SCN_MEM_DISCARDABLE UINT32_C(0x02000000)
450#define IMAGE_SCN_MEM_NOT_CACHED UINT32_C(0x04000000)
451#define IMAGE_SCN_MEM_NOT_PAGED UINT32_C(0x08000000)
452#define IMAGE_SCN_MEM_SHARED UINT32_C(0x10000000)
453#define IMAGE_SCN_MEM_EXECUTE UINT32_C(0x20000000)
454#define IMAGE_SCN_MEM_READ UINT32_C(0x40000000)
455#define IMAGE_SCN_MEM_WRITE UINT32_C(0x80000000)
456/** @} */
457
458
459/**
460 * PE image base relocations block header.
461 *
462 * This found in IMAGE_DIRECTORY_ENTRY_BASERELOC. Each entry is follow
463 * immediately by an array of 16-bit words, where the lower 12-bits are used
464 * for the page offset and the upper 4-bits for the base relocation type
465 * (IMAGE_REL_BASE_XXX). The block should be padded with
466 * IMAGE_REL_BASED_ABSOLUTE entries to ensure 32-bit alignment of this header.
467 */
468typedef struct _IMAGE_BASE_RELOCATION
469{
470 /** The RVA of the page/block the following ase relocations applies to. */
471 uint32_t VirtualAddress;
472 /** The size of this relocation block, including this header. */
473 uint32_t SizeOfBlock;
474} IMAGE_BASE_RELOCATION;
475AssertCompileSize(IMAGE_BASE_RELOCATION, 8);
476typedef IMAGE_BASE_RELOCATION *PIMAGE_BASE_RELOCATION;
477typedef IMAGE_BASE_RELOCATION const *PCIMAGE_BASE_RELOCATION;
478
479/** @name IMAGE_REL_BASED_XXX - PE base relocations.
480 * Found in the IMAGE_DIRECTORY_ENTRY_BASERELOC data directory.
481 * @{ */
482#define IMAGE_REL_BASED_ABSOLUTE UINT16_C(0x0)
483#define IMAGE_REL_BASED_HIGH UINT16_C(0x1)
484#define IMAGE_REL_BASED_LOW UINT16_C(0x2)
485#define IMAGE_REL_BASED_HIGHLOW UINT16_C(0x3)
486#define IMAGE_REL_BASED_HIGHADJ UINT16_C(0x4)
487#define IMAGE_REL_BASED_MIPS_JMPADDR UINT16_C(0x5)
488#define IMAGE_REL_BASED_MIPS_JMPADDR16 UINT16_C(0x9)
489#define IMAGE_REL_BASED_IA64_IMM64 UINT16_C(0x9)
490#define IMAGE_REL_BASED_DIR64 UINT16_C(0xa)
491#define IMAGE_REL_BASED_HIGH3ADJ UINT16_C(0xb)
492/** @} */
493
494/**
495 * PE export directory entry.
496 */
497typedef struct _IMAGE_EXPORT_DIRECTORY
498{
499 uint32_t Characteristics;
500 uint32_t TimeDateStamp;
501 uint16_t MajorVersion;
502 uint16_t MinorVersion;
503 uint32_t Name;
504 uint32_t Base;
505 uint32_t NumberOfFunctions;
506 uint32_t NumberOfNames;
507 uint32_t AddressOfFunctions;
508 uint32_t AddressOfNames;
509 uint32_t AddressOfNameOrdinals;
510} IMAGE_EXPORT_DIRECTORY;
511AssertCompileSize(IMAGE_EXPORT_DIRECTORY, 40);
512typedef IMAGE_EXPORT_DIRECTORY *PIMAGE_EXPORT_DIRECTORY;
513typedef IMAGE_EXPORT_DIRECTORY const *PCIMAGE_EXPORT_DIRECTORY;
514
515
516/**
517 * PE import directory entry.
518 */
519typedef struct _IMAGE_IMPORT_DESCRIPTOR
520{
521 union
522 {
523 uint32_t Characteristics;
524 uint32_t OriginalFirstThunk;
525 } u;
526 uint32_t TimeDateStamp;
527 uint32_t ForwarderChain;
528 uint32_t Name;
529 uint32_t FirstThunk;
530} IMAGE_IMPORT_DESCRIPTOR;
531AssertCompileSize(IMAGE_IMPORT_DESCRIPTOR, 20);
532typedef IMAGE_IMPORT_DESCRIPTOR *PIMAGE_IMPORT_DESCRIPTOR;
533typedef IMAGE_IMPORT_DESCRIPTOR const *PCIMAGE_IMPORT_DESCRIPTOR;
534
535/**
536 * Something we currently don't make use of...
537 */
538typedef struct _IMAGE_IMPORT_BY_NAME
539{
540 uint16_t Hint;
541 uint8_t Name[1];
542} IMAGE_IMPORT_BY_NAME;
543AssertCompileSize(IMAGE_IMPORT_BY_NAME, 4);
544typedef IMAGE_IMPORT_BY_NAME *PIMAGE_IMPORT_BY_NAME;
545typedef IMAGE_IMPORT_BY_NAME const *PCIMAGE_IMPORT_BY_NAME;
546
547
548#if 0
549/* The image_thunk_data32/64 structures are not very helpful except for getting RSI.
550 keep them around till all the code has been converted. */
551typedef struct _IMAGE_THUNK_DATA64
552{
553 union
554 {
555 uint64_t ForwarderString;
556 uint64_t Function;
557 uint64_t Ordinal;
558 uint64_t AddressOfData;
559 } u1;
560} IMAGE_THUNK_DATA64;
561typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64;
562typedef IMAGE_THUNK_DATA64 const *PCIMAGE_THUNK_DATA64;
563
564typedef struct _IMAGE_THUNK_DATA32
565{
566 union
567 {
568 uint32_t ForwarderString;
569 uint32_t Function;
570 uint32_t Ordinal;
571 uint32_t AddressOfData;
572 } u1;
573} IMAGE_THUNK_DATA32;
574typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32;
575typedef IMAGE_THUNK_DATA32 const *PCIMAGE_THUNK_DATA32;
576#endif
577
578/** @name PE import directory macros.
579 * @{ */
580#define IMAGE_ORDINAL_FLAG32 UINT32_C(0x80000000)
581#define IMAGE_ORDINAL32(ord) ((ord) & UINT32_C(0xffff))
582#define IMAGE_SNAP_BY_ORDINAL32(ord) (!!((ord) & IMAGE_ORDINAL_FLAG32))
583
584#define IMAGE_ORDINAL_FLAG64 UINT64_C(0x8000000000000000)
585#define IMAGE_ORDINAL64(ord) ((ord) & UINT32_C(0xffff))
586#define IMAGE_SNAP_BY_ORDINAL64(ord) (!!((ord) & IMAGE_ORDINAL_FLAG64))
587/** @} */
588
589/** @name PE Resource directory
590 * @{ */
591typedef struct _IMAGE_RESOURCE_DIRECTORY
592{
593 uint32_t Characteristics;
594 uint32_t TimeDateStamp;
595 uint16_t MajorVersion;
596 uint16_t MinorVersion;
597 uint16_t NumberOfNamedEntries;
598 uint16_t NumberOfIdEntries;
599} IMAGE_RESOURCE_DIRECTORY;
600typedef IMAGE_RESOURCE_DIRECTORY *PIMAGE_RESOURCE_DIRECTORY;
601typedef IMAGE_RESOURCE_DIRECTORY const *PCIMAGE_RESOURCE_DIRECTORY;
602
603typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
604{
605 union
606 {
607 struct
608 {
609 uint32_t NameOffset : 31;
610 uint32_t NameIsString : 1; /**< IMAGE_RESOURCE_NAME_IS_STRING */
611 } s;
612 uint32_t Name;
613 uint16_t Id;
614 } u;
615 union
616 {
617 struct
618 {
619 uint32_t OffsetToDirectory : 31;
620 uint32_t DataIsDirectory : 1; /**< IMAGE_RESOURCE_DATA_IS_DIRECTORY*/
621 } s2;
622 uint32_t OffsetToData;
623 } u2;
624} IMAGE_RESOURCE_DIRECTORY_ENTRY;
625typedef IMAGE_RESOURCE_DIRECTORY_ENTRY *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
626typedef IMAGE_RESOURCE_DIRECTORY_ENTRY const *PCIMAGE_RESOURCE_DIRECTORY_ENTRY;
627
628#define IMAGE_RESOURCE_NAME_IS_STRING UINT32_C(0x80000000)
629#define IMAGE_RESOURCE_DATA_IS_DIRECTORY UINT32_C(0x80000000)
630
631typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
632{
633 uint16_t Length;
634 char NameString[1];
635} IMAGE_RESOURCE_DIRECTORY_STRING;
636typedef IMAGE_RESOURCE_DIRECTORY_STRING *PIMAGE_RESOURCE_DIRECTORY_STRING;
637typedef IMAGE_RESOURCE_DIRECTORY_STRING const *PCIMAGE_RESOURCE_DIRECTORY_STRING;
638
639
640typedef struct _IMAGE_RESOURCE_DIR_STRING_U
641{
642 uint16_t Length;
643 RTUTF16 NameString[1];
644} IMAGE_RESOURCE_DIR_STRING_U;
645typedef IMAGE_RESOURCE_DIR_STRING_U *PIMAGE_RESOURCE_DIR_STRING_U;
646typedef IMAGE_RESOURCE_DIR_STRING_U const *PCIMAGE_RESOURCE_DIR_STRING_U;
647
648
649typedef struct _IMAGE_RESOURCE_DATA_ENTRY
650{
651 uint32_t OffsetToData;
652 uint32_t Size;
653 uint32_t CodePage;
654 uint32_t Reserved;
655} IMAGE_RESOURCE_DATA_ENTRY;
656typedef IMAGE_RESOURCE_DATA_ENTRY *PIMAGE_RESOURCE_DATA_ENTRY;
657typedef IMAGE_RESOURCE_DATA_ENTRY const *PCIMAGE_RESOURCE_DATA_ENTRY;
658
659/** @} */
660
661/** @name Image exception information
662 * @{ */
663
664/** This structure is used by AMD64 and "Itanic".
665 * MIPS uses a different one. ARM, SH3, SH4 and PPC on WinCE also uses a different one. */
666typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY
667{
668 uint32_t BeginAddress;
669 uint32_t EndAddress;
670 uint32_t UnwindInfoAddress;
671} IMAGE_RUNTIME_FUNCTION_ENTRY;
672typedef IMAGE_RUNTIME_FUNCTION_ENTRY *PIMAGE_RUNTIME_FUNCTION_ENTRY;
673typedef IMAGE_RUNTIME_FUNCTION_ENTRY const *PCIMAGE_RUNTIME_FUNCTION_ENTRY;
674
675/** @} */
676
677
678
679/** @name Image load config directories
680 * @{ */
681
682/** @since Windows 10 (preview 9879) */
683typedef struct _IMAGE_LOAD_CONFIG_CODE_INTEGRITY
684{
685 uint16_t Flags;
686 uint16_t Catalog;
687 uint32_t CatalogOffset;
688 uint32_t Reserved;
689} IMAGE_LOAD_CONFIG_CODE_INTEGRITY;
690AssertCompileSize(IMAGE_LOAD_CONFIG_CODE_INTEGRITY, 12);
691typedef IMAGE_LOAD_CONFIG_CODE_INTEGRITY *PIMAGE_LOAD_CONFIG_CODE_INTEGRITY;
692typedef IMAGE_LOAD_CONFIG_CODE_INTEGRITY const *PCIMAGE_LOAD_CONFIG_CODE_INTEGRITY;
693
694typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V1
695{
696 uint32_t Size;
697 uint32_t TimeDateStamp;
698 uint16_t MajorVersion;
699 uint16_t MinorVersion;
700 uint32_t GlobalFlagsClear;
701 uint32_t GlobalFlagsSet;
702 uint32_t CriticalSectionDefaultTimeout;
703 uint32_t DeCommitFreeBlockThreshold;
704 uint32_t DeCommitTotalFreeThreshold;
705 uint32_t LockPrefixTable;
706 uint32_t MaximumAllocationSize;
707 uint32_t VirtualMemoryThreshold;
708 uint32_t ProcessHeapFlags;
709 uint32_t ProcessAffinityMask;
710 uint16_t CSDVersion;
711 uint16_t DependentLoadFlags;
712 uint32_t EditList;
713 uint32_t SecurityCookie;
714} IMAGE_LOAD_CONFIG_DIRECTORY32_V1;
715AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V1, 0x40);
716typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V1 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V1;
717typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V1 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V1;
718
719typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V2
720{
721 uint32_t Size;
722 uint32_t TimeDateStamp;
723 uint16_t MajorVersion;
724 uint16_t MinorVersion;
725 uint32_t GlobalFlagsClear;
726 uint32_t GlobalFlagsSet;
727 uint32_t CriticalSectionDefaultTimeout;
728 uint32_t DeCommitFreeBlockThreshold;
729 uint32_t DeCommitTotalFreeThreshold;
730 uint32_t LockPrefixTable;
731 uint32_t MaximumAllocationSize;
732 uint32_t VirtualMemoryThreshold;
733 uint32_t ProcessHeapFlags;
734 uint32_t ProcessAffinityMask;
735 uint16_t CSDVersion;
736 uint16_t DependentLoadFlags;
737 uint32_t EditList;
738 uint32_t SecurityCookie;
739 uint32_t SEHandlerTable;
740 uint32_t SEHandlerCount;
741} IMAGE_LOAD_CONFIG_DIRECTORY32_V2;
742AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V2, 0x48);
743typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V2 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V2;
744typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V2 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V2;
745
746typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V3
747{
748 uint32_t Size;
749 uint32_t TimeDateStamp;
750 uint16_t MajorVersion;
751 uint16_t MinorVersion;
752 uint32_t GlobalFlagsClear;
753 uint32_t GlobalFlagsSet;
754 uint32_t CriticalSectionDefaultTimeout;
755 uint32_t DeCommitFreeBlockThreshold;
756 uint32_t DeCommitTotalFreeThreshold;
757 uint32_t LockPrefixTable;
758 uint32_t MaximumAllocationSize;
759 uint32_t VirtualMemoryThreshold;
760 uint32_t ProcessHeapFlags;
761 uint32_t ProcessAffinityMask;
762 uint16_t CSDVersion;
763 uint16_t DependentLoadFlags;
764 uint32_t EditList;
765 uint32_t SecurityCookie;
766 uint32_t SEHandlerTable;
767 uint32_t SEHandlerCount;
768 uint32_t GuardCFCCheckFunctionPointer;
769 uint32_t GuardCFDispatchFunctionPointer;
770 uint32_t GuardCFFunctionTable;
771 uint32_t GuardCFFunctionCount;
772 uint32_t GuardFlags;
773} IMAGE_LOAD_CONFIG_DIRECTORY32_V3;
774AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V3, 0x5c);
775typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V3 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V3;
776typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V3 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V3;
777
778/** @since Windows 10 (preview 9879) */
779typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V4
780{
781 uint32_t Size;
782 uint32_t TimeDateStamp;
783 uint16_t MajorVersion;
784 uint16_t MinorVersion;
785 uint32_t GlobalFlagsClear;
786 uint32_t GlobalFlagsSet;
787 uint32_t CriticalSectionDefaultTimeout;
788 uint32_t DeCommitFreeBlockThreshold;
789 uint32_t DeCommitTotalFreeThreshold;
790 uint32_t LockPrefixTable;
791 uint32_t MaximumAllocationSize;
792 uint32_t VirtualMemoryThreshold;
793 uint32_t ProcessHeapFlags;
794 uint32_t ProcessAffinityMask;
795 uint16_t CSDVersion;
796 uint16_t DependentLoadFlags;
797 uint32_t EditList;
798 uint32_t SecurityCookie;
799 uint32_t SEHandlerTable;
800 uint32_t SEHandlerCount;
801 uint32_t GuardCFCCheckFunctionPointer;
802 uint32_t GuardCFDispatchFunctionPointer;
803 uint32_t GuardCFFunctionTable;
804 uint32_t GuardCFFunctionCount;
805 uint32_t GuardFlags;
806 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity;
807} IMAGE_LOAD_CONFIG_DIRECTORY32_V4;
808AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V4, 0x68);
809typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V4 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V4;
810typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V4 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V4;
811
812/** @since Windows 10 build 14286 (or maybe earlier). */
813typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V5
814{
815 uint32_t Size;
816 uint32_t TimeDateStamp;
817 uint16_t MajorVersion;
818 uint16_t MinorVersion;
819 uint32_t GlobalFlagsClear;
820 uint32_t GlobalFlagsSet;
821 uint32_t CriticalSectionDefaultTimeout;
822 uint32_t DeCommitFreeBlockThreshold;
823 uint32_t DeCommitTotalFreeThreshold;
824 uint32_t LockPrefixTable;
825 uint32_t MaximumAllocationSize;
826 uint32_t VirtualMemoryThreshold;
827 uint32_t ProcessHeapFlags;
828 uint32_t ProcessAffinityMask;
829 uint16_t CSDVersion;
830 uint16_t DependentLoadFlags;
831 uint32_t EditList;
832 uint32_t SecurityCookie;
833 uint32_t SEHandlerTable;
834 uint32_t SEHandlerCount;
835 uint32_t GuardCFCCheckFunctionPointer;
836 uint32_t GuardCFDispatchFunctionPointer;
837 uint32_t GuardCFFunctionTable;
838 uint32_t GuardCFFunctionCount;
839 uint32_t GuardFlags;
840 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity;
841 uint32_t GuardAddressTakenIatEntryTable;
842 uint32_t GuardAddressTakenIatEntryCount;
843 uint32_t GuardLongJumpTargetTable;
844 uint32_t GuardLongJumpTargetCount;
845} IMAGE_LOAD_CONFIG_DIRECTORY32_V5;
846AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V5, 0x78);
847typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V5 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V5;
848typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V5 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V5;
849
850/** @since Windows 10 build 14383 (or maybe earlier). */
851typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V6
852{
853 uint32_t Size; /**< 0x00 */
854 uint32_t TimeDateStamp; /**< 0x04 */
855 uint16_t MajorVersion; /**< 0x08 */
856 uint16_t MinorVersion; /**< 0x0a */
857 uint32_t GlobalFlagsClear; /**< 0x0c */
858 uint32_t GlobalFlagsSet; /**< 0x10 */
859 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
860 uint32_t DeCommitFreeBlockThreshold; /**< 0x18 */
861 uint32_t DeCommitTotalFreeThreshold; /**< 0x1c */
862 uint32_t LockPrefixTable; /**< 0x20 */
863 uint32_t MaximumAllocationSize; /**< 0x24 */
864 uint32_t VirtualMemoryThreshold; /**< 0x28 */
865 uint32_t ProcessHeapFlags; /**< 0x2c */
866 uint32_t ProcessAffinityMask; /**< 0x30 */
867 uint16_t CSDVersion; /**< 0x34 */
868 uint16_t DependentLoadFlags; /**< 0x36 */
869 uint32_t EditList; /**< 0x38 */
870 uint32_t SecurityCookie; /**< 0x3c */
871 uint32_t SEHandlerTable; /**< 0x40 */
872 uint32_t SEHandlerCount; /**< 0x44 */
873 uint32_t GuardCFCCheckFunctionPointer; /**< 0x48 */
874 uint32_t GuardCFDispatchFunctionPointer; /**< 0x4c */
875 uint32_t GuardCFFunctionTable; /**< 0x50 */
876 uint32_t GuardCFFunctionCount; /**< 0x54 */
877 uint32_t GuardFlags; /**< 0x58 */
878 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x5c */
879 uint32_t GuardAddressTakenIatEntryTable; /**< 0x68 */
880 uint32_t GuardAddressTakenIatEntryCount; /**< 0x6c */
881 uint32_t GuardLongJumpTargetTable; /**< 0x70 */
882 uint32_t GuardLongJumpTargetCount; /**< 0x74 */
883 uint32_t DynamicValueRelocTable; /**< 0x78 */
884 uint32_t HybridMetadataPointer; /**< 0x7c */
885} IMAGE_LOAD_CONFIG_DIRECTORY32_V6;
886AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V6, 0x80);
887typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V6 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V6;
888typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V6 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V6;
889
890/** @since Windows 10 build 14901 (or maybe earlier). */
891typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V7
892{
893 uint32_t Size; /**< 0x00 */
894 uint32_t TimeDateStamp; /**< 0x04 */
895 uint16_t MajorVersion; /**< 0x08 */
896 uint16_t MinorVersion; /**< 0x0a */
897 uint32_t GlobalFlagsClear; /**< 0x0c */
898 uint32_t GlobalFlagsSet; /**< 0x10 */
899 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
900 uint32_t DeCommitFreeBlockThreshold; /**< 0x18 */
901 uint32_t DeCommitTotalFreeThreshold; /**< 0x1c */
902 uint32_t LockPrefixTable; /**< 0x20 */
903 uint32_t MaximumAllocationSize; /**< 0x24 */
904 uint32_t VirtualMemoryThreshold; /**< 0x28 */
905 uint32_t ProcessHeapFlags; /**< 0x2c */
906 uint32_t ProcessAffinityMask; /**< 0x30 */
907 uint16_t CSDVersion; /**< 0x34 */
908 uint16_t DependentLoadFlags; /**< 0x36 */
909 uint32_t EditList; /**< 0x38 */
910 uint32_t SecurityCookie; /**< 0x3c */
911 uint32_t SEHandlerTable; /**< 0x40 */
912 uint32_t SEHandlerCount; /**< 0x44 */
913 uint32_t GuardCFCCheckFunctionPointer; /**< 0x48 */
914 uint32_t GuardCFDispatchFunctionPointer; /**< 0x4c */
915 uint32_t GuardCFFunctionTable; /**< 0x50 */
916 uint32_t GuardCFFunctionCount; /**< 0x54 */
917 uint32_t GuardFlags; /**< 0x58 */
918 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x5c */
919 uint32_t GuardAddressTakenIatEntryTable; /**< 0x68 */
920 uint32_t GuardAddressTakenIatEntryCount; /**< 0x6c */
921 uint32_t GuardLongJumpTargetTable; /**< 0x70 */
922 uint32_t GuardLongJumpTargetCount; /**< 0x74 */
923 uint32_t DynamicValueRelocTable; /**< 0x78 */
924 uint32_t CHPEMetadataPointer; /**< 0x7c Not sure when this was renamed from HybridMetadataPointer. */
925 uint32_t GuardRFFailureRoutine; /**< 0x80 */
926 uint32_t GuardRFFailureRoutineFunctionPointer; /**< 0x84 */
927 uint32_t DynamicValueRelocTableOffset; /**< 0x88 */
928 uint16_t DynamicValueRelocTableSection; /**< 0x8c */
929 uint16_t Reserved2; /**< 0x8e */
930} IMAGE_LOAD_CONFIG_DIRECTORY32_V7;
931AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V7, 0x90);
932typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V7 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V7;
933typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V7 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V7;
934
935/** @since Windows 10 build 15002 (or maybe earlier). */
936typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V8
937{
938 uint32_t Size; /**< 0x00 */
939 uint32_t TimeDateStamp; /**< 0x04 */
940 uint16_t MajorVersion; /**< 0x08 */
941 uint16_t MinorVersion; /**< 0x0a */
942 uint32_t GlobalFlagsClear; /**< 0x0c */
943 uint32_t GlobalFlagsSet; /**< 0x10 */
944 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
945 uint32_t DeCommitFreeBlockThreshold; /**< 0x18 */
946 uint32_t DeCommitTotalFreeThreshold; /**< 0x1c */
947 uint32_t LockPrefixTable; /**< 0x20 */
948 uint32_t MaximumAllocationSize; /**< 0x24 */
949 uint32_t VirtualMemoryThreshold; /**< 0x28 */
950 uint32_t ProcessHeapFlags; /**< 0x2c */
951 uint32_t ProcessAffinityMask; /**< 0x30 */
952 uint16_t CSDVersion; /**< 0x34 */
953 uint16_t DependentLoadFlags; /**< 0x36 */
954 uint32_t EditList; /**< 0x38 */
955 uint32_t SecurityCookie; /**< 0x3c */
956 uint32_t SEHandlerTable; /**< 0x40 */
957 uint32_t SEHandlerCount; /**< 0x44 */
958 uint32_t GuardCFCCheckFunctionPointer; /**< 0x48 */
959 uint32_t GuardCFDispatchFunctionPointer; /**< 0x4c */
960 uint32_t GuardCFFunctionTable; /**< 0x50 */
961 uint32_t GuardCFFunctionCount; /**< 0x54 */
962 uint32_t GuardFlags; /**< 0x58 */
963 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x5c */
964 uint32_t GuardAddressTakenIatEntryTable; /**< 0x68 */
965 uint32_t GuardAddressTakenIatEntryCount; /**< 0x6c */
966 uint32_t GuardLongJumpTargetTable; /**< 0x70 */
967 uint32_t GuardLongJumpTargetCount; /**< 0x74 */
968 uint32_t DynamicValueRelocTable; /**< 0x78 */
969 uint32_t CHPEMetadataPointer; /**< 0x7c Not sure when this was renamed from HybridMetadataPointer. */
970 uint32_t GuardRFFailureRoutine; /**< 0x80 */
971 uint32_t GuardRFFailureRoutineFunctionPointer; /**< 0x84 */
972 uint32_t DynamicValueRelocTableOffset; /**< 0x88 */
973 uint16_t DynamicValueRelocTableSection; /**< 0x8c */
974 uint16_t Reserved2; /**< 0x8e */
975 uint32_t GuardRFVerifyStackPointerFunctionPointer; /**< 0x90 */
976 uint32_t HotPatchTableOffset; /**< 0x94 */
977} IMAGE_LOAD_CONFIG_DIRECTORY32_V8;
978AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V8, 0x98);
979typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V8;
980typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V8 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V8;
981
982/** @since Windows 10 build 16237 (or maybe earlier). */
983typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32_V9
984{
985 uint32_t Size; /**< 0x00 */
986 uint32_t TimeDateStamp; /**< 0x04 */
987 uint16_t MajorVersion; /**< 0x08 */
988 uint16_t MinorVersion; /**< 0x0a */
989 uint32_t GlobalFlagsClear; /**< 0x0c */
990 uint32_t GlobalFlagsSet; /**< 0x10 */
991 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
992 uint32_t DeCommitFreeBlockThreshold; /**< 0x18 */
993 uint32_t DeCommitTotalFreeThreshold; /**< 0x1c */
994 uint32_t LockPrefixTable; /**< 0x20 */
995 uint32_t MaximumAllocationSize; /**< 0x24 */
996 uint32_t VirtualMemoryThreshold; /**< 0x28 */
997 uint32_t ProcessHeapFlags; /**< 0x2c */
998 uint32_t ProcessAffinityMask; /**< 0x30 */
999 uint16_t CSDVersion; /**< 0x34 */
1000 uint16_t DependentLoadFlags; /**< 0x36 */
1001 uint32_t EditList; /**< 0x38 */
1002 uint32_t SecurityCookie; /**< 0x3c */
1003 uint32_t SEHandlerTable; /**< 0x40 */
1004 uint32_t SEHandlerCount; /**< 0x44 */
1005 uint32_t GuardCFCCheckFunctionPointer; /**< 0x48 */
1006 uint32_t GuardCFDispatchFunctionPointer; /**< 0x4c */
1007 uint32_t GuardCFFunctionTable; /**< 0x50 */
1008 uint32_t GuardCFFunctionCount; /**< 0x54 */
1009 uint32_t GuardFlags; /**< 0x58 */
1010 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x5c */
1011 uint32_t GuardAddressTakenIatEntryTable; /**< 0x68 */
1012 uint32_t GuardAddressTakenIatEntryCount; /**< 0x6c */
1013 uint32_t GuardLongJumpTargetTable; /**< 0x70 */
1014 uint32_t GuardLongJumpTargetCount; /**< 0x74 */
1015 uint32_t DynamicValueRelocTable; /**< 0x78 */
1016 uint32_t CHPEMetadataPointer; /**< 0x7c Not sure when this was renamed from HybridMetadataPointer. */
1017 uint32_t GuardRFFailureRoutine; /**< 0x80 */
1018 uint32_t GuardRFFailureRoutineFunctionPointer; /**< 0x84 */
1019 uint32_t DynamicValueRelocTableOffset; /**< 0x88 */
1020 uint16_t DynamicValueRelocTableSection; /**< 0x8c */
1021 uint16_t Reserved2; /**< 0x8e */
1022 uint32_t GuardRFVerifyStackPointerFunctionPointer; /**< 0x90 */
1023 uint32_t HotPatchTableOffset; /**< 0x94 */
1024 uint32_t AddressOfSomeUnicodeString; /**< 0x98 - 64-bit version has this member about here. not sure about location yet. */
1025 uint32_t Reserved3QuestionMark; /**< 0x9a - Did they 8-byte pad the structure or is AddressOfSomeUnicodeString 64-bit? */
1026} IMAGE_LOAD_CONFIG_DIRECTORY32_V9;
1027AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY32_V9, 0xa0);
1028typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V9 *PIMAGE_LOAD_CONFIG_DIRECTORY32_V9;
1029typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V9 const *PCIMAGE_LOAD_CONFIG_DIRECTORY32_V9;
1030
1031typedef IMAGE_LOAD_CONFIG_DIRECTORY32_V9 IMAGE_LOAD_CONFIG_DIRECTORY32;
1032typedef PIMAGE_LOAD_CONFIG_DIRECTORY32_V9 PIMAGE_LOAD_CONFIG_DIRECTORY32;
1033typedef PCIMAGE_LOAD_CONFIG_DIRECTORY32_V9 PCIMAGE_LOAD_CONFIG_DIRECTORY32;
1034
1035
1036/* No _IMAGE_LOAD_CONFIG_DIRECTORY64_V1 exists. */
1037
1038typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V2
1039{
1040 uint32_t Size;
1041 uint32_t TimeDateStamp;
1042 uint16_t MajorVersion;
1043 uint16_t MinorVersion;
1044 uint32_t GlobalFlagsClear;
1045 uint32_t GlobalFlagsSet;
1046 uint32_t CriticalSectionDefaultTimeout;
1047 uint64_t DeCommitFreeBlockThreshold;
1048 uint64_t DeCommitTotalFreeThreshold;
1049 uint64_t LockPrefixTable;
1050 uint64_t MaximumAllocationSize;
1051 uint64_t VirtualMemoryThreshold;
1052 uint64_t ProcessAffinityMask;
1053 uint32_t ProcessHeapFlags;
1054 uint16_t CSDVersion;
1055 uint16_t DependentLoadFlags;
1056 uint64_t EditList;
1057 uint64_t SecurityCookie;
1058 uint64_t SEHandlerTable;
1059 uint64_t SEHandlerCount;
1060} IMAGE_LOAD_CONFIG_DIRECTORY64_V2;
1061AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V2, 0x70);
1062typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V2 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V2;
1063typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V2 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V2;
1064
1065#pragma pack(4) /* Why not 8 byte alignment, baka microsofties?!? */
1066typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V3
1067{
1068 uint32_t Size;
1069 uint32_t TimeDateStamp;
1070 uint16_t MajorVersion;
1071 uint16_t MinorVersion;
1072 uint32_t GlobalFlagsClear;
1073 uint32_t GlobalFlagsSet;
1074 uint32_t CriticalSectionDefaultTimeout;
1075 uint64_t DeCommitFreeBlockThreshold;
1076 uint64_t DeCommitTotalFreeThreshold;
1077 uint64_t LockPrefixTable;
1078 uint64_t MaximumAllocationSize;
1079 uint64_t VirtualMemoryThreshold;
1080 uint64_t ProcessAffinityMask;
1081 uint32_t ProcessHeapFlags;
1082 uint16_t CSDVersion;
1083 uint16_t DependentLoadFlags;
1084 uint64_t EditList;
1085 uint64_t SecurityCookie;
1086 uint64_t SEHandlerTable;
1087 uint64_t SEHandlerCount;
1088 uint64_t GuardCFCCheckFunctionPointer;
1089 uint64_t GuardCFDispatchFunctionPointer;
1090 uint64_t GuardCFFunctionTable;
1091 uint64_t GuardCFFunctionCount;
1092 uint32_t GuardFlags;
1093} IMAGE_LOAD_CONFIG_DIRECTORY64_V3;
1094#pragma pack()
1095AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V3, 0x94);
1096typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V3 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V3;
1097typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V3 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V3;
1098
1099/** @since Windows 10 (Preview (9879). */
1100typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V4
1101{
1102 uint32_t Size; /**< 0x00 */
1103 uint32_t TimeDateStamp; /**< 0x04 */
1104 uint16_t MajorVersion; /**< 0x08 */
1105 uint16_t MinorVersion; /**< 0x0a */
1106 uint32_t GlobalFlagsClear; /**< 0x0c */
1107 uint32_t GlobalFlagsSet; /**< 0x10 */
1108 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
1109 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */
1110 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */
1111 uint64_t LockPrefixTable; /**< 0x28 */
1112 uint64_t MaximumAllocationSize; /**< 0x30 */
1113 uint64_t VirtualMemoryThreshold; /**< 0x38 */
1114 uint64_t ProcessAffinityMask; /**< 0x40 */
1115 uint32_t ProcessHeapFlags; /**< 0x48 */
1116 uint16_t CSDVersion; /**< 0x4c */
1117 uint16_t DependentLoadFlags; /**< 0x4e */
1118 uint64_t EditList; /**< 0x50 */
1119 uint64_t SecurityCookie; /**< 0x58 */
1120 uint64_t SEHandlerTable; /**< 0x60 */
1121 uint64_t SEHandlerCount; /**< 0x68 */
1122 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */
1123 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */
1124 uint64_t GuardCFFunctionTable; /**< 0x80 */
1125 uint64_t GuardCFFunctionCount; /**< 0x88 */
1126 uint32_t GuardFlags; /**< 0x90 */
1127 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */
1128} IMAGE_LOAD_CONFIG_DIRECTORY64_V4;
1129AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V4, 0xa0);
1130typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V4 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V4;
1131typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V4 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V4;
1132
1133/** @since Windows 10 build 14286 (or maybe earlier). */
1134typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V5
1135{
1136 uint32_t Size; /**< 0x00 */
1137 uint32_t TimeDateStamp; /**< 0x04 */
1138 uint16_t MajorVersion; /**< 0x08 */
1139 uint16_t MinorVersion; /**< 0x0a */
1140 uint32_t GlobalFlagsClear; /**< 0x0c */
1141 uint32_t GlobalFlagsSet; /**< 0x10 */
1142 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
1143 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */
1144 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */
1145 uint64_t LockPrefixTable; /**< 0x28 */
1146 uint64_t MaximumAllocationSize; /**< 0x30 */
1147 uint64_t VirtualMemoryThreshold; /**< 0x38 */
1148 uint64_t ProcessAffinityMask; /**< 0x40 */
1149 uint32_t ProcessHeapFlags; /**< 0x48 */
1150 uint16_t CSDVersion; /**< 0x4c */
1151 uint16_t DependentLoadFlags; /**< 0x4e */
1152 uint64_t EditList; /**< 0x50 */
1153 uint64_t SecurityCookie; /**< 0x58 */
1154 uint64_t SEHandlerTable; /**< 0x60 */
1155 uint64_t SEHandlerCount; /**< 0x68 */
1156 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */
1157 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */
1158 uint64_t GuardCFFunctionTable; /**< 0x80 */
1159 uint64_t GuardCFFunctionCount; /**< 0x88 */
1160 uint32_t GuardFlags; /**< 0x90 */
1161 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */
1162 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */
1163 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */
1164 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */
1165 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */
1166} IMAGE_LOAD_CONFIG_DIRECTORY64_V5;
1167AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V5, 0xc0);
1168typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V5 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V5;
1169typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V5 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V5;
1170
1171/** @since Windows 10 build 14393 (or maybe earlier). */
1172typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V6
1173{
1174 uint32_t Size; /**< 0x00 */
1175 uint32_t TimeDateStamp; /**< 0x04 */
1176 uint16_t MajorVersion; /**< 0x08 */
1177 uint16_t MinorVersion; /**< 0x0a */
1178 uint32_t GlobalFlagsClear; /**< 0x0c */
1179 uint32_t GlobalFlagsSet; /**< 0x10 */
1180 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
1181 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */
1182 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */
1183 uint64_t LockPrefixTable; /**< 0x28 */
1184 uint64_t MaximumAllocationSize; /**< 0x30 */
1185 uint64_t VirtualMemoryThreshold; /**< 0x38 */
1186 uint64_t ProcessAffinityMask; /**< 0x40 */
1187 uint32_t ProcessHeapFlags; /**< 0x48 */
1188 uint16_t CSDVersion; /**< 0x4c */
1189 uint16_t DependentLoadFlags; /**< 0x4e */
1190 uint64_t EditList; /**< 0x50 */
1191 uint64_t SecurityCookie; /**< 0x58 */
1192 uint64_t SEHandlerTable; /**< 0x60 */
1193 uint64_t SEHandlerCount; /**< 0x68 */
1194 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */
1195 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */
1196 uint64_t GuardCFFunctionTable; /**< 0x80 */
1197 uint64_t GuardCFFunctionCount; /**< 0x88 */
1198 uint32_t GuardFlags; /**< 0x90 */
1199 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */
1200 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */
1201 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */
1202 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */
1203 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */
1204 uint64_t DynamicValueRelocTable; /**< 0xc0 */
1205 uint64_t HybridMetadataPointer; /**< 0xc8 */
1206} IMAGE_LOAD_CONFIG_DIRECTORY64_V6;
1207AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V6, 0xd0);
1208typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V6 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V6;
1209typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V6 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V6;
1210
1211/** @since Windows 10 build 14901 (or maybe earlier). */
1212typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V7
1213{
1214 uint32_t Size; /**< 0x00 */
1215 uint32_t TimeDateStamp; /**< 0x04 */
1216 uint16_t MajorVersion; /**< 0x08 */
1217 uint16_t MinorVersion; /**< 0x0a */
1218 uint32_t GlobalFlagsClear; /**< 0x0c */
1219 uint32_t GlobalFlagsSet; /**< 0x10 */
1220 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
1221 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */
1222 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */
1223 uint64_t LockPrefixTable; /**< 0x28 */
1224 uint64_t MaximumAllocationSize; /**< 0x30 */
1225 uint64_t VirtualMemoryThreshold; /**< 0x38 */
1226 uint64_t ProcessAffinityMask; /**< 0x40 */
1227 uint32_t ProcessHeapFlags; /**< 0x48 */
1228 uint16_t CSDVersion; /**< 0x4c */
1229 uint16_t DependentLoadFlags; /**< 0x4e */
1230 uint64_t EditList; /**< 0x50 */
1231 uint64_t SecurityCookie; /**< 0x58 */
1232 uint64_t SEHandlerTable; /**< 0x60 */
1233 uint64_t SEHandlerCount; /**< 0x68 */
1234 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */
1235 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */
1236 uint64_t GuardCFFunctionTable; /**< 0x80 */
1237 uint64_t GuardCFFunctionCount; /**< 0x88 */
1238 uint32_t GuardFlags; /**< 0x90 */
1239 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */
1240 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */
1241 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */
1242 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */
1243 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */
1244 uint64_t DynamicValueRelocTable; /**< 0xc0 */
1245 uint64_t CHPEMetadataPointer; /**< 0xc8 Not sure when this was renamed from HybridMetadataPointer. */
1246 uint64_t GuardRFFailureRoutine; /**< 0xd0 */
1247 uint64_t GuardRFFailureRoutineFunctionPointer; /**< 0xd8 */
1248 uint32_t DynamicValueRelocTableOffset; /**< 0xe0 */
1249 uint16_t DynamicValueRelocTableSection; /**< 0xe4 */
1250 uint16_t Reserved2; /**< 0xe6 */
1251} IMAGE_LOAD_CONFIG_DIRECTORY64_V7;
1252AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V7, 0xe8);
1253typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V7 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V7;
1254typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V7 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V7;
1255
1256/** @since Windows 10 build 15002 (or maybe earlier). */
1257#pragma pack(4) /* Stupid, stupid microsofties! */
1258typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V8
1259{
1260 uint32_t Size; /**< 0x00 */
1261 uint32_t TimeDateStamp; /**< 0x04 */
1262 uint16_t MajorVersion; /**< 0x08 */
1263 uint16_t MinorVersion; /**< 0x0a */
1264 uint32_t GlobalFlagsClear; /**< 0x0c */
1265 uint32_t GlobalFlagsSet; /**< 0x10 */
1266 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
1267 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */
1268 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */
1269 uint64_t LockPrefixTable; /**< 0x28 */
1270 uint64_t MaximumAllocationSize; /**< 0x30 */
1271 uint64_t VirtualMemoryThreshold; /**< 0x38 */
1272 uint64_t ProcessAffinityMask; /**< 0x40 */
1273 uint32_t ProcessHeapFlags; /**< 0x48 */
1274 uint16_t CSDVersion; /**< 0x4c */
1275 uint16_t DependentLoadFlags; /**< 0x4e */
1276 uint64_t EditList; /**< 0x50 */
1277 uint64_t SecurityCookie; /**< 0x58 */
1278 uint64_t SEHandlerTable; /**< 0x60 */
1279 uint64_t SEHandlerCount; /**< 0x68 */
1280 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */
1281 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */
1282 uint64_t GuardCFFunctionTable; /**< 0x80 */
1283 uint64_t GuardCFFunctionCount; /**< 0x88 */
1284 uint32_t GuardFlags; /**< 0x90 */
1285 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */
1286 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */
1287 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */
1288 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */
1289 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */
1290 uint64_t DynamicValueRelocTable; /**< 0xc0 */
1291 uint64_t CHPEMetadataPointer; /**< 0xc8 */
1292 uint64_t GuardRFFailureRoutine; /**< 0xd0 */
1293 uint64_t GuardRFFailureRoutineFunctionPointer; /**< 0xd8 */
1294 uint32_t DynamicValueRelocTableOffset; /**< 0xe0 */
1295 uint16_t DynamicValueRelocTableSection; /**< 0xe4 */
1296 uint16_t Reserved2; /**< 0xe6 */
1297 uint64_t GuardRFVerifyStackPointerFunctionPointer; /**< 0xe8 */
1298 uint32_t HotPatchTableOffset; /**< 0xf0 */
1299} IMAGE_LOAD_CONFIG_DIRECTORY64_V8;
1300#pragma pack()
1301AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V8, 0xf4);
1302typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V8;
1303typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V8 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V8;
1304
1305/** @since Windows 10 build 15002 (or maybe earlier). */
1306typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64_V9
1307{
1308 uint32_t Size; /**< 0x00 */
1309 uint32_t TimeDateStamp; /**< 0x04 */
1310 uint16_t MajorVersion; /**< 0x08 */
1311 uint16_t MinorVersion; /**< 0x0a */
1312 uint32_t GlobalFlagsClear; /**< 0x0c */
1313 uint32_t GlobalFlagsSet; /**< 0x10 */
1314 uint32_t CriticalSectionDefaultTimeout; /**< 0x14 */
1315 uint64_t DeCommitFreeBlockThreshold; /**< 0x18 */
1316 uint64_t DeCommitTotalFreeThreshold; /**< 0x20 */
1317 uint64_t LockPrefixTable; /**< 0x28 */
1318 uint64_t MaximumAllocationSize; /**< 0x30 */
1319 uint64_t VirtualMemoryThreshold; /**< 0x38 */
1320 uint64_t ProcessAffinityMask; /**< 0x40 */
1321 uint32_t ProcessHeapFlags; /**< 0x48 */
1322 uint16_t CSDVersion; /**< 0x4c */
1323 uint16_t DependentLoadFlags; /**< 0x4e */
1324 uint64_t EditList; /**< 0x50 */
1325 uint64_t SecurityCookie; /**< 0x58 */
1326 uint64_t SEHandlerTable; /**< 0x60 */
1327 uint64_t SEHandlerCount; /**< 0x68 */
1328 uint64_t GuardCFCCheckFunctionPointer; /**< 0x70 */
1329 uint64_t GuardCFDispatchFunctionPointer; /**< 0x78 */
1330 uint64_t GuardCFFunctionTable; /**< 0x80 */
1331 uint64_t GuardCFFunctionCount; /**< 0x88 */
1332 uint32_t GuardFlags; /**< 0x90 */
1333 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; /**< 0x94 */
1334 uint64_t GuardAddressTakenIatEntryTable; /**< 0xa0 */
1335 uint64_t GuardAddressTakenIatEntryCount; /**< 0xa8 */
1336 uint64_t GuardLongJumpTargetTable; /**< 0xb0 */
1337 uint64_t GuardLongJumpTargetCount; /**< 0xb8 */
1338 uint64_t DynamicValueRelocTable; /**< 0xc0 */
1339 uint64_t CHPEMetadataPointer; /**< 0xc8 */
1340 uint64_t GuardRFFailureRoutine; /**< 0xd0 */
1341 uint64_t GuardRFFailureRoutineFunctionPointer; /**< 0xd8 */
1342 uint32_t DynamicValueRelocTableOffset; /**< 0xe0 */
1343 uint16_t DynamicValueRelocTableSection; /**< 0xe4 */
1344 uint16_t Reserved2; /**< 0xe6 */
1345 uint64_t GuardRFVerifyStackPointerFunctionPointer; /**< 0xe8 */
1346 uint32_t HotPatchTableOffset; /**< 0xf0 */
1347 uint32_t Reserved3; /**< 0xf4 */
1348 uint64_t AddressOfSomeUnicodeString; /**< 0xf8 - seen in bcrypt and bcryptprimitives pointing to the string "L". */
1349} IMAGE_LOAD_CONFIG_DIRECTORY64_V9;
1350AssertCompileSize(IMAGE_LOAD_CONFIG_DIRECTORY64_V9, 0x100);
1351typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V9 *PIMAGE_LOAD_CONFIG_DIRECTORY64_V9;
1352typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V9 const *PCIMAGE_LOAD_CONFIG_DIRECTORY64_V9;
1353
1354typedef IMAGE_LOAD_CONFIG_DIRECTORY64_V9 IMAGE_LOAD_CONFIG_DIRECTORY64;
1355typedef PIMAGE_LOAD_CONFIG_DIRECTORY64_V9 PIMAGE_LOAD_CONFIG_DIRECTORY64;
1356typedef PCIMAGE_LOAD_CONFIG_DIRECTORY64_V9 PCIMAGE_LOAD_CONFIG_DIRECTORY64;
1357
1358/** @} */
1359
1360
1361/**
1362 * PE certificate directory.
1363 *
1364 * Found in IMAGE_DIRECTORY_ENTRY_SECURITY.
1365 */
1366typedef struct WIN_CERTIFICATE
1367{
1368 uint32_t dwLength;
1369 uint16_t wRevision;
1370 uint16_t wCertificateType;
1371 uint8_t bCertificate[8];
1372} WIN_CERTIFICATE;
1373AssertCompileSize(WIN_CERTIFICATE, 16);
1374typedef WIN_CERTIFICATE *PWIN_CERTIFICATE;
1375typedef WIN_CERTIFICATE const *PCWIN_CERTIFICATE;
1376
1377/** @name WIN_CERT_REVISION_XXX - Certificate data directory revision.
1378 * Used WIN_CERTIFICATE::wRevision found in the
1379 * IMAGE_DIRECTORY_ENTRY_SECURITY data directory. */
1380#define WIN_CERT_REVISION_1_0 UINT16_C(0x0100)
1381#define WIN_CERT_REVISION_2_0 UINT16_C(0x0200)
1382/** @} */
1383
1384/** @name WIN_CERT_TYPE_XXX - Signature type.
1385 * Used by WIN_CERTIFICATE::wCertificateType.
1386 * @{ */
1387#define WIN_CERT_TYPE_X509 UINT16_C(1)
1388#define WIN_CERT_TYPE_PKCS_SIGNED_DATA UINT16_C(2)
1389#define WIN_CERT_TYPE_RESERVED_1 UINT16_C(3)
1390#define WIN_CERT_TYPE_TS_STACK_SIGNED UINT16_C(4)
1391#define WIN_CERT_TYPE_EFI_PKCS115 UINT16_C(0x0ef0)
1392#define WIN_CERT_TYPE_EFI_GUID UINT16_C(0x0ef1)
1393/** @} */
1394
1395/** The alignment of the certificate table.
1396 * @remarks Found thru signtool experiments. */
1397#define WIN_CERTIFICATE_ALIGNMENT UINT32_C(8)
1398
1399
1400/**
1401 * Debug directory.
1402 *
1403 * Found in IMAGE_DIRECTORY_ENTRY_DEBUG.
1404 */
1405typedef struct _IMAGE_DEBUG_DIRECTORY
1406{
1407 uint32_t Characteristics;
1408 uint32_t TimeDateStamp;
1409 uint16_t MajorVersion;
1410 uint16_t MinorVersion;
1411 uint32_t Type;
1412 uint32_t SizeOfData;
1413 uint32_t AddressOfRawData;
1414 uint32_t PointerToRawData;
1415} IMAGE_DEBUG_DIRECTORY;
1416AssertCompileSize(IMAGE_DEBUG_DIRECTORY, 28);
1417typedef IMAGE_DEBUG_DIRECTORY *PIMAGE_DEBUG_DIRECTORY;
1418typedef IMAGE_DEBUG_DIRECTORY const *PCIMAGE_DEBUG_DIRECTORY;
1419
1420/** @name IMAGE_DEBUG_TYPE_XXX - Debug format types.
1421 * Used by IMAGE_DEBUG_DIRECTORY::Type.
1422 * @{ */
1423#define IMAGE_DEBUG_TYPE_UNKNOWN UINT32_C(0x00)
1424#define IMAGE_DEBUG_TYPE_COFF UINT32_C(0x01)
1425#define IMAGE_DEBUG_TYPE_CODEVIEW UINT32_C(0x02)
1426#define IMAGE_DEBUG_TYPE_FPO UINT32_C(0x03)
1427#define IMAGE_DEBUG_TYPE_MISC UINT32_C(0x04)
1428#define IMAGE_DEBUG_TYPE_EXCEPTION UINT32_C(0x05)
1429#define IMAGE_DEBUG_TYPE_FIXUP UINT32_C(0x06)
1430#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC UINT32_C(0x07)
1431#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC UINT32_C(0x08)
1432#define IMAGE_DEBUG_TYPE_BORLAND UINT32_C(0x09)
1433#define IMAGE_DEBUG_TYPE_RESERVED10 UINT32_C(0x0a)
1434#define IMAGE_DEBUG_TYPE_CLSID UINT32_C(0x0b)
1435#define IMAGE_DEBUG_TYPE_VC_FEATURE UINT32_C(0x0c)
1436#define IMAGE_DEBUG_TYPE_POGO UINT32_C(0x0d)
1437#define IMAGE_DEBUG_TYPE_ILTCG UINT32_C(0x0e)
1438#define IMAGE_DEBUG_TYPE_MPX UINT32_C(0x0f)
1439#define IMAGE_DEBUG_TYPE_REPRO UINT32_C(0x10)
1440/** @} */
1441
1442/** @name IMAGE_DEBUG_MISC_XXX - Misc debug data type.
1443 * Used by IMAGE_DEBUG_MISC::DataType.
1444 * @{ */
1445#define IMAGE_DEBUG_MISC_EXENAME UINT32_C(1)
1446/** @} */
1447
1448
1449/**
1450 * The format of IMAGE_DEBUG_TYPE_MISC debug info.
1451 */
1452typedef struct _IMAGE_DEBUG_MISC
1453{
1454 uint32_t DataType;
1455 uint32_t Length;
1456 uint8_t Unicode;
1457 uint8_t Reserved[3];
1458 uint8_t Data[1];
1459} IMAGE_DEBUG_MISC;
1460AssertCompileSize(IMAGE_DEBUG_MISC, 16);
1461typedef IMAGE_DEBUG_MISC *PIMAGE_DEBUG_MISC;
1462typedef IMAGE_DEBUG_MISC const *PCIMAGE_DEBUG_MISC;
1463
1464
1465
1466/**
1467 * The header of a .DBG file (NT4).
1468 */
1469typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
1470{
1471 uint16_t Signature; /**< 0x00 */
1472 uint16_t Flags; /**< 0x02 */
1473 uint16_t Machine; /**< 0x04 */
1474 uint16_t Characteristics; /**< 0x06 */
1475 uint32_t TimeDateStamp; /**< 0x08 */
1476 uint32_t CheckSum; /**< 0x0c */
1477 uint32_t ImageBase; /**< 0x10 */
1478 uint32_t SizeOfImage; /**< 0x14 */
1479 uint32_t NumberOfSections; /**< 0x18 */
1480 uint32_t ExportedNamesSize; /**< 0x1c */
1481 uint32_t DebugDirectorySize; /**< 0x20 */
1482 uint32_t SectionAlignment; /**< 0x24 */
1483 uint32_t Reserved[2]; /**< 0x28 */
1484} IMAGE_SEPARATE_DEBUG_HEADER; /* size: 0x30 */
1485AssertCompileSize(IMAGE_SEPARATE_DEBUG_HEADER, 0x30);
1486typedef IMAGE_SEPARATE_DEBUG_HEADER *PIMAGE_SEPARATE_DEBUG_HEADER;
1487typedef IMAGE_SEPARATE_DEBUG_HEADER const *PCIMAGE_SEPARATE_DEBUG_HEADER;
1488
1489/** The signature of a IMAGE_SEPARATE_DEBUG_HEADER. */
1490#define IMAGE_SEPARATE_DEBUG_SIGNATURE UINT16_C(0x4944)
1491
1492
1493/**
1494 * The format of IMAGE_DEBUG_TYPE_COFF debug info.
1495 */
1496typedef struct _IMAGE_COFF_SYMBOLS_HEADER
1497{
1498 uint32_t NumberOfSymbols;
1499 uint32_t LvaToFirstSymbol;
1500 uint32_t NumberOfLinenumbers;
1501 uint32_t LvaToFirstLinenumber;
1502 uint32_t RvaToFirstByteOfCode;
1503 uint32_t RvaToLastByteOfCode;
1504 uint32_t RvaToFirstByteOfData;
1505 uint32_t RvaToLastByteOfData;
1506} IMAGE_COFF_SYMBOLS_HEADER;
1507AssertCompileSize(IMAGE_COFF_SYMBOLS_HEADER, 0x20);
1508typedef IMAGE_COFF_SYMBOLS_HEADER *PIMAGE_COFF_SYMBOLS_HEADER;
1509typedef IMAGE_COFF_SYMBOLS_HEADER const *PCIMAGE_COFF_SYMBOLS_HEADER;
1510
1511
1512/**
1513 * Line number format of IMAGE_DEBUG_TYPE_COFF debug info.
1514 *
1515 * @remarks This has misaligned members.
1516 */
1517#pragma pack(2)
1518typedef struct _IMAGE_LINENUMBER
1519{
1520 union
1521 {
1522 uint32_t VirtualAddress;
1523 uint32_t SymbolTableIndex;
1524 } Type;
1525 uint16_t Linenumber;
1526} IMAGE_LINENUMBER;
1527#pragma pack()
1528AssertCompileSize(IMAGE_LINENUMBER, 6);
1529typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
1530typedef IMAGE_LINENUMBER const *PCIMAGE_LINENUMBER;
1531
1532
1533/** The size of a IMAGE_SYMBOL & IMAGE_AUX_SYMBOL structure. */
1534#define IMAGE_SIZE_OF_SYMBOL 18
1535/** The size of a IMAGE_SYMBOL_EX & IMAGE_AUX_SYMBOL_EX structure. */
1536#define IMAGE_SIZE_OF_SYMBOL_EX 20
1537
1538/**
1539 * COFF symbol.
1540 */
1541#pragma pack(2)
1542typedef struct _IMAGE_SYMBOL
1543{
1544 union
1545 {
1546 uint8_t ShortName[8];
1547 struct
1548 {
1549 uint32_t Short;
1550 uint32_t Long;
1551 } Name;
1552 uint32_t LongName[2];
1553 } N;
1554
1555 uint32_t Value;
1556 int16_t SectionNumber;
1557 uint16_t Type;
1558 uint8_t StorageClass;
1559 uint8_t NumberOfAuxSymbols;
1560} IMAGE_SYMBOL;
1561#pragma pack()
1562AssertCompileSize(IMAGE_SYMBOL, IMAGE_SIZE_OF_SYMBOL);
1563typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
1564typedef IMAGE_SYMBOL const *PCIMAGE_SYMBOL;
1565
1566/**
1567 * COFF auxiliary symbol token defintion (whatever that is).
1568 */
1569#pragma pack(2)
1570typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF
1571{
1572 uint8_t bAuxType;
1573 uint8_t bReserved;
1574 uint32_t SymbolTableIndex;
1575 uint8_t rgbReserved[12];
1576} IMAGE_AUX_SYMBOL_TOKEN_DEF;
1577#pragma pack()
1578AssertCompileSize(IMAGE_AUX_SYMBOL_TOKEN_DEF, IMAGE_SIZE_OF_SYMBOL);
1579typedef IMAGE_AUX_SYMBOL_TOKEN_DEF *PIMAGE_AUX_SYMBOL_TOKEN_DEF;
1580typedef IMAGE_AUX_SYMBOL_TOKEN_DEF const *PCIMAGE_AUX_SYMBOL_TOKEN_DEF;
1581
1582/**
1583 * COFF auxiliary symbol.
1584 */
1585#pragma pack(1)
1586typedef union _IMAGE_AUX_SYMBOL
1587{
1588 struct
1589 {
1590 uint32_t TagIndex;
1591 union
1592 {
1593 struct
1594 {
1595 uint16_t Linenumber;
1596 uint16_t Size;
1597 } LnSz;
1598 } Misc;
1599 union
1600 {
1601 struct
1602 {
1603 uint32_t PointerToLinenumber;
1604 uint32_t PointerToNextFunction;
1605 } Function;
1606 struct
1607 {
1608 uint16_t Dimension[4];
1609 } Array;
1610 } FcnAry;
1611 uint16_t TvIndex;
1612 } Sym;
1613
1614 struct
1615 {
1616 uint8_t Name[IMAGE_SIZE_OF_SYMBOL];
1617 } File;
1618
1619 struct
1620 {
1621 uint32_t Length;
1622 uint16_t NumberOfRelocations;
1623 uint16_t NumberOfLinenumbers;
1624 uint32_t CheckSum;
1625 uint16_t Number;
1626 uint8_t Selection;
1627 uint8_t bReserved;
1628 uint16_t HighNumber;
1629 } Section;
1630
1631 IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef;
1632 struct
1633 {
1634 uint32_t crc;
1635 uint8_t rgbReserved[14];
1636 } CRC;
1637} IMAGE_AUX_SYMBOL;
1638#pragma pack()
1639AssertCompileSize(IMAGE_AUX_SYMBOL, IMAGE_SIZE_OF_SYMBOL);
1640typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
1641typedef IMAGE_AUX_SYMBOL const *PCIMAGE_AUX_SYMBOL;
1642
1643
1644/**
1645 * Extended COFF symbol.
1646 */
1647typedef struct _IMAGE_SYMBOL_EX
1648{
1649 union
1650 {
1651 uint8_t ShortName[8];
1652 struct
1653 {
1654 uint32_t Short;
1655 uint32_t Long;
1656 } Name;
1657 uint32_t LongName[2];
1658 } N;
1659
1660 uint32_t Value;
1661 int32_t SectionNumber; /* The difference from IMAGE_SYMBOL */
1662 uint16_t Type;
1663 uint8_t StorageClass;
1664 uint8_t NumberOfAuxSymbols;
1665} IMAGE_SYMBOL_EX;
1666AssertCompileSize(IMAGE_SYMBOL_EX, IMAGE_SIZE_OF_SYMBOL_EX);
1667typedef IMAGE_SYMBOL_EX *PIMAGE_SYMBOL_EX;
1668typedef IMAGE_SYMBOL_EX const *PCIMAGE_SYMBOL_EX;
1669
1670/**
1671 * Extended COFF auxiliary symbol.
1672 */
1673typedef union _IMAGE_AUX_SYMBOL_EX
1674{
1675 struct
1676 {
1677 uint32_t WeakDefaultSymIndex;
1678 uint32_t WeakSearchType;
1679 uint8_t rgbReserved[12];
1680 } Sym;
1681
1682 struct
1683 {
1684 uint8_t Name[IMAGE_SIZE_OF_SYMBOL_EX];
1685 } File;
1686
1687 struct
1688 {
1689 uint32_t Length;
1690 uint16_t NumberOfRelocations;
1691 uint16_t NumberOfLinenumbers;
1692 uint32_t CheckSum;
1693 uint16_t Number;
1694 uint8_t Selection;
1695 uint8_t bReserved;
1696 uint16_t HighNumber;
1697 uint8_t rgbReserved[2];
1698 } Section;
1699
1700 IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef;
1701
1702 struct
1703 {
1704 uint32_t crc;
1705 uint8_t rgbReserved[16];
1706 } CRC;
1707} IMAGE_AUX_SYMBOL_EX;
1708AssertCompileSize(IMAGE_AUX_SYMBOL_EX, IMAGE_SIZE_OF_SYMBOL_EX);
1709typedef IMAGE_AUX_SYMBOL_EX *PIMAGE_AUX_SYMBOL_EX;
1710typedef IMAGE_AUX_SYMBOL_EX const *PCIMAGE_AUX_SYMBOL_EX;
1711
1712/** @name Special COFF section numbers.
1713 * Used by IMAGE_SYMBOL::SectionNumber and IMAGE_SYMBOL_EX::SectionNumber
1714 * @{ */
1715#define IMAGE_SYM_UNDEFINED INT16_C(0)
1716#define IMAGE_SYM_ABSOLUTE INT16_C(-1)
1717#define IMAGE_SYM_DEBUG INT16_C(-2)
1718/** @} */
1719
1720/** @name IMAGE_SYM_CLASS_XXX - COFF symbol storage classes.
1721 * @{ */
1722#define IMAGE_SYM_CLASS_END_OF_FUNCTION UINT8_C(0xff) /* -1 */
1723#define IMAGE_SYM_CLASS_NULL UINT8_C(0)
1724#define IMAGE_SYM_CLASS_AUTOMATIC UINT8_C(1)
1725#define IMAGE_SYM_CLASS_EXTERNAL UINT8_C(2)
1726#define IMAGE_SYM_CLASS_STATIC UINT8_C(3)
1727#define IMAGE_SYM_CLASS_REGISTER UINT8_C(4)
1728#define IMAGE_SYM_CLASS_EXTERNAL_DEF UINT8_C(5)
1729#define IMAGE_SYM_CLASS_LABEL UINT8_C(6)
1730#define IMAGE_SYM_CLASS_UNDEFINED_LABEL UINT8_C(7)
1731#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT UINT8_C(8)
1732#define IMAGE_SYM_CLASS_ARGUMENT UINT8_C(9)
1733#define IMAGE_SYM_CLASS_STRUCT_TAG UINT8_C(10)
1734#define IMAGE_SYM_CLASS_MEMBER_OF_UNION UINT8_C(11)
1735#define IMAGE_SYM_CLASS_UNION_TAG UINT8_C(12)
1736#define IMAGE_SYM_CLASS_TYPE_DEFINITION UINT8_C(13)
1737#define IMAGE_SYM_CLASS_UNDEFINED_STATIC UINT8_C(14)
1738#define IMAGE_SYM_CLASS_ENUM_TAG UINT8_C(15)
1739#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM UINT8_C(16)
1740#define IMAGE_SYM_CLASS_REGISTER_PARAM UINT8_C(17)
1741#define IMAGE_SYM_CLASS_BIT_FIELD UINT8_C(18)
1742#define IMAGE_SYM_CLASS_FAR_EXTERNAL UINT8_C(68)
1743#define IMAGE_SYM_CLASS_BLOCK UINT8_C(100)
1744#define IMAGE_SYM_CLASS_FUNCTION UINT8_C(101)
1745#define IMAGE_SYM_CLASS_END_OF_STRUCT UINT8_C(102)
1746#define IMAGE_SYM_CLASS_FILE UINT8_C(103)
1747#define IMAGE_SYM_CLASS_SECTION UINT8_C(104)
1748#define IMAGE_SYM_CLASS_WEAK_EXTERNAL UINT8_C(105)
1749#define IMAGE_SYM_CLASS_CLR_TOKEN UINT8_C(107)
1750/** @} */
1751
1752/** @name IMAGE_SYM_TYPE_XXX - COFF symbol base types
1753 * @{ */
1754#define IMAGE_SYM_TYPE_NULL UINT16_C(0x0000)
1755#define IMAGE_SYM_TYPE_VOID UINT16_C(0x0001)
1756#define IMAGE_SYM_TYPE_CHAR UINT16_C(0x0002)
1757#define IMAGE_SYM_TYPE_SHORT UINT16_C(0x0003)
1758#define IMAGE_SYM_TYPE_INT UINT16_C(0x0004)
1759#define IMAGE_SYM_TYPE_LONG UINT16_C(0x0005)
1760#define IMAGE_SYM_TYPE_FLOAT UINT16_C(0x0006)
1761#define IMAGE_SYM_TYPE_DOUBLE UINT16_C(0x0007)
1762#define IMAGE_SYM_TYPE_STRUCT UINT16_C(0x0008)
1763#define IMAGE_SYM_TYPE_UNION UINT16_C(0x0009)
1764#define IMAGE_SYM_TYPE_ENUM UINT16_C(0x000a)
1765#define IMAGE_SYM_TYPE_MOE UINT16_C(0x000b)
1766#define IMAGE_SYM_TYPE_BYTE UINT16_C(0x000c)
1767#define IMAGE_SYM_TYPE_WORD UINT16_C(0x000d)
1768#define IMAGE_SYM_TYPE_UINT UINT16_C(0x000e)
1769#define IMAGE_SYM_TYPE_DWORD UINT16_C(0x000f)
1770#define IMAGE_SYM_TYPE_PCODE UINT16_C(0x8000)
1771/** @} */
1772
1773/** @name IMAGE_SYM_DTYPE_XXX - COFF symbol complex types
1774 * @{ */
1775#define IMAGE_SYM_DTYPE_NULL UINT16_C(0x0)
1776#define IMAGE_SYM_DTYPE_POINTER UINT16_C(0x1)
1777#define IMAGE_SYM_DTYPE_FUNCTION UINT16_C(0x2)
1778#define IMAGE_SYM_DTYPE_ARRAY UINT16_C(0x3)
1779/** @} */
1780
1781/** @name COFF Symbol type masks and shift counts.
1782 * @{ */
1783#define N_BTMASK UINT16_C(0x000f)
1784#define N_TMASK UINT16_C(0x0030)
1785#define N_TMASK1 UINT16_C(0x00c0)
1786#define N_TMASK2 UINT16_C(0x00f0)
1787#define N_BTSHFT 4
1788#define N_TSHIFT 2
1789/** @} */
1790
1791/** @name COFF Symbol type macros.
1792 * @{ */
1793#define BTYPE(a_Type) ( (a_Type) & N_BTMASK )
1794#define ISPTR(a_Type) ( ((a_Type) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) )
1795#define ISFCN(a_Type) ( ((a_Type) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT) )
1796#define ISARY(a_Type) ( ((a_Type) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT) )
1797#define ISTAG(a_StorageClass) ( (a_StorageClass) == IMAGE_SYM_CLASS_STRUCT_TAG \
1798 || (a_StorageClass) == IMAGE_SYM_CLASS_UNION_TAG \
1799 || (a_StorageClass) == IMAGE_SYM_CLASS_ENUM_TAG )
1800/** @} */
1801
1802
1803/**
1804 * COFF relocation table entry.
1805 *
1806 * @note The size of the structure is not a multiple of the largest member
1807 * (uint32_t), so odd relocation table entry members will have
1808 * misaligned uint32_t members.
1809 */
1810#pragma pack(1)
1811typedef struct _IMAGE_RELOCATION
1812{
1813 union
1814 {
1815 uint32_t VirtualAddress;
1816 uint32_t RelocCount;
1817 } u;
1818 uint32_t SymbolTableIndex;
1819 uint16_t Type;
1820} IMAGE_RELOCATION;
1821#pragma pack()
1822/** The size of a COFF relocation entry. */
1823#define IMAGE_SIZEOF_RELOCATION 10
1824AssertCompileSize(IMAGE_RELOCATION, IMAGE_SIZEOF_RELOCATION);
1825typedef IMAGE_RELOCATION *PIMAGE_RELOCATION;
1826typedef IMAGE_RELOCATION const *PCIMAGE_RELOCATION;
1827
1828
1829/** @name IMAGE_REL_AMD64_XXX - COFF relocations for AMD64 CPUs.
1830 * Used by IMAGE_RELOCATION::Type.
1831 * @{ */
1832#define IMAGE_REL_AMD64_ABSOLUTE UINT16_C(0x0000)
1833#define IMAGE_REL_AMD64_ADDR64 UINT16_C(0x0001)
1834#define IMAGE_REL_AMD64_ADDR32 UINT16_C(0x0002)
1835#define IMAGE_REL_AMD64_ADDR32NB UINT16_C(0x0003)
1836#define IMAGE_REL_AMD64_REL32 UINT16_C(0x0004)
1837#define IMAGE_REL_AMD64_REL32_1 UINT16_C(0x0005)
1838#define IMAGE_REL_AMD64_REL32_2 UINT16_C(0x0006)
1839#define IMAGE_REL_AMD64_REL32_3 UINT16_C(0x0007)
1840#define IMAGE_REL_AMD64_REL32_4 UINT16_C(0x0008)
1841#define IMAGE_REL_AMD64_REL32_5 UINT16_C(0x0009)
1842#define IMAGE_REL_AMD64_SECTION UINT16_C(0x000a)
1843#define IMAGE_REL_AMD64_SECREL UINT16_C(0x000b)
1844#define IMAGE_REL_AMD64_SECREL7 UINT16_C(0x000c)
1845#define IMAGE_REL_AMD64_TOKEN UINT16_C(0x000d)
1846#define IMAGE_REL_AMD64_SREL32 UINT16_C(0x000e)
1847#define IMAGE_REL_AMD64_PAIR UINT16_C(0x000f)
1848#define IMAGE_REL_AMD64_SSPAN32 UINT16_C(0x0010)
1849/** @} */
1850
1851/** @name ARM IMAGE_REL_ARM_XXX - COFF relocations for ARM CPUs.
1852 * Used by IMAGE_RELOCATION::Type.
1853 * @{ */
1854#define IMAGE_REL_ARM_ABSOLUTE UINT16_C(0x0000)
1855#define IMAGE_REL_ARM_ADDR32 UINT16_C(0x0001)
1856#define IMAGE_REL_ARM_ADDR32NB UINT16_C(0x0002)
1857#define IMAGE_REL_ARM_BRANCH24 UINT16_C(0x0003)
1858#define IMAGE_REL_ARM_BRANCH11 UINT16_C(0x0004)
1859#define IMAGE_REL_ARM_TOKEN UINT16_C(0x0005)
1860#define IMAGE_REL_ARM_BLX24 UINT16_C(0x0008)
1861#define IMAGE_REL_ARM_BLX11 UINT16_C(0x0009)
1862#define IMAGE_REL_ARM_SECTION UINT16_C(0x000e)
1863#define IMAGE_REL_ARM_SECREL UINT16_C(0x000f)
1864#define IMAGE_REL_ARM_MOV32A UINT16_C(0x0010)
1865#define IMAGE_REL_ARM_MOV32T UINT16_C(0x0011)
1866#define IMAGE_REL_ARM_BRANCH20T UINT16_C(0x0012)
1867#define IMAGE_REL_ARM_BRANCH24T UINT16_C(0x0014)
1868#define IMAGE_REL_ARM_BLX23T UINT16_C(0x0015)
1869/** @} */
1870
1871/** @name IMAGE_REL_ARM64_XXX - COFF relocations for ARMv8 CPUs (64-bit).
1872 * Used by IMAGE_RELOCATION::Type.
1873 * @{ */
1874#define IMAGE_REL_ARM64_ABSOLUTE UINT16_C(0x0000)
1875#define IMAGE_REL_ARM64_ADDR32 UINT16_C(0x0001)
1876#define IMAGE_REL_ARM64_ADDR32NB UINT16_C(0x0002)
1877#define IMAGE_REL_ARM64_BRANCH26 UINT16_C(0x0003)
1878#define IMAGE_REL_ARM64_PAGEBASE_REL21 UINT16_C(0x0004)
1879#define IMAGE_REL_ARM64_REL21 UINT16_C(0x0005)
1880#define IMAGE_REL_ARM64_PAGEOFFSET_12A UINT16_C(0x0006)
1881#define IMAGE_REL_ARM64_PAGEOFFSET_12L UINT16_C(0x0007)
1882#define IMAGE_REL_ARM64_SECREL UINT16_C(0x0008)
1883#define IMAGE_REL_ARM64_SECREL_LOW12A UINT16_C(0x0009)
1884#define IMAGE_REL_ARM64_SECREL_HIGH12A UINT16_C(0x000a)
1885#define IMAGE_REL_ARM64_SECREL_LOW12L UINT16_C(0x000b)
1886#define IMAGE_REL_ARM64_TOKEN UINT16_C(0x000c)
1887#define IMAGE_REL_ARM64_SECTION UINT16_C(0x000d)
1888#define IMAGE_REL_ARM64_ADDR64 UINT16_C(0x000e)
1889/** @} */
1890
1891/** @name IMAGE_REL_SH3_XXX - COFF relocation for Hitachi SuperH CPUs.
1892 * Used by IMAGE_RELOCATION::Type.
1893 * @{ */
1894#define IMAGE_REL_SH3_ABSOLUTE UINT16_C(0x0000)
1895#define IMAGE_REL_SH3_DIRECT16 UINT16_C(0x0001)
1896#define IMAGE_REL_SH3_DIRECT32 UINT16_C(0x0002)
1897#define IMAGE_REL_SH3_DIRECT8 UINT16_C(0x0003)
1898#define IMAGE_REL_SH3_DIRECT8_WORD UINT16_C(0x0004)
1899#define IMAGE_REL_SH3_DIRECT8_LONG UINT16_C(0x0005)
1900#define IMAGE_REL_SH3_DIRECT4 UINT16_C(0x0006)
1901#define IMAGE_REL_SH3_DIRECT4_WORD UINT16_C(0x0007)
1902#define IMAGE_REL_SH3_DIRECT4_LONG UINT16_C(0x0008)
1903#define IMAGE_REL_SH3_PCREL8_WORD UINT16_C(0x0009)
1904#define IMAGE_REL_SH3_PCREL8_LONG UINT16_C(0x000a)
1905#define IMAGE_REL_SH3_PCREL12_WORD UINT16_C(0x000b)
1906#define IMAGE_REL_SH3_STARTOF_SECTION UINT16_C(0x000c)
1907#define IMAGE_REL_SH3_SIZEOF_SECTION UINT16_C(0x000d)
1908#define IMAGE_REL_SH3_SECTION UINT16_C(0x000e)
1909#define IMAGE_REL_SH3_SECREL UINT16_C(0x000f)
1910#define IMAGE_REL_SH3_DIRECT32_NB UINT16_C(0x0010)
1911#define IMAGE_REL_SH3_GPREL4_LONG UINT16_C(0x0011)
1912#define IMAGE_REL_SH3_TOKEN UINT16_C(0x0012)
1913#define IMAGE_REL_SHM_PCRELPT UINT16_C(0x0013)
1914#define IMAGE_REL_SHM_REFLO UINT16_C(0x0014)
1915#define IMAGE_REL_SHM_REFHALF UINT16_C(0x0015)
1916#define IMAGE_REL_SHM_RELLO UINT16_C(0x0016)
1917#define IMAGE_REL_SHM_RELHALF UINT16_C(0x0017)
1918#define IMAGE_REL_SHM_PAIR UINT16_C(0x0018)
1919#define IMAGE_REL_SHM_NOMODE UINT16_C(0x8000)
1920/** @} */
1921
1922/** @name IMAGE_REL_PPC_XXX - COFF relocations for IBM PowerPC CPUs.
1923 * Used by IMAGE_RELOCATION::Type.
1924 * @{ */
1925#define IMAGE_REL_PPC_ABSOLUTE UINT16_C(0x0000)
1926#define IMAGE_REL_PPC_ADDR64 UINT16_C(0x0001)
1927#define IMAGE_REL_PPC_ADDR32 UINT16_C(0x0002)
1928#define IMAGE_REL_PPC_ADDR24 UINT16_C(0x0003)
1929#define IMAGE_REL_PPC_ADDR16 UINT16_C(0x0004)
1930#define IMAGE_REL_PPC_ADDR14 UINT16_C(0x0005)
1931#define IMAGE_REL_PPC_REL24 UINT16_C(0x0006)
1932#define IMAGE_REL_PPC_REL14 UINT16_C(0x0007)
1933#define IMAGE_REL_PPC_ADDR32NB UINT16_C(0x000a)
1934#define IMAGE_REL_PPC_SECREL UINT16_C(0x000b)
1935#define IMAGE_REL_PPC_SECTION UINT16_C(0x000c)
1936#define IMAGE_REL_PPC_SECREL16 UINT16_C(0x000f)
1937#define IMAGE_REL_PPC_REFHI UINT16_C(0x0010)
1938#define IMAGE_REL_PPC_REFLO UINT16_C(0x0011)
1939#define IMAGE_REL_PPC_PAIR UINT16_C(0x0012)
1940#define IMAGE_REL_PPC_SECRELLO UINT16_C(0x0013)
1941#define IMAGE_REL_PPC_GPREL UINT16_C(0x0015)
1942#define IMAGE_REL_PPC_TOKEN UINT16_C(0x0016)
1943/** @} */
1944
1945/** @name IMAGE_REL_I386_XXX - COFF relocations for x86 CPUs.
1946 * Used by IMAGE_RELOCATION::Type.
1947 * @{ */
1948#define IMAGE_REL_I386_ABSOLUTE UINT16_C(0x0000)
1949#define IMAGE_REL_I386_DIR16 UINT16_C(0x0001)
1950#define IMAGE_REL_I386_REL16 UINT16_C(0x0002)
1951#define IMAGE_REL_I386_DIR32 UINT16_C(0x0006)
1952#define IMAGE_REL_I386_DIR32NB UINT16_C(0x0007)
1953#define IMAGE_REL_I386_SEG12 UINT16_C(0x0009)
1954#define IMAGE_REL_I386_SECTION UINT16_C(0x000A)
1955#define IMAGE_REL_I386_SECREL UINT16_C(0x000B)
1956#define IMAGE_REL_I386_TOKEN UINT16_C(0x000C)
1957#define IMAGE_REL_I386_SECREL7 UINT16_C(0x000D)
1958#define IMAGE_REL_I386_REL32 UINT16_C(0x0014)
1959/** @} */
1960
1961/** @name IMAGE_REL_IA64_XXX - COFF relocations for "Itanic" CPUs.
1962 * @{ */
1963#define IMAGE_REL_IA64_ABSOLUTE UINT16_C(0x0000)
1964#define IMAGE_REL_IA64_IMM14 UINT16_C(0x0001)
1965#define IMAGE_REL_IA64_IMM22 UINT16_C(0x0002)
1966#define IMAGE_REL_IA64_IMM64 UINT16_C(0x0003)
1967#define IMAGE_REL_IA64_DIR32 UINT16_C(0x0004)
1968#define IMAGE_REL_IA64_DIR64 UINT16_C(0x0005)
1969#define IMAGE_REL_IA64_PCREL21B UINT16_C(0x0006)
1970#define IMAGE_REL_IA64_PCREL21M UINT16_C(0x0007)
1971#define IMAGE_REL_IA64_PCREL21F UINT16_C(0x0008)
1972#define IMAGE_REL_IA64_GPREL22 UINT16_C(0x0009)
1973#define IMAGE_REL_IA64_LTOFF22 UINT16_C(0x000a)
1974#define IMAGE_REL_IA64_SECTION UINT16_C(0x000b)
1975#define IMAGE_REL_IA64_SECREL22 UINT16_C(0x000c)
1976#define IMAGE_REL_IA64_SECREL64I UINT16_C(0x000d)
1977#define IMAGE_REL_IA64_SECREL32 UINT16_C(0x000e)
1978#define IMAGE_REL_IA64_DIR32NB UINT16_C(0x0010)
1979#define IMAGE_REL_IA64_SREL14 UINT16_C(0x0011)
1980#define IMAGE_REL_IA64_SREL22 UINT16_C(0x0012)
1981#define IMAGE_REL_IA64_SREL32 UINT16_C(0x0013)
1982#define IMAGE_REL_IA64_UREL32 UINT16_C(0x0014)
1983#define IMAGE_REL_IA64_PCREL60X UINT16_C(0x0015)
1984#define IMAGE_REL_IA64_PCREL60B UINT16_C(0x0016)
1985#define IMAGE_REL_IA64_PCREL60F UINT16_C(0x0017)
1986#define IMAGE_REL_IA64_PCREL60I UINT16_C(0x0018)
1987#define IMAGE_REL_IA64_PCREL60M UINT16_C(0x0019)
1988#define IMAGE_REL_IA64_IMMGPREL64 UINT16_C(0x001a)
1989#define IMAGE_REL_IA64_TOKEN UINT16_C(0x001b)
1990#define IMAGE_REL_IA64_GPREL32 UINT16_C(0x001c)
1991#define IMAGE_REL_IA64_ADDEND UINT16_C(0x001f)
1992/** @} */
1993
1994/** @name IMAGE_REL_MIPS_XXX - COFF relocations for MIPS CPUs.
1995 * Used by IMAGE_RELOCATION::Type.
1996 * @{ */
1997#define IMAGE_REL_MIPS_ABSOLUTE UINT16_C(0x0000)
1998#define IMAGE_REL_MIPS_REFHALF UINT16_C(0x0001)
1999#define IMAGE_REL_MIPS_REFWORD UINT16_C(0x0002)
2000#define IMAGE_REL_MIPS_JMPADDR UINT16_C(0x0003)
2001#define IMAGE_REL_MIPS_REFHI UINT16_C(0x0004)
2002#define IMAGE_REL_MIPS_REFLO UINT16_C(0x0005)
2003#define IMAGE_REL_MIPS_GPREL UINT16_C(0x0006)
2004#define IMAGE_REL_MIPS_LITERAL UINT16_C(0x0007)
2005#define IMAGE_REL_MIPS_SECTION UINT16_C(0x000a)
2006#define IMAGE_REL_MIPS_SECREL UINT16_C(0x000b)
2007#define IMAGE_REL_MIPS_SECRELLO UINT16_C(0x000c)
2008#define IMAGE_REL_MIPS_SECRELHI UINT16_C(0x000d)
2009#define IMAGE_REL_MIPS_JMPADDR16 UINT16_C(0x0010)
2010#define IMAGE_REL_MIPS_REFWORDNB UINT16_C(0x0022)
2011#define IMAGE_REL_MIPS_PAIR UINT16_C(0x0025)
2012/** @} */
2013
2014/** @name IMAGE_REL_M32R_XXX - COFF relocations for Mitsubishi M32R CPUs.
2015 * Used by IMAGE_RELOCATION::Type.
2016 * @{ */
2017#define IMAGE_REL_M32R_ABSOLUTE UINT16_C(0x0000)
2018#define IMAGE_REL_M32R_ADDR32 UINT16_C(0x0001)
2019#define IMAGE_REL_M32R_ADDR32NB UINT16_C(0x0002)
2020#define IMAGE_REL_M32R_ADDR24 UINT16_C(0x0003)
2021#define IMAGE_REL_M32R_GPREL16 UINT16_C(0x0004)
2022#define IMAGE_REL_M32R_PCREL24 UINT16_C(0x0005)
2023#define IMAGE_REL_M32R_PCREL16 UINT16_C(0x0006)
2024#define IMAGE_REL_M32R_PCREL8 UINT16_C(0x0007)
2025#define IMAGE_REL_M32R_REFHALF UINT16_C(0x0008)
2026#define IMAGE_REL_M32R_REFHI UINT16_C(0x0009)
2027#define IMAGE_REL_M32R_REFLO UINT16_C(0x000a)
2028#define IMAGE_REL_M32R_PAIR UINT16_C(0x000b)
2029#define IMAGE_REL_M32R_SECTION UINT16_C(0x000c)
2030#define IMAGE_REL_M32R_SECREL UINT16_C(0x000d)
2031#define IMAGE_REL_M32R_TOKEN UINT16_C(0x000e)
2032/** @} */
2033
2034
2035/** @} */
2036
2037#endif
2038
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette