diff options
author | midipix <writeonce@midipix.org> | 2016-12-01 06:26:53 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-01 06:26:53 -0500 |
commit | c6ac1acace7001e4b6da02954a94e1202115b71d (patch) | |
tree | 91f73316c3e0f0ef8332502cd1bd88b54a7defc8 | |
parent | 9b6975e989a2aff8c18f7496a2f730874ad3b08e (diff) | |
download | perk-c6ac1acace7001e4b6da02954a94e1202115b71d.tar.bz2 perk-c6ac1acace7001e4b6da02954a94e1202115b71d.tar.xz |
struct pe_meta_opt_hdr: member name normalization.
-rw-r--r-- | include/perk/perk_meta.h | 14 | ||||
-rw-r--r-- | src/info/pe_get_image_abi.c | 2 | ||||
-rw-r--r-- | src/info/pe_get_image_framework.c | 6 | ||||
-rw-r--r-- | src/info/pe_get_image_subsystem.c | 6 | ||||
-rw-r--r-- | src/logic/pe_get_image_meta.c | 12 | ||||
-rw-r--r-- | src/reader/pe_read_optional_header.c | 86 |
6 files changed, 63 insertions, 63 deletions
diff --git a/include/perk/perk_meta.h b/include/perk/perk_meta.h index 272b4d6..1a53406 100644 --- a/include/perk/perk_meta.h +++ b/include/perk/perk_meta.h @@ -170,13 +170,13 @@ struct pe_meta_opt_hdr_mem { }; struct pe_meta_opt_hdr { - struct pe_meta_opt_hdr_std std; - struct pe_meta_opt_hdr_vers vers; - struct pe_meta_opt_hdr_align align; - struct pe_meta_opt_hdr_img img; - struct pe_meta_opt_hdr_ldr ldr; - struct pe_meta_opt_hdr_mem mem; - struct pe_meta_opt_hdr_dirs dirs; + struct pe_meta_opt_hdr_std oh_std; + struct pe_meta_opt_hdr_vers oh_vers; + struct pe_meta_opt_hdr_align oh_align; + struct pe_meta_opt_hdr_img oh_img; + struct pe_meta_opt_hdr_ldr oh_ldr; + struct pe_meta_opt_hdr_mem oh_mem; + struct pe_meta_opt_hdr_dirs oh_dirs; }; diff --git a/src/info/pe_get_image_abi.c b/src/info/pe_get_image_abi.c index 665469a..5b7f311 100644 --- a/src/info/pe_get_image_abi.c +++ b/src/info/pe_get_image_abi.c @@ -19,7 +19,7 @@ int pe_get_image_abi(const struct pe_image_meta * m, struct pe_info_string * inf { int abi; - switch (m->opt.std.coh_magic) { + switch (m->opt.oh_std.coh_magic) { case PE_MAGIC_PE32: abi = PE_ABI_PE32; break; diff --git a/src/info/pe_get_image_framework.c b/src/info/pe_get_image_framework.c index 10594f6..fd90a50 100644 --- a/src/info/pe_get_image_framework.c +++ b/src/info/pe_get_image_framework.c @@ -85,13 +85,13 @@ int pe_get_image_framework(const struct pe_image_meta * m, struct pe_info_string else if (pe_image_is_mingw(m)) framework = PE_FRAMEWORK_MINGW; - else if (m->opt.img.coh_subsystem == PE_IMAGE_SUBSYSTEM_POSIX_CUI) + else if (m->opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_POSIX_CUI) framework = PE_FRAMEWORK_SUACON; - else if (m->opt.img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_CUI) + else if (m->opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_CUI) framework = PE_FRAMEWORK_WINCON; - else if (m->opt.img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_GUI) + else if (m->opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_GUI) framework = PE_FRAMEWORK_WIN32; else diff --git a/src/info/pe_get_image_subsystem.c b/src/info/pe_get_image_subsystem.c index 28456e8..2f4b2d8 100644 --- a/src/info/pe_get_image_subsystem.c +++ b/src/info/pe_get_image_subsystem.c @@ -26,14 +26,14 @@ int pe_get_image_subsystem(const struct pe_image_meta * m, struct pe_info_string { int subsystem; - if (m->opt.img.coh_subsystem >= 0x10) + if (m->opt.oh_img.coh_subsystem >= 0x10) subsystem = -1; - else if (!pe_subsystem_str[m->opt.img.coh_subsystem]) + else if (!pe_subsystem_str[m->opt.oh_img.coh_subsystem]) subsystem = -1; else - subsystem = m->opt.img.coh_subsystem; + subsystem = m->opt.oh_img.coh_subsystem; if ((subsystem < 0) && infostr) { strcpy(infostr->buffer,"INVALID"); diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c index 007bda6..446f20b 100644 --- a/src/logic/pe_get_image_meta.c +++ b/src/logic/pe_get_image_meta.c @@ -221,7 +221,7 @@ int pe_get_image_meta( /* .edata */ i = pe_get_named_section_index(m,".edata"); - s = pe_get_block_section_index(m,&m->opt.dirs.coh_export_tbl); + s = pe_get_block_section_index(m,&m->opt.oh_dirs.coh_export_tbl); if ((i >= 0) && (i != s)) return pe_free_image_meta_impl( @@ -230,7 +230,7 @@ int pe_get_image_meta( if (s >= 0) { m->hedata = &m->sectbl[s]; m->aedata = (struct pe_raw_export_hdr *)(base + m->sectbl[s].ptr_to_raw_data - + m->opt.dirs.coh_export_tbl.dh_rva - m->sectbl[s].virtual_addr); + + m->opt.oh_dirs.coh_export_tbl.dh_rva - m->sectbl[s].virtual_addr); } else if (i >= 0) { m->hedata = &m->sectbl[i]; m->aedata = (struct pe_raw_export_hdr *)(base + m->sectbl[i].ptr_to_raw_data); @@ -246,7 +246,7 @@ int pe_get_image_meta( union pe_raw_import_lookup * pitem; i = pe_get_named_section_index(m,".idata"); - s = pe_get_block_section_index(m,&m->opt.dirs.coh_import_tbl); + s = pe_get_block_section_index(m,&m->opt.oh_dirs.coh_import_tbl); if ((i >= 0) && (i != s)) return pe_free_image_meta_impl( @@ -255,7 +255,7 @@ int pe_get_image_meta( if (s >= 0) { m->hidata = &m->sectbl[s]; m->aidata = (struct pe_raw_import_hdr *)(base + m->sectbl[s].ptr_to_raw_data - + m->opt.dirs.coh_import_tbl.dh_rva - m->sectbl[s].virtual_addr); + + m->opt.oh_dirs.coh_import_tbl.dh_rva - m->sectbl[s].virtual_addr); } else if (i >= 0) { m->hidata = &m->sectbl[i]; m->aidata = (struct pe_raw_import_hdr *)(base + m->sectbl[i].ptr_to_raw_data); @@ -301,11 +301,11 @@ int pe_get_image_meta( if ((ret = pe_read_import_lookup( &(m->idata[i].aitems[j]), &(m->idata[i].items[j]), - m->opt.std.coh_magic))) + m->opt.oh_std.coh_magic))) return pe_free_image_meta_impl( m,PERK_CUSTOM_ERROR(dctx,ret)); - switch (m->opt.std.coh_magic) { + switch (m->opt.oh_std.coh_magic) { case PE_MAGIC_PE32: m->idata[i].items[j].flags = m->idata[i].items[j].u.import_lookup_entry_32; break; diff --git a/src/reader/pe_read_optional_header.c b/src/reader/pe_read_optional_header.c index 14ac4c0..88dfb1c 100644 --- a/src/reader/pe_read_optional_header.c +++ b/src/reader/pe_read_optional_header.c @@ -22,9 +22,9 @@ static int pe_read_optional_header_structs(const union pe_raw_opt_hdr * p, struc struct pe_raw_opt_hdr_img * aimg; struct pe_raw_opt_hdr_ldr * aldr; - m->std.coh_magic = pe_read_short(p->opt_hdr_32.coh_magic); + m->oh_std.coh_magic = pe_read_short(p->opt_hdr_32.coh_magic); - switch (m->std.coh_magic) { + switch (m->oh_std.coh_magic) { case PE_MAGIC_PE32: astd = (struct pe_raw_opt_hdr_std *)p; avers = (struct pe_raw_opt_hdr_vers *)&p->opt_hdr_32.coh_major_os_ver; @@ -46,52 +46,52 @@ static int pe_read_optional_header_structs(const union pe_raw_opt_hdr * p, struc } /* std */ - m->std.coh_major_linker_ver = astd->coh_major_linker_ver[0]; - m->std.coh_minor_linker_ver = astd->coh_minor_linker_ver[0]; + m->oh_std.coh_major_linker_ver = astd->coh_major_linker_ver[0]; + m->oh_std.coh_minor_linker_ver = astd->coh_minor_linker_ver[0]; - m->std.coh_size_of_code = pe_read_long(astd->coh_size_of_code); - m->std.coh_size_of_inited_data = pe_read_long(astd->coh_size_of_inited_data); - m->std.coh_size_of_uninited_data = pe_read_long(astd->coh_size_of_uninited_data); - m->std.coh_entry_point = pe_read_long(astd->coh_entry_point); - m->std.coh_base_of_code = pe_read_long(astd->coh_base_of_code); + m->oh_std.coh_size_of_code = pe_read_long(astd->coh_size_of_code); + m->oh_std.coh_size_of_inited_data = pe_read_long(astd->coh_size_of_inited_data); + m->oh_std.coh_size_of_uninited_data = pe_read_long(astd->coh_size_of_uninited_data); + m->oh_std.coh_entry_point = pe_read_long(astd->coh_entry_point); + m->oh_std.coh_base_of_code = pe_read_long(astd->coh_base_of_code); /* vers */ - m->vers.coh_major_os_ver = pe_read_short(avers->coh_major_os_ver); - m->vers.coh_minor_os_ver = pe_read_short(avers->coh_minor_os_ver); - m->vers.coh_major_image_ver = pe_read_short(avers->coh_major_image_ver); - m->vers.coh_minor_image_ver = pe_read_short(avers->coh_minor_image_ver); - m->vers.coh_major_subsys_ver = pe_read_short(avers->coh_major_subsys_ver); - m->vers.coh_minor_subsys_ver = pe_read_short(avers->coh_minor_subsys_ver); + m->oh_vers.coh_major_os_ver = pe_read_short(avers->coh_major_os_ver); + m->oh_vers.coh_minor_os_ver = pe_read_short(avers->coh_minor_os_ver); + m->oh_vers.coh_major_image_ver = pe_read_short(avers->coh_major_image_ver); + m->oh_vers.coh_minor_image_ver = pe_read_short(avers->coh_minor_image_ver); + m->oh_vers.coh_major_subsys_ver = pe_read_short(avers->coh_major_subsys_ver); + m->oh_vers.coh_minor_subsys_ver = pe_read_short(avers->coh_minor_subsys_ver); - m->vers.coh_win32_ver = pe_read_long(avers->coh_win32_ver); + m->oh_vers.coh_win32_ver = pe_read_long(avers->coh_win32_ver); /* align */ - m->align.coh_section_align = pe_read_long(aalign->coh_section_align); - m->align.coh_file_align = pe_read_long(aalign->coh_file_align); + m->oh_align.coh_section_align = pe_read_long(aalign->coh_section_align); + m->oh_align.coh_file_align = pe_read_long(aalign->coh_file_align); /* img */ - m->img.coh_size_of_image = pe_read_long(aimg->coh_size_of_image); - m->img.coh_size_of_headers = pe_read_long(aimg->coh_size_of_headers); - m->img.coh_checksum = pe_read_long(aimg->coh_checksum); + m->oh_img.coh_size_of_image = pe_read_long(aimg->coh_size_of_image); + m->oh_img.coh_size_of_headers = pe_read_long(aimg->coh_size_of_headers); + m->oh_img.coh_checksum = pe_read_long(aimg->coh_checksum); - m->img.coh_subsystem = pe_read_short(aimg->coh_subsystem); - m->img.coh_dll_characteristics = pe_read_short(aimg->coh_dll_characteristics); + m->oh_img.coh_subsystem = pe_read_short(aimg->coh_subsystem); + m->oh_img.coh_dll_characteristics = pe_read_short(aimg->coh_dll_characteristics); /* ldr */ - m->ldr.coh_loader_flags = pe_read_long(aldr->coh_loader_flags); - m->ldr.coh_rva_and_sizes = pe_read_long(aldr->coh_rva_and_sizes); + m->oh_ldr.coh_loader_flags = pe_read_long(aldr->coh_loader_flags); + m->oh_ldr.coh_rva_and_sizes = pe_read_long(aldr->coh_rva_and_sizes); /* dirs */ - if (m->ldr.coh_rva_and_sizes > 0x10) + if (m->oh_ldr.coh_rva_and_sizes > 0x10) return PERK_ERR_BAD_IMAGE_TYPE; - if (m->ldr.coh_rva_and_sizes < 0x10) - memset(&m->dirs,0,sizeof(m->dirs)); + if (m->oh_ldr.coh_rva_and_sizes < 0x10) + memset(&m->oh_dirs,0,sizeof(m->oh_dirs)); mark = p->opt_hdr_64.coh_export_tbl; - pdir = &m->dirs.coh_export_tbl; + pdir = &m->oh_dirs.coh_export_tbl; - for (i=0; i<m->ldr.coh_rva_and_sizes; i++) { + for (i=0; i<m->oh_ldr.coh_rva_and_sizes; i++) { pdir[i].dh_rva = pe_read_long(&mark[i*8]); pdir[i].dh_size = pe_read_long(&mark[i*8+4]); } @@ -106,23 +106,23 @@ int pe_read_optional_header(const union pe_raw_opt_hdr * p, struct pe_meta_opt_h if ((ret = pe_read_optional_header_structs(p,m))) return ret; - switch (m->std.coh_magic) { + switch (m->oh_std.coh_magic) { case PE_MAGIC_PE32: - m->mem.coh_base_of_data = pe_read_long(p->opt_hdr_32.coh_base_of_data); - m->mem.coh_image_base = pe_read_long(p->opt_hdr_32.coh_image_base); - m->mem.coh_size_of_stack_reserve = pe_read_long(p->opt_hdr_32.coh_size_of_stack_reserve); - m->mem.coh_size_of_stack_commit = pe_read_long(p->opt_hdr_32.coh_size_of_stack_commit); - m->mem.coh_size_of_heap_reserve = pe_read_long(p->opt_hdr_32.coh_size_of_heap_reserve); - m->mem.coh_size_of_heap_commit = pe_read_long(p->opt_hdr_32.coh_size_of_heap_commit); + m->oh_mem.coh_base_of_data = pe_read_long(p->opt_hdr_32.coh_base_of_data); + m->oh_mem.coh_image_base = pe_read_long(p->opt_hdr_32.coh_image_base); + m->oh_mem.coh_size_of_stack_reserve = pe_read_long(p->opt_hdr_32.coh_size_of_stack_reserve); + m->oh_mem.coh_size_of_stack_commit = pe_read_long(p->opt_hdr_32.coh_size_of_stack_commit); + m->oh_mem.coh_size_of_heap_reserve = pe_read_long(p->opt_hdr_32.coh_size_of_heap_reserve); + m->oh_mem.coh_size_of_heap_commit = pe_read_long(p->opt_hdr_32.coh_size_of_heap_commit); break; case PE_MAGIC_PE32_PLUS: - m->mem.coh_base_of_data = (uint64_t)-1; - m->mem.coh_image_base = pe_read_quad(p->opt_hdr_64.coh_image_base); - m->mem.coh_size_of_stack_reserve = pe_read_quad(p->opt_hdr_64.coh_size_of_stack_reserve); - m->mem.coh_size_of_stack_commit = pe_read_quad(p->opt_hdr_64.coh_size_of_stack_commit); - m->mem.coh_size_of_heap_reserve = pe_read_quad(p->opt_hdr_64.coh_size_of_heap_reserve); - m->mem.coh_size_of_heap_commit = pe_read_quad(p->opt_hdr_64.coh_size_of_heap_commit); + m->oh_mem.coh_base_of_data = (uint64_t)-1; + m->oh_mem.coh_image_base = pe_read_quad(p->opt_hdr_64.coh_image_base); + m->oh_mem.coh_size_of_stack_reserve = pe_read_quad(p->opt_hdr_64.coh_size_of_stack_reserve); + m->oh_mem.coh_size_of_stack_commit = pe_read_quad(p->opt_hdr_64.coh_size_of_stack_commit); + m->oh_mem.coh_size_of_heap_reserve = pe_read_quad(p->opt_hdr_64.coh_size_of_heap_reserve); + m->oh_mem.coh_size_of_heap_commit = pe_read_quad(p->opt_hdr_64.coh_size_of_heap_commit); break; } |