summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-11-17 13:47:40 -0500
committermidipix <writeonce@midipix.org>2018-11-20 20:25:16 -0500
commita7f9b1ce139bf094abd61b74e6d58c43dcc2b945 (patch)
tree0af8a89ac0dca000d21a41f4525fe25d1d32383e
parent225d9047dc950513f0c9504547a2414025bc6327 (diff)
downloadperk-a7f9b1ce139bf094abd61b74e6d58c43dcc2b945.tar.bz2
perk-a7f9b1ce139bf094abd61b74e6d58c43dcc2b945.tar.xz
pe_get_image_meta(), struct pe_meta_import_hdr: added .ih_virtual_addr.
-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