From 92222c25d786023f5c21f7e434281a44ec0cd536 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 27 May 2016 05:12:52 -0400 Subject: pe_get_imported_symbol_info_64(): simplify logic. --- src/meta/pe_get_symbol_name.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3