summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-10-31 10:41:48 -0400
committermidipix <writeonce@midipix.org>2016-11-10 23:35:24 -0500
commited9e7f830e92a3e83d51e4f9f7c613aa67663b3b (patch)
tree3afa639ee83c1ebd53f769df655efcd892ff1ff0 /src
parente5e01868d55406873dae7b45770aed03840faa7e (diff)
downloadperk-ed9e7f830e92a3e83d51e4f9f7c613aa67663b3b.tar.bz2
perk-ed9e7f830e92a3e83d51e4f9f7c613aa67663b3b.tar.xz
pe_get_image_meta(): prioritize information found in the section directory.
Diffstat (limited to 'src')
-rw-r--r--src/main/pe_get_image_meta.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/pe_get_image_meta.c b/src/main/pe_get_image_meta.c
index f52c2e8..47ea8fd 100644
--- a/src/main/pe_get_image_meta.c
+++ b/src/main/pe_get_image_meta.c
@@ -92,13 +92,13 @@ int pe_get_image_meta (const struct pe_raw_image * image, struct pe_image_meta *
if ((i >= 0) && (i != s))
return pe_free_image_meta_impl(m,PERK_MALFORMED_IMAGE);
- if (i >= 0 ) {
- m->hedata = &m->sectbl[i];
- m->aedata = (struct pe_export_hdr *)(base + m->sectbl[i].ptr_to_raw_data);
- } else if (s >= 0) {
+ if (s >= 0) {
m->hedata = &m->sectbl[s];
m->aedata = (struct pe_export_hdr *)(base + m->sectbl[s].ptr_to_raw_data
+ m->opt.dirs.export_tbl.rva - m->sectbl[s].virtual_addr);
+ } else if (i >= 0) {
+ m->hedata = &m->sectbl[i];
+ m->aedata = (struct pe_export_hdr *)(base + m->sectbl[i].ptr_to_raw_data);
}
if (m->aedata)
@@ -114,13 +114,13 @@ int pe_get_image_meta (const struct pe_raw_image * image, struct pe_image_meta *
if ((i >= 0) && (i != s))
return pe_free_image_meta_impl(m,PERK_MALFORMED_IMAGE);
- if (i >= 0 ) {
- m->hidata = &m->sectbl[i];
- m->aidata = (struct pe_import_hdr *)(base + m->sectbl[i].ptr_to_raw_data);
- } else if (s >= 0) {
+ if (s >= 0) {
m->hidata = &m->sectbl[s];
m->aidata = (struct pe_import_hdr *)(base + m->sectbl[s].ptr_to_raw_data
+ m->opt.dirs.import_tbl.rva - m->sectbl[s].virtual_addr);
+ } else if (i >= 0) {
+ m->hidata = &m->sectbl[i];
+ m->aidata = (struct pe_import_hdr *)(base + m->sectbl[i].ptr_to_raw_data);
}
if (m->aidata) {