summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-11-17 23:06:17 -0500
committermidipix <writeonce@midipix.org>2018-11-20 20:25:17 -0500
commit2bae5fde60d0cad9203b554f36d6724dbc255c30 (patch)
treeba1c44958480935f31886de9087038295d2b084c
parent0a52ca80ff2bdaae33fb7e3774956af5ee5adb1a (diff)
downloadperk-2bae5fde60d0cad9203b554f36d6724dbc255c30.tar.bz2
perk-2bae5fde60d0cad9203b554f36d6724dbc255c30.tar.xz
pe_get_image_meta(): properly read the import-by-ordinal import lookup flag.
-rw-r--r--include/perk/perk_meta.h2
-rw-r--r--src/logic/pe_get_image_meta.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/perk/perk_meta.h b/include/perk/perk_meta.h
index be56485..7467c44 100644
--- a/include/perk/perk_meta.h
+++ b/include/perk/perk_meta.h
@@ -244,7 +244,7 @@ struct pe_meta_import_lookup {
uint16_t ii_ordinal_number;
} u;
- uint32_t ii_flags;
+ uint32_t ii_flag;
uint16_t ii_hint;
char * ii_name;
};
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index 37df3f7..7ec2b0b 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -468,15 +468,15 @@ int pe_get_image_meta(
switch (m->m_opt.oh_std.coh_magic) {
case PE_MAGIC_PE32:
- m->m_idata[i].ih_items[j].ii_flags = m->m_idata[i].ih_items[j].u.ii_import_lookup_entry_32;
+ m->m_idata[i].ih_items[j].ii_flag = m->m_idata[i].ih_items[j].u.ii_import_lookup_entry_32 >> 31;
break;
case PE_MAGIC_PE32_PLUS:
- m->m_idata[i].ih_items[j].ii_flags = (m->m_idata[i].ih_items[j].u.ii_import_lookup_entry_64 >> 32);
+ m->m_idata[i].ih_items[j].ii_flag = (m->m_idata[i].ih_items[j].u.ii_import_lookup_entry_64 >> 63);
break;
}
- if (!m->m_idata[i].ih_items[j].ii_flags) {
+ if (!m->m_idata[i].ih_items[j].ii_flag) {
struct pe_raw_hint_name_entry * pentry =
(struct pe_raw_hint_name_entry *)(base + m->h_idata->sh_ptr_to_raw_data
+ m->m_idata[i].ih_items[j].u.ii_hint_name_tbl_rva - m->h_idata->sh_virtual_addr);