VirtualBox

source: vbox/trunk/include/iprt/formats/pe.mac@ 82968

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

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.2 KB
Line 
1;; @file
2; IPRT - Windows PE definitions for YASM/NASM.
3;
4
5;
6; Copyright (C) 2006-2020 Oracle Corporation
7;
8; This file is part of VirtualBox Open Source Edition (OSE), as
9; available from http://www.virtualbox.org. This file is free software;
10; you can redistribute it and/or modify it under the terms of the GNU
11; General Public License (GPL) as published by the Free Software
12; Foundation, in version 2 as it comes in the "COPYING" file of the
13; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15;
16; The contents of this file may alternatively be used under the terms
17; of the Common Development and Distribution License Version 1.0
18; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19; VirtualBox OSE distribution, in which case the provisions of the
20; CDDL are applicable instead of those of the GPL.
21;
22; You may elect to license modified versions of this file under the
23; terms and conditions of either the GPL or the CDDL or both.
24;
25
26%ifndef ___iprt_format_pe_mac
27%define ___iprt_format_pe_mac
28
29
30;*******************************************************************************
31;* Header Files *
32;*******************************************************************************
33%include "iprt/asmdefs.mac"
34
35
36;*******************************************************************************
37;* Defined Constants And Macros *
38;*******************************************************************************
39%define IMAGE_NT_SIGNATURE 0x00004550
40
41; file header
42%define IMAGE_FILE_MACHINE_I386 0x014c
43%define IMAGE_FILE_MACHINE_AMD64 0x8664
44
45%define IMAGE_FILE_RELOCS_STRIPPED 0x0001
46%define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
47%define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
48%define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
49%define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
50%define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
51%define IMAGE_FILE_16BIT_MACHINE 0x0040
52%define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
53%define IMAGE_FILE_32BIT_MACHINE 0x0100
54%define IMAGE_FILE_DEBUG_STRIPPED 0x0200
55%define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
56%define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
57%define IMAGE_FILE_SYSTEM 0x1000
58%define IMAGE_FILE_DLL 0x2000
59%define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
60%define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
61
62
63; optional header
64%define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10B
65%define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20B
66
67%define IMAGE_SUBSYSTEM_UNKNOWN 0x0
68%define IMAGE_SUBSYSTEM_NATIVE 0x1
69%define IMAGE_SUBSYSTEM_WINDOWS_GUI 0x2
70%define IMAGE_SUBSYSTEM_WINDOWS_CUI 0x3
71%define IMAGE_SUBSYSTEM_OS2_GUI 0x4
72%define IMAGE_SUBSYSTEM_OS2_CUI 0x5
73%define IMAGE_SUBSYSTEM_POSIX_CUI 0x7
74
75%define IMAGE_LIBRARY_PROCESS_INIT 0x0001
76%define IMAGE_LIBRARY_PROCESS_TERM 0x0002
77%define IMAGE_LIBRARY_THREAD_INIT 0x0004
78%define IMAGE_LIBRARY_THREAD_TERM 0x0008
79%define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
80%define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
81%define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
82%define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
83%define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
84
85%define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 0x10
86
87%define IMAGE_DIRECTORY_ENTRY_EXPORT 0x0
88%define IMAGE_DIRECTORY_ENTRY_IMPORT 0x1
89%define IMAGE_DIRECTORY_ENTRY_RESOURCE 0x2
90%define IMAGE_DIRECTORY_ENTRY_EXCEPTION 0x3
91%define IMAGE_DIRECTORY_ENTRY_SECURITY 0x4
92%define IMAGE_DIRECTORY_ENTRY_BASERELOC 0x5
93%define IMAGE_DIRECTORY_ENTRY_DEBUG 0x6
94%define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 0x7
95%define IMAGE_DIRECTORY_ENTRY_COPYRIGHT IMAGE_DIRECTORY_ENTRY_ARCHITECTURE
96%define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 0x8
97%define IMAGE_DIRECTORY_ENTRY_TLS 0x9
98%define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 0xa
99%define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 0xb
100%define IMAGE_DIRECTORY_ENTRY_IAT 0xc
101%define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 0xd
102%define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 0xe
103
104
105; section header
106%define IMAGE_SIZEOF_SHORT_NAME 0x8
107
108%define IMAGE_SCN_TYPE_REG 0x00000000
109%define IMAGE_SCN_TYPE_DSECT 0x00000001
110%define IMAGE_SCN_TYPE_NOLOAD 0x00000002
111%define IMAGE_SCN_TYPE_GROUP 0x00000004
112%define IMAGE_SCN_TYPE_NO_PAD 0x00000008
113%define IMAGE_SCN_TYPE_COPY 0x00000010
114
115%define IMAGE_SCN_CNT_CODE 0x00000020
116%define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
117%define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
118
119%define IMAGE_SCN_LNK_OTHER 0x00000100
120%define IMAGE_SCN_LNK_INFO 0x00000200
121%define IMAGE_SCN_TYPE_OVER 0x00000400
122%define IMAGE_SCN_LNK_REMOVE 0x00000800
123%define IMAGE_SCN_LNK_COMDAT 0x00001000
124%define IMAGE_SCN_MEM_PROTECTED 0x00004000
125%define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000
126%define IMAGE_SCN_GPREL 0x00008000
127%define IMAGE_SCN_MEM_FARDATA 0x00008000
128%define IMAGE_SCN_MEM_SYSHEAP 0x00010000
129%define IMAGE_SCN_MEM_PURGEABLE 0x00020000
130%define IMAGE_SCN_MEM_16BIT 0x00020000
131%define IMAGE_SCN_MEM_LOCKED 0x00040000
132%define IMAGE_SCN_MEM_PRELOAD 0x00080000
133
134%define IMAGE_SCN_ALIGN_1BYTES 0x00100000
135%define IMAGE_SCN_ALIGN_2BYTES 0x00200000
136%define IMAGE_SCN_ALIGN_4BYTES 0x00300000
137%define IMAGE_SCN_ALIGN_8BYTES 0x00400000
138%define IMAGE_SCN_ALIGN_16BYTES 0x00500000
139%define IMAGE_SCN_ALIGN_32BYTES 0x00600000
140%define IMAGE_SCN_ALIGN_64BYTES 0x00700000
141%define IMAGE_SCN_ALIGN_128BYTES 0x00800000
142%define IMAGE_SCN_ALIGN_256BYTES 0x00900000
143%define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
144%define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
145%define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
146%define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
147%define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
148%define IMAGE_SCN_ALIGN_MASK 0x00F00000
149%define IMAGE_SCN_ALIGN_SHIFT 20
150
151%define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
152%define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
153%define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
154%define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
155%define IMAGE_SCN_MEM_SHARED 0x10000000
156%define IMAGE_SCN_MEM_EXECUTE 0x20000000
157%define IMAGE_SCN_MEM_READ 0x40000000
158%define IMAGE_SCN_MEM_WRITE 0x80000000
159
160
161; relocations
162%define IMAGE_REL_BASED_ABSOLUTE 0x0
163%define IMAGE_REL_BASED_HIGH 0x1
164%define IMAGE_REL_BASED_LOW 0x2
165%define IMAGE_REL_BASED_HIGHLOW 0x3
166%define IMAGE_REL_BASED_HIGHADJ 0x4
167%define IMAGE_REL_BASED_MIPS_JMPADDR 0x5
168%define IMAGE_REL_BASED_MIPS_JMPADDR16 0x9
169%define IMAGE_REL_BASED_IA64_IMM64 0x9
170%define IMAGE_REL_BASED_DIR64 0xa
171%define IMAGE_REL_BASED_HIGH3ADJ 0xb
172
173
174; imports
175%define IMAGE_ORDINAL_FLAG32 0x80000000
176%define IMAGE_ORDINAL_FLAG64 UINT64_MAX(0x8000000000000000)
177
178
179; debug dir
180%define IMAGE_DEBUG_TYPE_UNKNOWN UINT32_C(0x0)
181%define IMAGE_DEBUG_TYPE_COFF UINT32_C(0x1)
182%define IMAGE_DEBUG_TYPE_CODEVIEW UINT32_C(0x2)
183%define IMAGE_DEBUG_TYPE_FPO UINT32_C(0x3)
184%define IMAGE_DEBUG_TYPE_MISC UINT32_C(0x4)
185%define IMAGE_DEBUG_TYPE_EXCEPTION UINT32_C(0x5)
186%define IMAGE_DEBUG_TYPE_FIXUP UINT32_C(0x6)
187%define IMAGE_DEBUG_TYPE_OMAP_TO_SRC UINT32_C(0x7)
188%define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC UINT32_C(0x8)
189%define IMAGE_DEBUG_TYPE_BORLAND UINT32_C(0x9)
190%define IMAGE_DEBUG_TYPE_RESERVED10 UINT32_C(0x10)
191
192%define IMAGE_DEBUG_MISC_EXENAME UINT32_C(1)
193
194; security directory
195%define WIN_CERT_REVISION_1_0 UINT16_C(0x0100)
196%define WIN_CERT_REVISION_2_0 UINT16_C(0x0200)
197
198%define WIN_CERT_TYPE_X509 UINT16_C(1)
199%define WIN_CERT_TYPE_PKCS_SIGNED_DATA UINT16_C(2)
200%define WIN_CERT_TYPE_RESERVED_1 UINT16_C(3)
201%define WIN_CERT_TYPE_TS_STACK_SIGNED UINT16_C(4)
202%define WIN_CERT_TYPE_EFI_PKCS115 UINT16_C(0x0ef0)
203%define WIN_CERT_TYPE_EFI_GUID UINT16_C(0x0ef1)
204
205
206; For .DBG files.
207%define IMAGE_SEPARATE_DEBUG_SIGNATURE UINT16_C(0x4944)
208
209%define IMAGE_SIZE_OF_SYMBOL 18
210%define IMAGE_SIZE_OF_SYMBOL_EX 20
211
212%define IMAGE_SYM_UNDEFINED INT16_C(0)
213%define IMAGE_SYM_ABSOLUTE INT16_C(-1)
214%define IMAGE_SYM_DEBUG INT16_C(-2)
215
216%define IMAGE_SYM_CLASS_END_OF_FUNCTION UINT8_C(0xff) ; -1
217%define IMAGE_SYM_CLASS_NULL UINT8_C(0)
218%define IMAGE_SYM_CLASS_AUTOMATIC UINT8_C(1)
219%define IMAGE_SYM_CLASS_EXTERNAL UINT8_C(2)
220%define IMAGE_SYM_CLASS_STATIC UINT8_C(3)
221%define IMAGE_SYM_CLASS_REGISTER UINT8_C(4)
222%define IMAGE_SYM_CLASS_EXTERNAL_DEF UINT8_C(5)
223%define IMAGE_SYM_CLASS_LABEL UINT8_C(6)
224%define IMAGE_SYM_CLASS_UNDEFINED_LABEL UINT8_C(7)
225%define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT UINT8_C(8)
226%define IMAGE_SYM_CLASS_ARGUMENT UINT8_C(9)
227%define IMAGE_SYM_CLASS_STRUCT_TAG UINT8_C(10)
228%define IMAGE_SYM_CLASS_MEMBER_OF_UNION UINT8_C(11)
229%define IMAGE_SYM_CLASS_UNION_TAG UINT8_C(12)
230%define IMAGE_SYM_CLASS_TYPE_DEFINITION UINT8_C(13)
231%define IMAGE_SYM_CLASS_UNDEFINED_STATIC UINT8_C(14)
232%define IMAGE_SYM_CLASS_ENUM_TAG UINT8_C(15)
233%define IMAGE_SYM_CLASS_MEMBER_OF_ENUM UINT8_C(16)
234%define IMAGE_SYM_CLASS_REGISTER_PARAM UINT8_C(17)
235%define IMAGE_SYM_CLASS_BIT_FIELD UINT8_C(18)
236%define IMAGE_SYM_CLASS_FAR_EXTERNAL UINT8_C(68)
237%define IMAGE_SYM_CLASS_BLOCK UINT8_C(100)
238%define IMAGE_SYM_CLASS_FUNCTION UINT8_C(101)
239%define IMAGE_SYM_CLASS_END_OF_STRUCT UINT8_C(102)
240%define IMAGE_SYM_CLASS_FILE UINT8_C(103)
241%define IMAGE_SYM_CLASS_SECTION UINT8_C(104)
242%define IMAGE_SYM_CLASS_WEAK_EXTERNAL UINT8_C(105)
243%define IMAGE_SYM_CLASS_CLR_TOKEN UINT8_C(107)
244
245
246%define IMAGE_SYM_TYPE_NULL UINT16_C(0x0000)
247%define IMAGE_SYM_TYPE_VOID UINT16_C(0x0001)
248%define IMAGE_SYM_TYPE_CHAR UINT16_C(0x0002)
249%define IMAGE_SYM_TYPE_SHORT UINT16_C(0x0003)
250%define IMAGE_SYM_TYPE_INT UINT16_C(0x0004)
251%define IMAGE_SYM_TYPE_LONG UINT16_C(0x0005)
252%define IMAGE_SYM_TYPE_FLOAT UINT16_C(0x0006)
253%define IMAGE_SYM_TYPE_DOUBLE UINT16_C(0x0007)
254%define IMAGE_SYM_TYPE_STRUCT UINT16_C(0x0008)
255%define IMAGE_SYM_TYPE_UNION UINT16_C(0x0009)
256%define IMAGE_SYM_TYPE_ENUM UINT16_C(0x000a)
257%define IMAGE_SYM_TYPE_MOE UINT16_C(0x000b)
258%define IMAGE_SYM_TYPE_BYTE UINT16_C(0x000c)
259%define IMAGE_SYM_TYPE_WORD UINT16_C(0x000d)
260%define IMAGE_SYM_TYPE_UINT UINT16_C(0x000e)
261%define IMAGE_SYM_TYPE_DWORD UINT16_C(0x000f)
262%define IMAGE_SYM_TYPE_PCODE UINT16_C(0x8000)
263
264%define IMAGE_SYM_DTYPE_NULL UINT16_C(0x0)
265%define IMAGE_SYM_DTYPE_POINTER UINT16_C(0x1)
266%define IMAGE_SYM_DTYPE_FUNCTION UINT16_C(0x2)
267%define IMAGE_SYM_DTYPE_ARRAY UINT16_C(0x3)
268
269
270%define N_BTMASK UINT16_C(0x000f)
271%define N_TMASK UINT16_C(0x0030)
272%define N_TMASK1 UINT16_C(0x00c0)
273%define N_TMASK2 UINT16_C(0x00f0)
274%define N_BTSHFT 4
275%define N_TSHIFT 2
276
277
278;*******************************************************************************
279;* Structures and Typedefs *
280;*******************************************************************************
281
282struc IMAGE_FILE_HEADER
283 .Machine resw 1 ;;< 0x00
284 .NumberOfSections resw 1 ;;< 0x02
285 .TimeDateStamp resd 1 ;;< 0x04
286 .PointerToSymbolTable resd 1 ;;< 0x08
287 .NumberOfSymbols resd 1 ;;< 0x0c
288 .SizeOfOptionalHeader resw 1 ;;< 0x10
289 .Characteristics resw 1 ;;< 0x12
290endstruc
291AssertCompileSize(IMAGE_FILE_HEADER, 0x14)
292
293struc IMAGE_DATA_DIRECTORY
294 .VirtualAddress resd 1
295 .Size resd 1
296endstruc
297
298
299struc IMAGE_OPTIONAL_HEADER32
300 .Magic resw 1 ;;< 0x00
301 .MajorLinkerVersion resb 1 ;;< 0x02
302 .MinorLinkerVersion resb 1 ;;< 0x03
303 .SizeOfCode resd 1 ;;< 0x04
304 .SizeOfInitializedData resd 1 ;;< 0x08
305 .SizeOfUninitializedData resd 1 ;;< 0x0c
306 .AddressOfEntryPoint resd 1 ;;< 0x10
307 .BaseOfCode resd 1 ;;< 0x14
308 .BaseOfData resd 1 ;;< 0x18
309 .ImageBase resd 1 ;;< 0x1c
310 .SectionAlignment resd 1 ;;< 0x20
311 .FileAlignment resd 1 ;;< 0x24
312 .MajorOperatingSystemVersion resw 1 ;;< 0x28
313 .MinorOperatingSystemVersion resw 1 ;;< 0x2a
314 .MajorImageVersion resw 1 ;;< 0x2c
315 .MinorImageVersion resw 1 ;;< 0x2e
316 .MajorSubsystemVersion resw 1 ;;< 0x30
317 .MinorSubsystemVersion resw 1 ;;< 0x32
318 .Win32VersionValue resd 1 ;;< 0x34
319 .SizeOfImage resd 1 ;;< 0x38
320 .SizeOfHeaders resd 1 ;;< 0x3c
321 .CheckSum resd 1 ;;< 0x40
322 .Subsystem resw 1 ;;< 0x44
323 .DllCharacteristics resw 1 ;;< 0x46
324 .SizeOfStackReserve resd 1 ;;< 0x48
325 .SizeOfStackCommit resd 1 ;;< 0x4c
326 .SizeOfHeapReserve resd 1 ;;< 0x50
327 .SizeOfHeapCommit resd 1 ;;< 0x54
328 .LoaderFlags resd 1 ;;< 0x58
329 .NumberOfRvaAndSizes resd 1 ;;< 0x5c
330 .DataDirectory resb IMAGE_DATA_DIRECTORY_size * IMAGE_NUMBEROF_DIRECTORY_ENTRIES ;;< 0x60; 0x10*8 = 0x80
331endstruc
332AssertCompileSize(IMAGE_OPTIONAL_HEADER32, 0xe0);
333
334struc IMAGE_OPTIONAL_HEADER64
335 .Magic resw 1 ;;< 0x00
336 .MajorLinkerVersion resb 1 ;;< 0x02
337 .MinorLinkerVersion resb 1 ;;< 0x03
338 .SizeOfCode resd 1 ;;< 0x04
339 .SizeOfInitializedData resd 1 ;;< 0x08
340 .SizeOfUninitializedData resd 1 ;;< 0x0c
341 .AddressOfEntryPoint resd 1 ;;< 0x10
342 .BaseOfCode resd 1 ;;< 0x14
343 .ImageBase resq 1 ;;< 0x18
344 .SectionAlignment resd 1 ;;< 0x20
345 .FileAlignment resd 1 ;;< 0x24
346 .MajorOperatingSystemVersion resw 1 ;;< 0x28
347 .MinorOperatingSystemVersion resw 1 ;;< 0x2a
348 .MajorImageVersion resw 1 ;;< 0x2c
349 .MinorImageVersion resw 1 ;;< 0x2e
350 .MajorSubsystemVersion resw 1 ;;< 0x30
351 .MinorSubsystemVersion resw 1 ;;< 0x32
352 .Win32VersionValue resd 1 ;;< 0x34
353 .SizeOfImage resd 1 ;;< 0x38
354 .SizeOfHeaders resd 1 ;;< 0x3c
355 .CheckSum resd 1 ;;< 0x40
356 .Subsystem resw 1 ;;< 0x44
357 .DllCharacteristics resw 1 ;;< 0x46
358 .SizeOfStackReserve resq 1 ;;< 0x48
359 .SizeOfStackCommit resq 1 ;;< 0x50
360 .SizeOfHeapReserve resq 1 ;;< 0x58
361 .SizeOfHeapCommit resq 1 ;;< 0x60
362 .LoaderFlags resd 1 ;;< 0x68
363 .NumberOfRvaAndSizes resd 1 ;;< 0x6c
364 .DataDirectory resb IMAGE_DATA_DIRECTORY_size * IMAGE_NUMBEROF_DIRECTORY_ENTRIES ;;< 0x70; 0x10*8 = 0x80
365endstruc ; size: 0xf0
366AssertCompileSize(IMAGE_OPTIONAL_HEADER64, 0xf0);
367
368
369struc IMAGE_NT_HEADERS32
370 .Signature resd 1 ;;< 0x00
371 .FileHeader resb IMAGE_FILE_HEADER_size ; ;;< 0x04
372 .OptionalHeader resb IMAGE_OPTIONAL_HEADER32_size ;;< 0x18
373endstruc ; size: 0xf8
374AssertCompileSize(IMAGE_NT_HEADERS32, 0xf8);
375AssertCompileMemberOffset(IMAGE_NT_HEADERS32, FileHeader, 4);
376AssertCompileMemberOffset(IMAGE_NT_HEADERS32, OptionalHeader, 24);
377
378struc IMAGE_NT_HEADERS64
379 .Signature resd 1 ;;< 0x00
380 .FileHeader resb IMAGE_FILE_HEADER_size ;;< 0x04
381 .OptionalHeader resb IMAGE_OPTIONAL_HEADER64_size ;;< 0x18
382endstruc ; size: 0x108
383AssertCompileSize(IMAGE_NT_HEADERS64, 0x108);
384AssertCompileMemberOffset(IMAGE_NT_HEADERS64, FileHeader, 4);
385AssertCompileMemberOffset(IMAGE_NT_HEADERS64, OptionalHeader, 24);
386
387
388struc IMAGE_SECTION_HEADER
389 .Name resb IMAGE_SIZEOF_SHORT_NAME
390 .Misc.VirtualSize resd 1
391 .VirtualAddress resd 1
392 .SizeOfRawData resd 1
393 .PointerToRawData resd 1
394 .PointerToRelocations resd 1
395 .PointerToLinenumbers resd 1
396 .NumberOfRelocations resw 1
397 .NumberOfLinenumbers resw 1
398 .Characteristics resd 1
399endstruc
400%define IMAGE_SECTION_HEADER.Misc.PhysicalAddress IMAGE_SECTION_HEADER.Misc.VirtualSize
401
402
403struc IMAGE_BASE_RELOCATION
404 .VirtualAddress resd 1
405 .SizeOfBlock resd 1
406endstruc
407
408
409struc IMAGE_EXPORT_DIRECTORY
410 .Characteristics resd 1
411 .TimeDateStamp resd 1
412 .MajorVersion resw 1
413 .MinorVersion resw 1
414 .Name resd 1
415 .Base resd 1
416 .NumberOfFunctions resd 1
417 .NumberOfNames resd 1
418 .AddressOfFunctions resd 1
419 .AddressOfNames resd 1
420 .AddressOfNameOrdinals resd 1
421endstruc
422
423
424struc IMAGE_IMPORT_DESCRIPTOR
425 .u.Characteristics resd 1
426 .TimeDateStamp resd 1
427 .ForwarderChain resd 1
428 .Name resd 1
429 .FirstThunk resd 1
430endstruc
431%define IMAGE_IMPORT_DESCRIPTOR.u.OriginalFirstThunk IMAGE_IMPORT_DESCRIPTOR.u.Characteristics
432
433struc IMAGE_IMPORT_BY_NAME
434 .Hint resw 1
435 .Name resb 1
436endstruc
437
438
439struc IMAGE_THUNK_DATA64
440 .u1.ForwarderString resq 1
441endstruc
442%define IMAGE_THUNK_DATA64.u1.Function IMAGE_THUNK_DATA64.u1.ForwarderString
443%define IMAGE_THUNK_DATA64.u1.Ordinal IMAGE_THUNK_DATA64.u1.ForwarderString
444%define IMAGE_THUNK_DATA64.u1.AddressOfData IMAGE_THUNK_DATA64.u1.ForwarderString
445
446struc IMAGE_THUNK_DATA32
447 .u1.ForwarderString resd 1
448endstruc
449%define IMAGE_THUNK_DATA32.u1.Function IMAGE_THUNK_DATA32.u1.ForwarderString
450%define IMAGE_THUNK_DATA32.u1.Ordinal IMAGE_THUNK_DATA32.u1.ForwarderString
451%define IMAGE_THUNK_DATA32.u1.AddressOfData IMAGE_THUNK_DATA32.u1.ForwarderString
452
453
454struc IMAGE_LOAD_CONFIG_DIRECTORY32
455 .Size resd 1
456 .TimeDateStamp resd 1
457 .MajorVersion resw 1
458 .MinorVersion resw 1
459 .GlobalFlagsClear resd 1
460 .GlobalFlagsSet resd 1
461 .CriticalSectionDefaultTimeout resd 1
462 .DeCommitFreeBlockThreshold resd 1
463 .DeCommitTotalFreeThreshold resd 1
464 .LockPrefixTable resd 1
465 .MaximumAllocationSize resd 1
466 .VirtualMemoryThreshold resd 1
467 .ProcessHeapFlags resd 1
468 .ProcessAffinityMask resd 1
469 .CSDVersion resw 1
470 .Reserved1 resw 1
471 .EditList resd 1
472 .SecurityCookie resd 1
473 .SEHandlerTable resd 1
474 .SEHandlerCount resd 1
475endstruc
476
477struc IMAGE_LOAD_CONFIG_DIRECTORY64
478 .Size resd 1
479 .TimeDateStamp resd 1
480 .MajorVersion resw 1
481 .MinorVersion resw 1
482 .GlobalFlagsClear resd 1
483 .GlobalFlagsSet resd 1
484 .CriticalSectionDefaultTimeout resd 1
485 .DeCommitFreeBlockThreshold resq 1
486 .DeCommitTotalFreeThreshold resq 1
487 .LockPrefixTable resq 1
488 .MaximumAllocationSize resq 1
489 .VirtualMemoryThreshold resq 1
490 .ProcessAffinityMask resq 1
491 .ProcessHeapFlags resd 1
492 .CSDVersion resw 1
493 .Reserved1 resw 1
494 .EditList resq 1
495 .SecurityCookie resq 1
496 .SEHandlerTable resq 1
497 .SEHandlerCount resq 1
498endstruc
499
500
501struc IMAGE_DEBUG_DIRECTORY
502 .Characteristics resd 1
503 .TimeDateStamp resd 1
504 .MajorVersion resw 1
505 .MinorVersion resw 1
506 .Type resd 1
507 .SizeOfData resd 1
508 .AddressOfRawData resd 1
509 .PointerToRawData resd 1
510endstruc
511
512struc IMAGE_DEBUG_MISC
513 .DataType resd 1
514 .Length resd 1
515 .Unicode resb 1
516 .Reserved resb 3
517 .Data resb 1
518endstruc
519
520
521struc WIN_CERTIFICATE
522 .dwLength resd 1
523 .wRevision resw 1
524 .wCertificateType resw 1
525 .bCertificate resb 8
526endstruc
527
528;; The header of a .DBG file (NT4).
529struc IMAGE_SEPARATE_DEBUG_HEADER
530 .Signature resw 1 ;;< 0x00
531 .Flags resw 1 ;;< 0x02
532 .Machine resw 1 ;;< 0x04
533 .Characteristics resw 1 ;;< 0x06
534 .TimeDateStamp resd 1 ;;< 0x08
535 .CheckSum resd 1 ;;< 0x0c
536 .ImageBase resd 1 ;;< 0x10
537 .SizeOfImage resd 1 ;;< 0x14
538 .NumberOfSections resd 1 ;;< 0x18
539 .ExportedNamesSize resd 1 ;;< 0x1c
540 .DebugDirectorySize resd 1 ;;< 0x20
541 .SectionAlignment resd 1 ;;< 0x24
542 .Reserved resd 2 ;;< 0x28
543endstruc ; size: 0x30
544AssertCompileSize(IMAGE_SEPARATE_DEBUG_HEADER, 0x30);
545
546
547struc IMAGE_COFF_SYMBOLS_HEADER
548 .NumberOfSymbols resd 1
549 .LvaToFirstSymbol resd 1
550 .NumberOfLinenumbers resd 1
551 .LvaToFirstLinenumber resd 1
552 .RvaToFirstByteOfCode resd 1
553 .RvaToLastByteOfCode resd 1
554 .RvaToFirstByteOfData resd 1
555 .RvaToLastByteOfData resd 1
556endstruc
557AssertCompileSize(IMAGE_COFF_SYMBOLS_HEADER, 0x20);
558
559
560struc IMAGE_LINENUMBER
561 .Type.VirtualAddress resd 1
562 .Linenumber resw 1
563endstruc
564AssertCompileSize(IMAGE_LINENUMBER, 6);
565%define IMAGE_LINENUMBER.Type.SymbolTableIndex IMAGE_LINENUMBER.Type.VirtualAddress
566
567
568;;#pragma pack(2)
569;;struc IMAGE_SYMBOL
570;;{
571;; union
572;; {
573;; uint8_t ShortName[8];
574;; struct
575;; {
576;; .Short resd 1
577;; .Long resd 1
578;; } Name;
579;; uint32_t LongName[2];
580;; } N;
581;;
582;; .Value resd 1
583;; int16_t SectionNumber;
584;; .Type resw 1
585;; .StorageClass resb 1
586;; .NumberOfAuxSymbols resb 1
587;;} IMAGE_SYMBOL;
588;;#pragma pack()
589;;AssertCompileSize(IMAGE_SYMBOL, IMAGE_SIZE_OF_SYMBOL);
590;;
591;;
592;;#pragma pack(2)
593;;typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF
594;;{
595;; .bAuxType resb 1
596;; .bReserved resb 1
597;; .SymbolTableIndex resd 1
598;; uint8_t rgbReserved[12];
599;;} IMAGE_AUX_SYMBOL_TOKEN_DEF;
600;;#pragma pack()
601;;AssertCompileSize(IMAGE_AUX_SYMBOL_TOKEN_DEF, IMAGE_SIZE_OF_SYMBOL);
602;;
603;;
604;;#pragma pack(1)
605;;typedef union _IMAGE_AUX_SYMBOL
606;;{
607;; struct
608;; {
609;; .TagIndex resd 1
610;; union
611;; {
612;; struct
613;; {
614;; .Linenumber resw 1
615;; .Size resw 1
616;; } LnSz;
617;; } Misc;
618;; union
619;; {
620;; struct
621;; {
622;; .PointerToLinenumber resd 1
623;; .PointerToNextFunction resd 1
624;; } Function;
625;; struct
626;; {
627;; uint16_t Dimension[4];
628;; } Array;
629;; } FcnAry;
630;; .TvIndex resw 1
631;; } Sym;
632;;
633;; struct
634;; {
635;; uint8_t Name[IMAGE_SIZE_OF_SYMBOL];
636;; } File;
637;;
638;; struct
639;; {
640;; .Length resd 1
641;; .NumberOfRelocations resw 1
642;; .NumberOfLinenumbers resw 1
643;; .CheckSum resd 1
644;; .Number resw 1
645;; .Selection resb 1
646;; .bReserved resb 1
647;; .HighNumber resw 1
648;; } Section;
649;;
650;; IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef;
651;; struct
652;; {
653;; .crc resd 1
654;; uint8_t rgbReserved[14];
655;; } CRC;
656;;} IMAGE_AUX_SYMBOL;
657;;#pragma pack()
658;;AssertCompileSize(IMAGE_AUX_SYMBOL, IMAGE_SIZE_OF_SYMBOL);
659;;
660;;
661;;
662;;struc IMAGE_SYMBOL_EX
663;;{
664;; union
665;; {
666;; uint8_t ShortName[8];
667;; struct
668;; {
669;; .Short resd 1
670;; .Long resd 1
671;; } Name;
672;; uint32_t LongName[2];
673;; } N;
674;;
675;; .Value resd 1
676;; int32_t SectionNumber; /* The difference from IMAGE_SYMBOL
677;; .Type resw 1
678;; .StorageClass resb 1
679;; .NumberOfAuxSymbols resb 1
680;;} IMAGE_SYMBOL_EX;
681;;AssertCompileSize(IMAGE_SYMBOL_EX, IMAGE_SIZE_OF_SYMBOL_EX);
682;;
683;;
684;;typedef union _IMAGE_AUX_SYMBOL_EX
685;;{
686;; struct
687;; {
688;; .WeakDefaultSymIndex resd 1
689;; .WeakSearchType resd 1
690;; uint8_t rgbReserved[12];
691;; } Sym;
692;;
693;; struct
694;; {
695;; uint8_t Name[IMAGE_SIZE_OF_SYMBOL_EX];
696;; } File;
697;;
698;; struct
699;; {
700;; .Length resd 1
701;; .NumberOfRelocations resw 1
702;; .NumberOfLinenumbers resw 1
703;; .CheckSum resd 1
704;; .Number resw 1
705;; .Selection resb 1
706;; .bReserved resb 1
707;; .HighNumber resw 1
708;; uint8_t rgbReserved[2];
709;; } Section;
710;;
711;; IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef;
712;;
713;; struct
714;; {
715;; .crc resd 1
716;; uint8_t rgbReserved[16];
717;; } CRC;
718;;} IMAGE_AUX_SYMBOL_EX;
719;;AssertCompileSize(IMAGE_AUX_SYMBOL_EX, IMAGE_SIZE_OF_SYMBOL_EX);
720
721%endif
722
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette