summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/perk/perk_meta.h1
-rw-r--r--src/logic/pe_get_image_meta.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/include/perk/perk_meta.h b/include/perk/perk_meta.h
index 375c672..be56485 100644
--- a/include/perk/perk_meta.h
+++ b/include/perk/perk_meta.h
@@ -222,6 +222,7 @@ union pe_meta_export_addr_tbl {
/* image: import directory table entry */
struct pe_meta_import_hdr {
+ uint32_t ih_virtual_addr;
uint32_t ih_import_lookup_tbl_rva;
uint32_t ih_time_date_stamp;
uint32_t ih_forwarder_chain;
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index 38d544a..37df3f7 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -312,6 +312,7 @@ int pe_get_image_meta(
const unsigned char * mark;
struct pe_image_meta * m;
char * base;
+ uint64_t vaddr;
base = image->map_addr;
@@ -411,9 +412,11 @@ int pe_get_image_meta(
m->h_idata = &m->m_sectbl[s];
m->r_idata = (struct pe_raw_import_hdr *)(base + m->m_sectbl[s].sh_ptr_to_raw_data
+ m->m_opt.oh_dirs.coh_import_tbl.dh_rva - m->m_sectbl[s].sh_virtual_addr);
+ vaddr = m->m_opt.oh_dirs.coh_import_tbl.dh_rva;
} else if (i >= 0) {
m->h_idata = &m->m_sectbl[i];
m->r_idata = (struct pe_raw_import_hdr *)(base + m->m_sectbl[i].sh_ptr_to_raw_data);
+ vaddr = m->m_sectbl[i].sh_virtual_addr;
}
if (m->r_idata) {
@@ -427,6 +430,7 @@ int pe_get_image_meta(
m,PERK_SYSTEM_ERROR(dctx));
for (i=0; i<m->m_stats.t_nimplibs; i++) {
+ m->m_idata[i].ih_virtual_addr = vaddr + (i * sizeof(*m->r_idata));
pe_read_import_header(&m->r_idata[i],&m->m_idata[i]);
m->m_idata[i].ih_name = base + m->h_idata->sh_ptr_to_raw_data