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