10 #undef RZ_BUF_READ_PE_DWORD_AT
14 #define PE_(name) Pe64_##name
15 #define ILT_MASK1 0x8000000000000000LL
16 #define ILT_MASK2 0x7fffffffffffffffLL
20 #define RZ_BUF_READ_PE_DWORD_AT rz_buf_read_le64_at
21 #define PE_DWORD_MAX UT64_MAX
23 #define PE_(name) Pe32_##name
24 #define ILT_MASK1 0x80000000
25 #define ILT_MASK2 0x7fffffff
29 #define RZ_BUF_READ_PE_DWORD_AT rz_buf_read_le32_at
30 #define PE_DWORD_MAX UT32_MAX
33 #ifndef _INCLUDE_RZ_BIN_PE_SPECS_H_
34 #define _INCLUDE_RZ_BIN_PE_SPECS_H_
36 #define PE_NAME_LENGTH 256
37 #define PE_STRING_LENGTH 256
61 #define PE_IMAGE_FILE_TYPE_PE32 0x10b
62 #define PE_IMAGE_FILE_TYPE_PE32PLUS 0x20b
64 #define PE_IMAGE_FILE_MACHINE_UNKNOWN 0x0000
65 #define PE_IMAGE_FILE_MACHINE_ALPHA 0x0184
66 #define PE_IMAGE_FILE_MACHINE_ALPHA64 0x0284
67 #define PE_IMAGE_FILE_MACHINE_AM33 0x01d3
68 #define PE_IMAGE_FILE_MACHINE_AMD64 0x8664
69 #define PE_IMAGE_FILE_MACHINE_ARM 0x01c0
70 #define PE_IMAGE_FILE_MACHINE_ARMNT 0x01c4
71 #define PE_IMAGE_FILE_MACHINE_ARM64 0xaa64
72 #define PE_IMAGE_FILE_MACHINE_AXP64 PE_IMAGE_FILE_MACHINE_ALPHA64
73 #define PE_IMAGE_FILE_MACHINE_CEE 0xc0ee
74 #define PE_IMAGE_FILE_MACHINE_CEF 0x0cef
75 #define PE_IMAGE_FILE_MACHINE_EBC 0x0ebc
76 #define PE_IMAGE_FILE_MACHINE_I386 0x014c
77 #define PE_IMAGE_FILE_MACHINE_IA64 0x0200
78 #define PE_IMAGE_FILE_MACHINE_M32R 0x9041
79 #define PE_IMAGE_FILE_MACHINE_M68K 0x0268
80 #define PE_IMAGE_FILE_MACHINE_MIPS16 0x0266
81 #define PE_IMAGE_FILE_MACHINE_MIPSFPU 0x0366
82 #define PE_IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
83 #define PE_IMAGE_FILE_MACHINE_POWERPC 0x01f0
84 #define PE_IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
85 #define PE_IMAGE_FILE_MACHINE_R10000 0x0168
86 #define PE_IMAGE_FILE_MACHINE_R3000 0x0162
87 #define PE_IMAGE_FILE_MACHINE_R4000 0x0166
88 #define PE_IMAGE_FILE_MACHINE_SH3 0x01a2
89 #define PE_IMAGE_FILE_MACHINE_SH3DSP 0x01a3
90 #define PE_IMAGE_FILE_MACHINE_SH3E 0x01a4
91 #define PE_IMAGE_FILE_MACHINE_SH4 0x01a6
92 #define PE_IMAGE_FILE_MACHINE_SH5 0x01a8
93 #define PE_IMAGE_FILE_MACHINE_THUMB 0x01c2
94 #define PE_IMAGE_FILE_MACHINE_TRICORE 0x0520
95 #define PE_IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
96 #define PE_IMAGE_FILE_MACHINE_RISCV32 0x5032
97 #define PE_IMAGE_FILE_MACHINE_RISCV64 0x5064
98 #define PE_IMAGE_FILE_MACHINE_RISCV128 0x5128
100 #define PE_IMAGE_FILE_RELOCS_STRIPPED 0x0001
101 #define PE_IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
102 #define PE_IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
103 #define PE_IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
104 #define PE_IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010
105 #define PE_IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
106 #define PE_IMAGE_FILE_16BIT_MACHINE 0x0040
107 #define PE_IMAGE_FILE_BYTES_REVERSED_LO 0x0080
108 #define PE_IMAGE_FILE_32BIT_MACHINE 0x0100
109 #define PE_IMAGE_FILE_DEBUG_STRIPPED 0x0200
110 #define PE_IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
111 #define PE_IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
112 #define PE_IMAGE_FILE_SYSTEM 0x1000
113 #define PE_IMAGE_FILE_DLL 0x2000
114 #define PE_IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
115 #define PE_IMAGE_FILE_BYTES_REVERSED_HI 0x8000
117 #define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA 0x0020
118 #define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040
119 #define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080
120 #define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100
121 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
122 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
123 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
124 #define IMAGE_DLLCHARACTERISTICS_APPCONTAINER 0x1000
125 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
126 #define IMAGE_DLLCHARACTERISTICS_GUARD_CF 0x4000
127 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
129 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
130 #define IMAGE_DEBUG_TYPE_MISC 4
142 #define PE_IMAGE_DIRECTORY_ENTRIES 16
143 #define PE_IMAGE_DIRECTORY_ENTRY_EXPORT 0
144 #define PE_IMAGE_DIRECTORY_ENTRY_IMPORT 1
145 #define PE_IMAGE_DIRECTORY_ENTRY_RESOURCE 2
146 #define PE_IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
147 #define PE_IMAGE_DIRECTORY_ENTRY_SECURITY 4
148 #define PE_IMAGE_DIRECTORY_ENTRY_BASERELOC 5
149 #define PE_IMAGE_DIRECTORY_ENTRY_DEBUG 6
150 #define PE_IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
151 #define PE_IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7
152 #define PE_IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
153 #define PE_IMAGE_DIRECTORY_ENTRY_TLS 9
154 #define PE_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
155 #define PE_IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
156 #define PE_IMAGE_DIRECTORY_ENTRY_IAT 12
157 #define PE_IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
158 #define PE_IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
160 #define PE_IMAGE_SUBSYSTEM_UNKNOWN 0
161 #define PE_IMAGE_SUBSYSTEM_NATIVE 1
162 #define PE_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
163 #define PE_IMAGE_SUBSYSTEM_WINDOWS_CUI 3
164 #define PE_IMAGE_SUBSYSTEM_POSIX_CUI 7
165 #define PE_IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
166 #define PE_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
167 #define PE_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
168 #define PE_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
169 #define PE_IMAGE_SUBSYSTEM_EFI_ROM 13
170 #define PE_IMAGE_SUBSYSTEM_XBOX 14
174 #define PE_LANG_NEUTRAL 0x00
175 #define PE_LANG_INVARIANT 0x7f
176 #define PE_LANG_AFRIKAANS 0x36
177 #define PE_LANG_ALBANIAN 0x1c
178 #define PE_LANG_ARABIC 0x01
179 #define PE_LANG_ARMENIAN 0x2b
180 #define PE_LANG_ASSAMESE 0x4d
181 #define PE_LANG_AZERI 0x2c
182 #define PE_LANG_BASQUE 0x2d
183 #define PE_LANG_BELARUSIAN 0x23
184 #define PE_LANG_BENGALI 0x45
185 #define PE_LANG_BULGARIAN 0x02
186 #define PE_LANG_CATALAN 0x03
187 #define PE_LANG_CHINESE 0x04
188 #define PE_LANG_CROATIAN 0x1a
189 #define PE_LANG_CZECH 0x05
190 #define PE_LANG_DANISH 0x06
191 #define PE_LANG_DIVEHI 0x65
192 #define PE_LANG_DUTCH 0x13
193 #define PE_LANG_ENGLISH 0x09
194 #define PE_LANG_ESTONIAN 0x25
195 #define PE_LANG_FAEROESE 0x38
196 #define PE_LANG_FARSI 0x29
197 #define PE_LANG_FINNISH 0x0b
198 #define PE_LANG_FRENCH 0x0c
199 #define PE_LANG_GALICIAN 0x56
200 #define PE_LANG_GEORGIAN 0x37
201 #define PE_LANG_GERMAN 0x07
202 #define PE_LANG_GREEK 0x08
203 #define PE_LANG_GUJARATI 0x47
204 #define PE_LANG_HEBREW 0x0d
205 #define PE_LANG_HINDI 0x39
206 #define PE_LANG_HUNGARIAN 0x0e
207 #define PE_LANG_ICELANDIC 0x0f
208 #define PE_LANG_INDONESIAN 0x21
209 #define PE_LANG_ITALIAN 0x10
210 #define PE_LANG_JAPANESE 0x11
211 #define PE_LANG_KANNADA 0x4b
212 #define PE_LANG_KASHMIRI 0x60
213 #define PE_LANG_KAZAK 0x3f
214 #define PE_LANG_KONKANI 0x57
215 #define PE_LANG_KOREAN 0x12
216 #define PE_LANG_KYRGYZ 0x40
217 #define PE_LANG_LATVIAN 0x26
218 #define PE_LANG_LITHUANIAN 0x27
219 #define PE_LANG_MACEDONIAN 0x2f
220 #define PE_LANG_MALAY 0x3e
221 #define PE_LANG_MALAYALAM 0x4c
222 #define PE_LANG_MANIPURI 0x58
223 #define PE_LANG_MARATHI 0x4e
224 #define PE_LANG_MONGOLIAN 0x50
225 #define PE_LANG_NEPALI 0x61
226 #define PE_LANG_NORWEGIAN 0x14
227 #define PE_LANG_ORIYA 0x48
228 #define PE_LANG_POLISH 0x15
229 #define PE_LANG_PORTUGUESE 0x16
230 #define PE_LANG_PUNJABI 0x46
231 #define PE_LANG_ROMANIAN 0x18
232 #define PE_LANG_RUSSIAN 0x19
233 #define PE_LANG_SANSKRIT 0x4f
234 #define PE_LANG_SERBIAN 0x1a
235 #define PE_LANG_SINDHI 0x59
236 #define PE_LANG_SLOVAK 0x1b
237 #define PE_LANG_SLOVENIAN 0x24
238 #define PE_LANG_SPANISH 0x0a
239 #define PE_LANG_SWAHILI 0x41
240 #define PE_LANG_SWEDISH 0x1d
241 #define PE_LANG_SYRIAC 0x5a
242 #define PE_LANG_TAMIL 0x49
243 #define PE_LANG_TATAR 0x44
244 #define PE_LANG_TELUGU 0x4a
245 #define PE_LANG_THAI 0x1e
246 #define PE_LANG_TURKISH 0x1f
247 #define PE_LANG_UKRAINIAN 0x22
248 #define PE_LANG_URDU 0x20
249 #define PE_LANG_UZBEK 0x43
250 #define PE_LANG_VIETNAMESE 0x2a
251 #define PE_LANG_GAELIC 0x3c
252 #define PE_LANG_MALTESE 0x3a
253 #define PE_LANG_MAORI 0x28
254 #define PE_LANG_RHAETO_ROMANCE 0x17
255 #define PE_LANG_SAAMI 0x3b
256 #define PE_LANG_SORBIAN 0x2e
257 #define PE_LANG_SUTU 0x30
258 #define PE_LANG_TSONGA 0x31
259 #define PE_LANG_TSWANA 0x32
260 #define PE_LANG_VENDA 0x33
261 #define PE_LANG_XHOSA 0x34
262 #define PE_LANG_ZULU 0x35
263 #define PE_LANG_ESPERANTO 0x8f
264 #define PE_LANG_WALON 0x90
265 #define PE_LANG_CORNISH 0x91
266 #define PE_LANG_WELSH 0x92
267 #define PE_LANG_BRETON 0x93
352 #define PE_IMAGE_SIZEOF_SHORT_NAME 8
354 #define PE_IMAGE_SCN_MEM_SHARED 0x10000000
355 #define PE_IMAGE_SCN_MEM_EXECUTE 0x20000000
356 #define PE_IMAGE_SCN_MEM_READ 0x40000000
357 #define PE_IMAGE_SCN_MEM_WRITE 0x80000000
429 #define PE_WIN_CERT_REVISION_1_0 0x0100
430 #define PE_WIN_CERT_REVISION_2_0 0x0200
432 #define PE_WIN_CERT_TYPE_X509 0x0001
433 #define PE_WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
434 #define PE_WIN_CERT_TYPE_RESERVED_1 0x0003
435 #define PE_WIN_CERT_TYPE_TS_STACK_SIGNED 0x0004
509 #define RZ_PE_MAX_RESOURCES 2056
510 #define PE_RESOURCE_ENTRY_CURSOR 1
511 #define PE_RESOURCE_ENTRY_BITMAP 2
512 #define PE_RESOURCE_ENTRY_ICON 3
513 #define PE_RESOURCE_ENTRY_MENU 4
514 #define PE_RESOURCE_ENTRY_DIALOG 5
515 #define PE_RESOURCE_ENTRY_STRING 6
516 #define PE_RESOURCE_ENTRY_FONTDIR 7
517 #define PE_RESOURCE_ENTRY_FONT 8
518 #define PE_RESOURCE_ENTRY_ACCELERATOR 9
519 #define PE_RESOURCE_ENTRY_RCDATA 10
520 #define PE_RESOURCE_ENTRY_MESSAGETABLE 11
521 #define PE_RESOURCE_ENTRY_GROUP_CURSOR 12
522 #define PE_RESOURCE_ENTRY_GROUP_ICON 14
523 #define PE_RESOURCE_ENTRY_VERSION 16
524 #define PE_RESOURCE_ENTRY_DLGINCLUDE 17
525 #define PE_RESOURCE_ENTRY_PLUGPLAY 19
526 #define PE_RESOURCE_ENTRY_VXD 20
527 #define PE_RESOURCE_ENTRY_ANICURSOR 21
528 #define PE_RESOURCE_ENTRY_ANIICON 22
529 #define PE_RESOURCE_ENTRY_HTML 23
530 #define PE_RESOURCE_ENTRY_MANIFEST 24
532 #define STRINGFILEINFO_TEXT "StringFileInfo"
533 #define TRANSLATION_TEXT "Translation"
534 #define VARFILEINFO_TEXT "VarFileInfo"
535 #define VS_VERSION_INFO_TEXT "VS_VERSION_INFO"
537 #define STRINGFILEINFO_TEXT_LEN sizeof(STRINGFILEINFO_TEXT)
538 #define TRANSLATION_TEXT_LEN sizeof(TRANSLATION_TEXT)
539 #define VARFILEINFO_TEXT_LEN sizeof(VARFILEINFO_TEXT)
540 #define VS_VERSION_INFO_TEXT_LEN sizeof(VS_VERSION_INFO_TEXT)
542 #define EIGHT_HEX_DIG_UTF_16_LEN ((8 + 1) * 2)
544 #define STRINGFILEINFO_UTF_16 "S\0t\0r\0i\0n\0g\0F\0i\0l\0e\0I\0n\0f\0o\0\0"
545 #define TRANSLATION_UTF_16 "T\0r\0a\0n\0s\0l\0a\0t\0i\0o\0n\0\0"
546 #define VARFILEINFO_UTF_16 "V\0a\0r\0F\0i\0l\0e\0I\0n\0f\0o\0\0"
547 #define VS_VERSION_INFO_UTF_16 "V\0S\0_\0V\0E\0R\0S\0I\0O\0N\0_\0I\0N\0F\0O\0\0"
549 #define STRINGFILEINFO_UTF_16_LEN sizeof(STRINGFILEINFO_UTF_16)
550 #define TRANSLATION_UTF_16_LEN sizeof(TRANSLATION_UTF_16)
551 #define VARFILEINFO_UTF_16_LEN sizeof(VARFILEINFO_UTF_16)
552 #define VS_VERSION_INFO_UTF_16_LEN sizeof(VS_VERSION_INFO_UTF_16)
607 #define PE_VS_FF_DEBUG 0x00000001L
608 #define PE_VS_FF_PRERELEASE 0x00000002L
609 #define PE_VS_FF_PATCHED 0x00000004L
610 #define PE_VS_FF_PRIVATEBUILD 0x00000008L
611 #define PE_VS_FF_INFOINFERRED 0x00000010L
612 #define PE_VS_FF_SPECIALBUILD 0x00000020L
614 #define PE_VOS_DOS 0x00010000L
615 #define PE_VOS_NT 0x00040000L
616 #define PE_VOS__WINDOWS16 0x00000001L
617 #define PE_VOS__WINDOWS32 0x00000004L
618 #define PE_VOS_OS216 0x00020000L
619 #define PE_VOS_OS232 0x00030000L
620 #define PE_VOS__PM16 0x00000002L
621 #define PE_VOS__PM32 0x00000003L
622 #define PE_VOS_UNKNOWN 0x00000000L
624 #define PE_VOS_DOS_WINDOWS16 0x00010001L
625 #define PE_VOS_DOS_WINDOWS32 0x00010004L
626 #define PE_VOS_NT_WINDOWS32 0x00040004L
627 #define PE_VOS_OS216_PM16 0x00020002L
628 #define PE_VOS_OS232_PM32 0x00030003L
630 #define PE_VFT_APP 0x00000001L
631 #define PE_VFT_DLL 0x00000002L
632 #define PE_VFT_DRV 0x00000003L
633 #define PE_VFT_FONT 0x00000004L
634 #define PE_VFT_STATIC_LIB 0x00000007L
635 #define PE_VFT_UNKNOWN 0x00000000L
636 #define PE_VFT_VXD 0x00000005L
638 #define PE_VFT2_DRV_COMM 0x0000000AL
639 #define PE_VFT2_DRV_DISPLAY 0x00000004L
640 #define PE_VFT2_DRV_INSTALLABLE 0x00000008L
641 #define PE_VFT2_DRV_KEYBOARD 0x00000002L
642 #define PE_VFT2_DRV_LANGUAGE 0x00000003L
643 #define PE_VFT2_DRV_MOUSE 0x00000005L
644 #define PE_VFT2_DRV_NETWORK 0x00000006L
645 #define PE_VFT2_DRV_PRINTER 0x00000001L
646 #define PE_VFT2_DRV_SOUND 0x00000009L
647 #define PE_VFT2_DRV_SYSTEM 0x00000007L
648 #define PE_VFT2_DRV_VERSIONED_PRINTER 0x0000000CL
649 #define PE_VFT2_UNKNOWN 0x00000000L
651 #define PE_VFT2_FONT_RASTER 0x00000001L
652 #define PE_VFT2_FONT_TRUETYPE 0x00000003L
653 #define PE_VFT2_FONT_VECTOR 0x00000002L
654 #define PE_VFT2_UNKNOWN 0x00000000L
700 #define PE64_UNW_FLAG_NHANDLER 0
701 #define PE64_UNW_FLAG_EHANDLER 1
702 #define PE64_UNW_FLAG_UHANDLER 2
703 #define PE64_UNW_FLAG_CHAININFO 4
#define header(is_bt, len_min, ret_op)
void Pe64_write_image_section_header(RzBuffer *b, ut64 addr, Pe64_image_section_header *section_header)
#define PE_IMAGE_SIZEOF_SHORT_NAME
struct Pe32_image_file_header Pe64_image_file_header
bool Pe32_read_image_section_header(RzBuffer *b, ut64 addr, Pe32_image_section_header *section_header)
struct Pe32_image_data_directory Pe64_image_data_directory
struct Pe32_image_section_header Pe64_image_section_header
bool Pe32_read_dos_header(RzBuffer *buf, Pe32_image_dos_header *header)
bool Pe32_read_nt_headers(RzBuffer *buf, ut64 addr, Pe32_image_nt_headers *headers)
bool Pe64_read_image_section_header(RzBuffer *b, ut64 addr, Pe64_image_section_header *section_header)
bool Pe64_read_dos_header(RzBuffer *buf, Pe64_image_dos_header *header)
struct Pe32_image_import_directory Pe64_image_import_directory
struct Pe32_image_delay_import_directory Pe64_image_delay_import_directory
void Pe32_write_image_section_header(RzBuffer *b, ut64 addr, Pe32_image_section_header *section_header)
struct Pe32_image_export_directory Pe64_image_export_directory
#define PE_IMAGE_DIRECTORY_ENTRIES
struct Pe32_image_dos_header Pe64_image_dos_header
bool Pe64_read_nt_headers(RzBuffer *buf, ut64 addr, Pe64_image_nt_headers *headers)
struct Pe32_image_debug_directory_entry Pe64_image_debug_directory_entry
struct Pe32_image_tls_directory Pe64_image_tls_directory
VarFileInfo * varFileInfo
StringFileInfo * stringFileInfo
PE_VS_FIXEDFILEINFO * Value
ut32 UnloadDelayImportTable
ut32 BoundDelayImportTable
ut32 DelayImportAddressTable
ut32 DelayImportNameTable
ut32 StartAddressOfRawData
ut16 NumberOfNamedEntries
Pe_certificate ** certificates
ut64(WINAPI *w32_GetEnabledXStateFeatures)()