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