VirtualBox

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

Last change on this file since 106636 was 106636, checked in by vboxsync, 5 weeks ago

SUPDrv: Making it build on win.arm64... jiraref:VBP-1253

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