12 #ifndef _INCLUDE_RZ_BIN_PE_H_
13 #define _INCLUDE_RZ_BIN_PE_H_
15 #define PE_READ_STRUCT_FIELD(var, struct_type, field, size) var->field = rz_read_le##size(buf + offsetof(struct_type, field))
17 #define RZ_BIN_PE_SCN_IS_SHAREABLE(x) x &PE_IMAGE_SCN_MEM_SHARED
18 #define RZ_BIN_PE_SCN_IS_EXECUTABLE(x) x &PE_IMAGE_SCN_MEM_EXECUTE
19 #define RZ_BIN_PE_SCN_IS_READABLE(x) x &PE_IMAGE_SCN_MEM_READ
20 #define RZ_BIN_PE_SCN_IS_WRITABLE(x) x &PE_IMAGE_SCN_MEM_WRITE
23 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008
24 #define IMAGE_SCN_CNT_CODE 0x00000020
25 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
26 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
27 #define IMAGE_SCN_LNK_OTHER 0x00000100
28 #define IMAGE_SCN_LNK_INFO 0x00000200
29 #define IMAGE_SCN_LNK_REMOVE 0x00000800
30 #define IMAGE_SCN_LNK_COMDAT 0x00001000
31 #define IMAGE_SCN_GPREL 0x00008000
32 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
33 #define IMAGE_SCN_MEM_16BIT 0x00020000
34 #define IMAGE_SCN_MEM_LOCKED 0x00040000
35 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
36 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
37 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
38 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
39 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
40 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000
41 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
42 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
43 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
44 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
45 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
46 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
47 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
48 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
49 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
50 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
51 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
52 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
53 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
55 #define PE_SCN_ALIGN_MASK 0x00F00000
116 #define GUIDSTR_LEN 41
117 #define DBG_FILE_NAME_LEN 255
126 #define RzBinPEObj struct PE_(rz_bin_pe_obj_t)
127 struct PE_(rz_bin_pe_obj_t) {
129 PE_(image_dos_header) * dos_header;
130 PE_(image_nt_headers) * nt_headers;
131 PE_(image_optional_header) * optional_header;
132 PE_(image_data_directory) * data_directory;
133 PE_(image_section_header) * section_header;
134 PE_(image_export_directory) * export_directory;
135 PE_(image_import_directory) * import_directory;
136 PE_(image_tls_directory) * tls_directory;
138 PE_(image_delay_import_directory) * delay_import_directory;
147 ut64 rich_header_offset;
148 ut64 nt_header_offset;
149 ut64 section_header_offset;
150 ut64 import_directory_offset;
151 ut64 export_directory_offset;
152 ut64 resource_directory_offset;
153 ut64 delay_import_directory_offset;
155 int import_directory_size;
170 bool is_authhash_valid;
175 #define MAX_METADATA_STRING_LENGTH 256
176 #define COFF_SYMBOL_SIZE 18
177 #define PE_READ_STRUCT_FIELD(var, struct_type, field, size) var->field = rz_read_le##size(buf + offsetof(struct_type, field))
RzList * sections(RzBinFile *bf)
RzList * relocs(RzBinFile *bf)
static ut64 rva(RzBinObject *o, ut64 paddr, ut64 vaddr, int va)
int PE_() rz_bin_pe_is_stripped_debug(RzBinPEObj *bin)
struct rz_bin_pe_addr_t *PE_() check_unknow(RzBinPEObj *bin)
int PE_() rz_bin_pe_get_image_size(RzBinPEObj *bin)
int PE_() rz_bin_pe_get_debug_data(RzBinPEObj *bin, SDebugInfo *res)
PE_DWord PE_() bin_pe_va_to_rva(RzBinPEObj *bin, PE_DWord va)
struct rz_bin_pe_export_t *PE_() rz_bin_pe_get_exports(RzBinPEObj *bin)
ut64 PE_() rz_bin_pe_get_clr_methoddef_offset(RzBinPEObj *bin, Pe_image_metadata_methoddef *methoddef)
int PE_() rz_bin_pe_is_big_endian(RzBinPEObj *bin)
struct rz_bin_pe_addr_t *PE_() rz_bin_pe_get_main_vaddr(RzBinPEObj *bin)
void PE_() rz_bin_pe_check_sections(RzBinPEObj *bin, struct rz_bin_pe_section_t **sects)
int PE_() bin_pe_init_tls(RzBinPEObj *bin)
RzList *PE_() section_flag_to_rzlist(ut64 flag)
int PE_() bin_pe_init_overlay(RzBinPEObj *bin)
struct rz_bin_pe_addr_t *PE_() rz_bin_pe_get_entrypoint(RzBinPEObj *bin)
int PE_() rz_bin_pe_is_stripped_local_syms(RzBinPEObj *bin)
char *PE_() bin_pe_compute_authentihash(RzBinPEObj *bin)
int PE_() read_image_delay_import_directory(RzBuffer *b, ut64 addr, PE_(image_delay_import_directory) *directory)
int PE_() bin_pe_init_exports(RzBinPEObj *bin)
char *PE_() rz_bin_pe_get_subsystem(RzBinPEObj *bin)
char *PE_() rz_bin_pe_get_machine(RzBinPEObj *bin)
char *PE_() rz_bin_pe_get_arch(RzBinPEObj *bin)
struct PE_(rz_bin_pe_obj_t)
void *PE_() rz_bin_pe_free(RzBinPEObj *bin)
#define DBG_FILE_NAME_LEN
int PE_() read_image_import_directory(RzBuffer *b, ut64 addr, PE_(image_import_directory) *import_dir)
int PE_() bin_pe_get_claimed_checksum(RzBinPEObj *bin)
int PE_() bin_pe_init_security(RzBinPEObj *bin)
struct rz_bin_pe_import_t *PE_() rz_bin_pe_get_imports(RzBinPEObj *bin)
int PE_() bin_pe_init_imports(RzBinPEObj *bin)
struct rz_bin_pe_lib_t *PE_() rz_bin_pe_get_libs(RzBinPEObj *bin)
struct SDebugInfo SDebugInfo
int PE_() bin_pe_get_actual_checksum(RzBinPEObj *bin)
void PE_() bin_pe_init_rich_info(RzBinPEObj *bin)
RZ_API void PE_() bin_pe_parse_resource(RzBinPEObj *bin)
PE_DWord PE_() bin_pe_rva_to_paddr(RzBinPEObj *bin, PE_DWord rva)
RZ_OWN RzList *PE_() rz_bin_pe_get_clr_symbols(RzBinPEObj *bin)
ut64 PE_() rz_bin_pe_get_image_base(RzBinPEObj *bin)
char *PE_() rz_bin_pe_get_cc(RzBinPEObj *bin)
int PE_() bin_pe_init_clr(RzBinPEObj *bin)
void PE_() free_security_directory(Pe_image_security_directory *security_directory)
int PE_() bin_pe_init_hdr(RzBinPEObj *bin)
int PE_() bin_pe_init_sections(RzBinPEObj *bin)
RzBinPEObj *PE_() rz_bin_pe_new_buf(RzBuffer *buf, bool verbose)
struct _PE_RESOURCE rz_pe_resource
int PE_() rz_bin_pe_is_stripped_relocs(RzBinPEObj *bin)
char *PE_() rz_bin_pe_get_os(RzBinPEObj *bin)
char *PE_() rz_bin_pe_get_class(RzBinPEObj *bin)
RzBinPEObj *PE_() rz_bin_pe_new(const char *file, bool verbose)
int PE_() rz_bin_pe_is_dll(RzBinPEObj *bin)
struct rz_bin_pe_addr_t *PE_() check_msvcseh(RzBinPEObj *bin)
int PE_() bin_pe_init_resource(RzBinPEObj *bin)
PE_DWord PE_() bin_pe_rva_to_va(RzBinPEObj *bin, PE_DWord rva)
int PE_() rz_bin_pe_get_bits(RzBinPEObj *bin)
int PE_() bin_pe_is_authhash_valid(RzBinPEObj *bin)
int PE_() rz_bin_pe_is_stripped_line_nums(RzBinPEObj *bin)
const char *PE_() bin_pe_get_authentihash(RzBinPEObj *bin)
int PE_() bin_pe_get_overlay(RzBinPEObj *bin, ut64 *size)
struct rz_bin_pe_section_t *PE_() rz_bin_pe_get_sections(RzBinPEObj *bin)
struct rz_bin_pe_addr_t *PE_() check_mingw(RzBinPEObj *bin)
#define PE_IMAGE_SIZEOF_SHORT_NAME
char file_name[DBG_FILE_NAME_LEN]
char guidstr[GUIDSTR_LEN]
Pe_image_resource_data_entry * data
ut8 forwarder[PE_NAME_LENGTH+1]
ut8 libname[PE_NAME_LENGTH+1]
ut8 libname[PE_NAME_LENGTH+1]
ut64(WINAPI *w32_GetEnabledXStateFeatures)()