VirtualBox

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

Last change on this file since 106061 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

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