diff options
author | midipix <writeonce@midipix.org> | 2016-12-01 06:12:09 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-01 08:00:30 -0500 |
commit | 6e18ffe43809e43af86bbad8f46fcb1a428cb12a (patch) | |
tree | b76530b4fce355bb0520b2a918887d53502e40ce | |
parent | 9273055ccc18c5815e6f74c7adbac0bff1c2f7ae (diff) | |
download | pemagine-6e18ffe43809e43af86bbad8f46fcb1a428cb12a.tar.bz2 pemagine-6e18ffe43809e43af86bbad8f46fcb1a428cb12a.tar.xz |
struct pe_raw_opt_hdr_{32|64}: member name normalization.
-rw-r--r-- | include/pemagine/pe_structs.h | 182 | ||||
-rw-r--r-- | src/headers/pe_get_image_data_dirs_addr.c | 4 | ||||
-rw-r--r-- | src/headers/pe_get_image_entry_point_addr.c | 4 | ||||
-rw-r--r-- | src/headers/pe_get_image_section_tbl_addr.c | 2 | ||||
-rw-r--r-- | src/meta/pe_get_image_stack_heap_info.c | 16 |
5 files changed, 104 insertions, 104 deletions
diff --git a/include/pemagine/pe_structs.h b/include/pemagine/pe_structs.h index a465ef5..64a6a70 100644 --- a/include/pemagine/pe_structs.h +++ b/include/pemagine/pe_structs.h @@ -119,101 +119,101 @@ struct pe_raw_data_dirs { }; struct pe_raw_opt_hdr_32 { - unsigned char magic [0x02]; /* 0x00 */ - unsigned char major_linker_ver [0x01]; /* 0x02 */ - unsigned char minor_linker_ver [0x01]; /* 0x03 */ - unsigned char size_of_code [0x04]; /* 0x04 */ - unsigned char size_of_initialized_data [0x04]; /* 0x08 */ - unsigned char size_of_uninitialized_data [0x04]; /* 0x0c */ - unsigned char entry_point [0x04]; /* 0x10 */ - unsigned char base_of_code [0x04]; /* 0x14 */ - unsigned char base_of_data [0x04]; /* 0x18 */ - unsigned char image_base [0x04]; /* 0x1c */ - unsigned char section_align [0x04]; /* 0x20 */ - unsigned char file_align [0x04]; /* 0x24 */ - unsigned char major_os_ver [0x02]; /* 0x28 */ - unsigned char minor_os_ver [0x02]; /* 0x2a */ - unsigned char major_image_ver [0x02]; /* 0x2c */ - unsigned char minor_image_ver [0x02]; /* 0x2e */ - unsigned char major_subsys_ver [0x02]; /* 0x30 */ - unsigned char minor_subsys_ver [0x02]; /* 0x32 */ - unsigned char win32_ver [0x04]; /* 0x34 */ - unsigned char size_of_image [0x04]; /* 0x38 */ - unsigned char size_of_headers [0x04]; /* 0x3c */ - unsigned char checksum [0x04]; /* 0x40 */ - unsigned char subsystem [0x02]; /* 0x44 */ - unsigned char dll_characteristics [0x02]; /* 0x46 */ - unsigned char size_of_stack_reserve [0x04]; /* 0x48 */ - unsigned char size_of_stack_commit [0x04]; /* 0x4c */ - unsigned char size_of_heap_reserve [0x04]; /* 0x50 */ - unsigned char size_of_heap_commit [0x04]; /* 0x54 */ - unsigned char loader_flags [0x04]; /* 0x58 */ - unsigned char rva_and_sizes [0x04]; /* 0x5c */ - unsigned char export_tbl [0x08]; /* 0x60 */ - unsigned char import_tbl [0x08]; /* 0x68 */ - unsigned char resource_tbl [0x08]; /* 0x70 */ - unsigned char exception_tbl [0x08]; /* 0x78 */ - unsigned char certificate_tbl [0x08]; /* 0x80 */ - unsigned char base_reloc_tbl [0x08]; /* 0x88 */ - unsigned char debug [0x08]; /* 0x90 */ - unsigned char arch [0x08]; /* 0x98 */ - unsigned char global_ptr [0x08]; /* 0xa0 */ - unsigned char tls_tbl [0x08]; /* 0xa8 */ - unsigned char load_config_tbl [0x08]; /* 0xb0 */ - unsigned char bound_import [0x08]; /* 0xb8 */ - unsigned char iat [0x08]; /* 0xc0 */ - unsigned char delay_import_descriptor [0x08]; /* 0xc8 */ - unsigned char clr_runtime_hdr [0x08]; /* 0xd0 */ - unsigned char reserved [0x08]; /* 0xd8 */ + unsigned char coh_magic [0x02]; /* 0x00 */ + unsigned char coh_major_linker_ver [0x01]; /* 0x02 */ + unsigned char coh_minor_linker_ver [0x01]; /* 0x03 */ + unsigned char coh_size_of_code [0x04]; /* 0x04 */ + unsigned char coh_size_of_inited_data [0x04]; /* 0x08 */ + unsigned char coh_size_of_uninited_data [0x04]; /* 0x0c */ + unsigned char coh_entry_point [0x04]; /* 0x10 */ + unsigned char coh_base_of_code [0x04]; /* 0x14 */ + unsigned char coh_base_of_data [0x04]; /* 0x18 */ + unsigned char coh_image_base [0x04]; /* 0x1c */ + unsigned char coh_section_align [0x04]; /* 0x20 */ + unsigned char coh_file_align [0x04]; /* 0x24 */ + unsigned char coh_major_os_ver [0x02]; /* 0x28 */ + unsigned char coh_minor_os_ver [0x02]; /* 0x2a */ + unsigned char coh_major_image_ver [0x02]; /* 0x2c */ + unsigned char coh_minor_image_ver [0x02]; /* 0x2e */ + unsigned char coh_major_subsys_ver [0x02]; /* 0x30 */ + unsigned char coh_minor_subsys_ver [0x02]; /* 0x32 */ + unsigned char coh_win32_ver [0x04]; /* 0x34 */ + unsigned char coh_size_of_image [0x04]; /* 0x38 */ + unsigned char coh_size_of_headers [0x04]; /* 0x3c */ + unsigned char coh_checksum [0x04]; /* 0x40 */ + unsigned char coh_subsystem [0x02]; /* 0x44 */ + unsigned char coh_dll_characteristics [0x02]; /* 0x46 */ + unsigned char coh_size_of_stack_reserve [0x04]; /* 0x48 */ + unsigned char coh_size_of_stack_commit [0x04]; /* 0x4c */ + unsigned char coh_size_of_heap_reserve [0x04]; /* 0x50 */ + unsigned char coh_size_of_heap_commit [0x04]; /* 0x54 */ + unsigned char coh_loader_flags [0x04]; /* 0x58 */ + unsigned char coh_rva_and_sizes [0x04]; /* 0x5c */ + unsigned char coh_export_tbl [0x08]; /* 0x60 */ + unsigned char coh_import_tbl [0x08]; /* 0x68 */ + unsigned char coh_resource_tbl [0x08]; /* 0x70 */ + unsigned char coh_exception_tbl [0x08]; /* 0x78 */ + unsigned char coh_certificate_tbl [0x08]; /* 0x80 */ + unsigned char coh_base_reloc_tbl [0x08]; /* 0x88 */ + unsigned char coh_debug [0x08]; /* 0x90 */ + unsigned char coh_arch [0x08]; /* 0x98 */ + unsigned char coh_global_ptr [0x08]; /* 0xa0 */ + unsigned char coh_tls_tbl [0x08]; /* 0xa8 */ + unsigned char coh_load_config_tbl [0x08]; /* 0xb0 */ + unsigned char coh_bound_import [0x08]; /* 0xb8 */ + unsigned char coh_iat [0x08]; /* 0xc0 */ + unsigned char coh_delay_import_descriptor [0x08]; /* 0xc8 */ + unsigned char coh_clr_runtime_hdr [0x08]; /* 0xd0 */ + unsigned char coh_reserved [0x08]; /* 0xd8 */ }; struct pe_raw_opt_hdr_64 { - unsigned char magic [0x02]; /* 0x00 */ - unsigned char major_linker_ver [0x01]; /* 0x02 */ - unsigned char minor_linker_ver [0x01]; /* 0x03 */ - unsigned char size_of_code [0x04]; /* 0x04 */ - unsigned char size_of_initialized_data [0x04]; /* 0x08 */ - unsigned char size_of_uninitialized_data [0x04]; /* 0x0c */ - unsigned char entry_point [0x04]; /* 0x10 */ - unsigned char base_of_code [0x04]; /* 0x14 */ - unsigned char image_base [0x08]; /* 0x18 */ - unsigned char section_align [0x04]; /* 0x20 */ - unsigned char file_align [0x04]; /* 0x24 */ - unsigned char major_os_ver [0x02]; /* 0x28 */ - unsigned char minor_os_ver [0x02]; /* 0x2a */ - unsigned char major_image_ver [0x02]; /* 0x2c */ - unsigned char minor_image_ver [0x02]; /* 0x2e */ - unsigned char major_subsys_ver [0x02]; /* 0x30 */ - unsigned char minor_subsys_ver [0x02]; /* 0x32 */ - unsigned char win32_ver [0x04]; /* 0x34 */ - unsigned char size_of_image [0x04]; /* 0x38 */ - unsigned char size_of_headers [0x04]; /* 0x3c */ - unsigned char checksum [0x04]; /* 0x40 */ - unsigned char subsystem [0x02]; /* 0x44 */ - unsigned char dll_characteristics [0x02]; /* 0x46 */ - unsigned char size_of_stack_reserve [0x08]; /* 0x48 */ - unsigned char size_of_stack_commit [0x08]; /* 0x50 */ - unsigned char size_of_heap_reserve [0x08]; /* 0x58 */ - unsigned char size_of_heap_commit [0x08]; /* 0x60 */ - unsigned char loader_flags [0x04]; /* 0x68 */ - unsigned char rva_and_sizes [0x04]; /* 0x6c */ - unsigned char export_tbl [0x08]; /* 0x70 */ - unsigned char import_tbl [0x08]; /* 0x78 */ - unsigned char resource_tbl [0x08]; /* 0x80 */ - unsigned char exception_tbl [0x08]; /* 0x88 */ - unsigned char certificate_tbl [0x08]; /* 0x90 */ - unsigned char base_reloc_tbl [0x08]; /* 0x98 */ - unsigned char debug [0x08]; /* 0xa0 */ - unsigned char arch [0x08]; /* 0xa8 */ - unsigned char global_ptr [0x08]; /* 0xb0 */ - unsigned char tls_tbl [0x08]; /* 0xb8 */ - unsigned char load_config_tbl [0x08]; /* 0xc0 */ - unsigned char bound_import [0x08]; /* 0xc8 */ - unsigned char iat [0x08]; /* 0xd0 */ - unsigned char delay_import_descriptor [0x08]; /* 0xd8 */ - unsigned char clr_runtime_hdr [0x08]; /* 0xe0 */ - unsigned char reserved [0x08]; /* 0xe8 */ + unsigned char coh_magic [0x02]; /* 0x00 */ + unsigned char coh_major_linker_ver [0x01]; /* 0x02 */ + unsigned char coh_minor_linker_ver [0x01]; /* 0x03 */ + unsigned char coh_size_of_code [0x04]; /* 0x04 */ + unsigned char coh_size_of_inited_data [0x04]; /* 0x08 */ + unsigned char coh_size_of_uninited_data [0x04]; /* 0x0c */ + unsigned char coh_entry_point [0x04]; /* 0x10 */ + unsigned char coh_base_of_code [0x04]; /* 0x14 */ + unsigned char coh_image_base [0x08]; /* 0x18 */ + unsigned char coh_section_align [0x04]; /* 0x20 */ + unsigned char coh_file_align [0x04]; /* 0x24 */ + unsigned char coh_major_os_ver [0x02]; /* 0x28 */ + unsigned char coh_minor_os_ver [0x02]; /* 0x2a */ + unsigned char coh_major_image_ver [0x02]; /* 0x2c */ + unsigned char coh_minor_image_ver [0x02]; /* 0x2e */ + unsigned char coh_major_subsys_ver [0x02]; /* 0x30 */ + unsigned char coh_minor_subsys_ver [0x02]; /* 0x32 */ + unsigned char coh_win32_ver [0x04]; /* 0x34 */ + unsigned char coh_size_of_image [0x04]; /* 0x38 */ + unsigned char coh_size_of_headers [0x04]; /* 0x3c */ + unsigned char coh_checksum [0x04]; /* 0x40 */ + unsigned char coh_subsystem [0x02]; /* 0x44 */ + unsigned char coh_dll_characteristics [0x02]; /* 0x46 */ + unsigned char coh_size_of_stack_reserve [0x08]; /* 0x48 */ + unsigned char coh_size_of_stack_commit [0x08]; /* 0x50 */ + unsigned char coh_size_of_heap_reserve [0x08]; /* 0x58 */ + unsigned char coh_size_of_heap_commit [0x08]; /* 0x60 */ + unsigned char coh_loader_flags [0x04]; /* 0x68 */ + unsigned char coh_rva_and_sizes [0x04]; /* 0x6c */ + unsigned char coh_export_tbl [0x08]; /* 0x70 */ + unsigned char coh_import_tbl [0x08]; /* 0x78 */ + unsigned char coh_resource_tbl [0x08]; /* 0x80 */ + unsigned char coh_exception_tbl [0x08]; /* 0x88 */ + unsigned char coh_certificate_tbl [0x08]; /* 0x90 */ + unsigned char coh_base_reloc_tbl [0x08]; /* 0x98 */ + unsigned char coh_debug [0x08]; /* 0xa0 */ + unsigned char coh_arch [0x08]; /* 0xa8 */ + unsigned char coh_global_ptr [0x08]; /* 0xb0 */ + unsigned char coh_tls_tbl [0x08]; /* 0xb8 */ + unsigned char coh_load_config_tbl [0x08]; /* 0xc0 */ + unsigned char coh_bound_import [0x08]; /* 0xc8 */ + unsigned char coh_iat [0x08]; /* 0xd0 */ + unsigned char coh_delay_import_descriptor [0x08]; /* 0xd8 */ + unsigned char coh_clr_runtime_hdr [0x08]; /* 0xe0 */ + unsigned char coh_reserved [0x08]; /* 0xe8 */ }; diff --git a/src/headers/pe_get_image_data_dirs_addr.c b/src/headers/pe_get_image_data_dirs_addr.c index aa55245..2edde04 100644 --- a/src/headers/pe_get_image_data_dirs_addr.c +++ b/src/headers/pe_get_image_data_dirs_addr.c @@ -22,10 +22,10 @@ struct pe_raw_data_dirs * pe_get_image_data_dirs_addr(const void * base) switch (*magic) { case PE_MAGIC_PE32: - return (struct pe_raw_data_dirs *)hdr->opt_hdr_32.rva_and_sizes; + return (struct pe_raw_data_dirs *)hdr->opt_hdr_32.coh_rva_and_sizes; case PE_MAGIC_PE32_PLUS: - return (struct pe_raw_data_dirs *)hdr->opt_hdr_64.rva_and_sizes; + return (struct pe_raw_data_dirs *)hdr->opt_hdr_64.coh_rva_and_sizes; default: return 0; diff --git a/src/headers/pe_get_image_entry_point_addr.c b/src/headers/pe_get_image_entry_point_addr.c index d0b222a..9e197b8 100644 --- a/src/headers/pe_get_image_entry_point_addr.c +++ b/src/headers/pe_get_image_entry_point_addr.c @@ -23,11 +23,11 @@ void * pe_get_image_entry_point_addr(const void * base) switch (*magic) { case PE_MAGIC_PE32: - rva = (uint32_t *)hdr->opt_hdr_32.entry_point; + rva = (uint32_t *)hdr->opt_hdr_32.coh_entry_point; break; case PE_MAGIC_PE32_PLUS: - rva = (uint32_t *)hdr->opt_hdr_64.entry_point; + rva = (uint32_t *)hdr->opt_hdr_64.coh_entry_point; break; default: diff --git a/src/headers/pe_get_image_section_tbl_addr.c b/src/headers/pe_get_image_section_tbl_addr.c index 3eb8188..92a2f78 100644 --- a/src/headers/pe_get_image_section_tbl_addr.c +++ b/src/headers/pe_get_image_section_tbl_addr.c @@ -23,7 +23,7 @@ struct pe_raw_sec_hdr * pe_get_image_section_tbl_addr(const void * base) if (!(opt = pe_get_image_opt_hdr_addr(base))) return 0; - mark = opt->opt_hdr_32.magic; + mark = opt->opt_hdr_32.coh_magic; mark += coff->cfh_size_of_opt_hdr[1] << 8; mark += coff->cfh_size_of_opt_hdr[0]; diff --git a/src/meta/pe_get_image_stack_heap_info.c b/src/meta/pe_get_image_stack_heap_info.c index 63f8380..eff7bd2 100644 --- a/src/meta/pe_get_image_stack_heap_info.c +++ b/src/meta/pe_get_image_stack_heap_info.c @@ -22,17 +22,17 @@ int pe_get_image_stack_heap_info(const void * base, struct pe_stack_heap_info * switch (*magic) { case PE_MAGIC_PE32: - stack_heap_info->size_of_stack_reserve = *(uint32_t *)hdr->opt_hdr_32.size_of_stack_reserve; - stack_heap_info->size_of_stack_commit = *(uint32_t *)hdr->opt_hdr_32.size_of_stack_commit; - stack_heap_info->size_of_heap_reserve = *(uint32_t *)hdr->opt_hdr_32.size_of_heap_reserve; - stack_heap_info->size_of_heap_commit = *(uint32_t *)hdr->opt_hdr_32.size_of_heap_commit; + stack_heap_info->size_of_stack_reserve = *(uint32_t *)hdr->opt_hdr_32.coh_size_of_stack_reserve; + stack_heap_info->size_of_stack_commit = *(uint32_t *)hdr->opt_hdr_32.coh_size_of_stack_commit; + stack_heap_info->size_of_heap_reserve = *(uint32_t *)hdr->opt_hdr_32.coh_size_of_heap_reserve; + stack_heap_info->size_of_heap_commit = *(uint32_t *)hdr->opt_hdr_32.coh_size_of_heap_commit; break; case PE_MAGIC_PE32_PLUS: - stack_heap_info->size_of_stack_reserve = *(size_t *)hdr->opt_hdr_64.size_of_stack_reserve; - stack_heap_info->size_of_stack_commit = *(size_t *)hdr->opt_hdr_64.size_of_stack_commit; - stack_heap_info->size_of_heap_reserve = *(size_t *)hdr->opt_hdr_64.size_of_heap_reserve; - stack_heap_info->size_of_heap_commit = *(size_t *)hdr->opt_hdr_64.size_of_heap_commit; + stack_heap_info->size_of_stack_reserve = *(size_t *)hdr->opt_hdr_64.coh_size_of_stack_reserve; + stack_heap_info->size_of_stack_commit = *(size_t *)hdr->opt_hdr_64.coh_size_of_stack_commit; + stack_heap_info->size_of_heap_reserve = *(size_t *)hdr->opt_hdr_64.coh_size_of_heap_reserve; + stack_heap_info->size_of_heap_commit = *(size_t *)hdr->opt_hdr_64.coh_size_of_heap_commit; break; default: |