diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/info/pe_get_image_framework.c | 4 | ||||
-rw-r--r-- | src/logic/pe_get_image_meta.c | 42 | ||||
-rw-r--r-- | src/output/pe_output_import_libraries.c | 8 | ||||
-rw-r--r-- | src/reader/pe_read_import_header.c | 16 |
4 files changed, 36 insertions, 34 deletions
diff --git a/src/info/pe_get_image_framework.c b/src/info/pe_get_image_framework.c index fd90a50..2267817 100644 --- a/src/info/pe_get_image_framework.c +++ b/src/info/pe_get_image_framework.c @@ -36,7 +36,7 @@ static bool pe_image_is_cygwin(const struct pe_image_meta * m) int i; for (i=0; i<m->summary.nimplibs; i++) - if (!(strcmp(m->idata[i].name,"cygwin1.dll"))) + if (!(strcmp(m->idata[i].ih_name,"cygwin1.dll"))) return true; return false; @@ -47,7 +47,7 @@ static bool pe_image_is_msys(const struct pe_image_meta * m) int i; for (i=0; i<m->summary.nimplibs; i++) - if (!(strcmp(m->idata[i].name,"msys-2.0.dll"))) + if (!(strcmp(m->idata[i].ih_name,"msys-2.0.dll"))) return true; return false; diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c index 7e0bbf2..ac3f114 100644 --- a/src/logic/pe_get_image_meta.c +++ b/src/logic/pe_get_image_meta.c @@ -19,7 +19,7 @@ static int pe_free_image_meta_impl(struct pe_image_meta * meta, int ret) if (meta) { for (i=0; i<meta->summary.nimplibs; i++) - free(meta->idata[i].items); + free(meta->idata[i].ih_items); free(meta->idata); free(meta->sectbl); @@ -263,7 +263,7 @@ int pe_get_image_meta( if (m->aidata) { /* num of implibs */ - for (pidata=m->aidata; pidata->name_rva[0]; pidata++) + for (pidata=m->aidata; pidata->ih_name_rva[0]; pidata++) m->summary.nimplibs++; /* import headers */ @@ -274,53 +274,55 @@ int pe_get_image_meta( for (i=0; i<m->summary.nimplibs; i++) { pe_read_import_header(&m->aidata[i],&m->idata[i]); - m->idata[i].name = base + m->hidata->sh_ptr_to_raw_data - + m->idata[i].name_rva - m->hidata->sh_virtual_addr; + m->idata[i].ih_name = base + m->hidata->sh_ptr_to_raw_data + + m->idata[i].ih_name_rva + - m->hidata->sh_virtual_addr; - if (m->idata[i].import_lookup_tbl_rva) - m->idata[i].aitems = (union pe_raw_import_lookup *)(base + m->hidata->sh_ptr_to_raw_data - + m->idata[i].import_lookup_tbl_rva - m->hidata->sh_virtual_addr); + if (m->idata[i].ih_import_lookup_tbl_rva) + m->idata[i].ih_aitems = (union pe_raw_import_lookup *)(base + m->hidata->sh_ptr_to_raw_data + + m->idata[i].ih_import_lookup_tbl_rva + - m->hidata->sh_virtual_addr); /* items */ uint32_t * hint; - m->idata[i].count = 0; + m->idata[i].ih_count = 0; - if (m->idata[i].import_lookup_tbl_rva) { - pitem = m->idata[i].aitems; + if (m->idata[i].ih_import_lookup_tbl_rva) { + pitem = m->idata[i].ih_aitems; hint = (uint32_t *)pitem->ii_hint_name_tbl_rva; for (; *hint; hint=(uint32_t *)((++pitem)->ii_hint_name_tbl_rva)) - m->idata[i].count++; + m->idata[i].ih_count++; - if (!(m->idata[i].items = calloc(m->idata[i].count,sizeof(*(m->idata[i].items))))) + if (!(m->idata[i].ih_items = calloc(m->idata[i].ih_count,sizeof(*(m->idata[i].ih_items))))) return pe_free_image_meta_impl( m,PERK_SYSTEM_ERROR(dctx)); } - for (j=0; j<m->idata[i].count; j++) { + for (j=0; j<m->idata[i].ih_count; j++) { if ((ret = pe_read_import_lookup( - &(m->idata[i].aitems[j]), - &(m->idata[i].items[j]), + &(m->idata[i].ih_aitems[j]), + &(m->idata[i].ih_items[j]), m->opt.oh_std.coh_magic))) return pe_free_image_meta_impl( m,PERK_CUSTOM_ERROR(dctx,ret)); switch (m->opt.oh_std.coh_magic) { case PE_MAGIC_PE32: - m->idata[i].items[j].ii_flags = m->idata[i].items[j].u.ii_import_lookup_entry_32; + m->idata[i].ih_items[j].ii_flags = m->idata[i].ih_items[j].u.ii_import_lookup_entry_32; break; case PE_MAGIC_PE32_PLUS: - m->idata[i].items[j].ii_flags = (m->idata[i].items[j].u.ii_import_lookup_entry_64 >> 32); + m->idata[i].ih_items[j].ii_flags = (m->idata[i].ih_items[j].u.ii_import_lookup_entry_64 >> 32); break; } - if (!m->idata[i].items[j].ii_flags) { + if (!m->idata[i].ih_items[j].ii_flags) { struct pe_raw_hint_name_entry * pentry = (struct pe_raw_hint_name_entry *)(base + m->hidata->sh_ptr_to_raw_data - + m->idata[i].items[j].u.ii_hint_name_tbl_rva - m->hidata->sh_virtual_addr); + + m->idata[i].ih_items[j].u.ii_hint_name_tbl_rva - m->hidata->sh_virtual_addr); - m->idata[i].items[j].ii_name = (char *)pentry->name; + m->idata[i].ih_items[j].ii_name = (char *)pentry->name; } } } diff --git a/src/output/pe_output_import_libraries.c b/src/output/pe_output_import_libraries.c index cf96005..b308a75 100644 --- a/src/output/pe_output_import_libraries.c +++ b/src/output/pe_output_import_libraries.c @@ -60,15 +60,15 @@ int pe_output_import_libraries( return PERK_FILE_ERROR(dctx); for (i=0; i<m->summary.nimplibs; i++) { - if ((pretty_implib_header(cctx,m->idata[i].name,fout)) < 0) + if ((pretty_implib_header(cctx,m->idata[i].ih_name,fout)) < 0) return PERK_FILE_ERROR(dctx); if (cctx->fmtflags & PERK_OUTPUT_IMPORT_SYMS) - for (j=0; j<m->idata[i].count; j++) - if (m->idata[i].items[j].ii_name) + for (j=0; j<m->idata[i].ih_count; j++) + if (m->idata[i].ih_items[j].ii_name) if ((pretty_implib_item( cctx, - m->idata[i].items[j].ii_name, + m->idata[i].ih_items[j].ii_name, fout)) < 0) return PERK_FILE_ERROR(dctx); } diff --git a/src/reader/pe_read_import_header.c b/src/reader/pe_read_import_header.c index ef2a4f1..3689bc4 100644 --- a/src/reader/pe_read_import_header.c +++ b/src/reader/pe_read_import_header.c @@ -12,14 +12,14 @@ int pe_read_import_header(const struct pe_raw_import_hdr * p, struct pe_meta_import_hdr * m) { - m->import_lookup_tbl_rva = pe_read_long(p->import_lookup_tbl_rva); - m->time_date_stamp = pe_read_long(p->time_date_stamp); - m->forwarder_chain = pe_read_long(p->forwarder_chain); - m->name_rva = pe_read_long(p->name_rva); - m->import_addr_tbl_rva = pe_read_long(p->import_addr_tbl_rva); - - m->name = 0; - m->aitems = 0; + m->ih_import_lookup_tbl_rva = pe_read_long(p->ih_import_lookup_tbl_rva); + m->ih_time_date_stamp = pe_read_long(p->ih_time_date_stamp); + m->ih_forwarder_chain = pe_read_long(p->ih_forwarder_chain); + m->ih_name_rva = pe_read_long(p->ih_name_rva); + m->ih_import_addr_tbl_rva = pe_read_long(p->ih_import_addr_tbl_rva); + + m->ih_name = 0; + m->ih_aitems = 0; return 0; } |