VirtualBox

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

Last change on this file since 84361 was 84361, checked in by vboxsync, 5 years ago

IPRT/ldrPE: Found three new load config variations. V12 is what the Visual C++ 2019 linker produces and it upset the import validation helper we use for GAs. As usual the offical docs & headers are behind and much of the struct is still undocumented. bugref:8489

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