summaryrefslogtreecommitdiffhomepage
path: root/src/meta
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-05-27 05:12:52 -0400
committermidipix <writeonce@midipix.org>2016-05-27 05:12:52 -0400
commit92222c25d786023f5c21f7e434281a44ec0cd536 (patch)
tree627f0f5a286d947cab3f35069b415fbcac41bdff /src/meta
parent18fa180b7093bedf5347979ffb95419aacaffe61 (diff)
downloadpemagine-92222c25d786023f5c21f7e434281a44ec0cd536.tar.bz2
pemagine-92222c25d786023f5c21f7e434281a44ec0cd536.tar.xz
pe_get_imported_symbol_info_64(): simplify logic.
Diffstat (limited to 'src/meta')
-rw-r--r--src/meta/pe_get_symbol_name.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/meta/pe_get_symbol_name.c b/src/meta/pe_get_symbol_name.c
index 31d351f..cff27a9 100644
--- a/src/meta/pe_get_symbol_name.c
+++ b/src/meta/pe_get_symbol_name.c
@@ -150,31 +150,24 @@ static char * pe_get_imported_symbol_info_64(
struct symbol * sym;
fn_name = 0;
- mod_info = 0;
sym = (struct symbol *)sym_addr;
if ((sym->call == 0xff) && (sym->ds == 0x25)) {
- sym_offset = (uint32_t *)sym->sym_addr;
-
- if (sym_offset) {
- offset = *sym_offset;
- sym_addr = *(void **)(offset + (uintptr_t)(++sym_offset));
- mod_info = pe_get_symbol_module_info(sym_addr);
- }
-
- if (mod_info)
- mod_base = mod_info->dll_base;
- else
- mod_base = (void *)0;
-
- if (mod_base)
- fn_name = pe_get_symbol_name(mod_base,sym_addr);
+ if ((sym_offset = (uint32_t *)sym->sym_addr)) {
+ offset = *sym_offset;
+ sym_addr = *(void **)(offset + (uintptr_t)(++sym_offset));
+ } else
+ sym_addr = 0;
+
+ if (sym_addr && (mod_info = pe_get_symbol_module_info(sym_addr)))
+ if ((mod_base = mod_info->dll_base))
+ fn_name = pe_get_symbol_name(
+ mod_base,
+ sym_addr);
}
- if (fn_name) {
- if (ldr_tbl_entry)
- *ldr_tbl_entry = mod_info;
- }
+ if (fn_name && ldr_tbl_entry)
+ *ldr_tbl_entry = mod_info;
return fn_name;
}