From 429e85146c19c86c2d3a6d67e599369af0d1bfef Mon Sep 17 00:00:00 2001 From: serpilliere Date: Tue, 5 Jun 2012 11:09:50 +0200 Subject: fix load without fix PE align --- miasm/tools/pe_helper.py | 2 +- miasm/tools/to_c_helper.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/miasm/tools/pe_helper.py b/miasm/tools/pe_helper.py index 6c31ad6d..497aff13 100644 --- a/miasm/tools/pe_helper.py +++ b/miasm/tools/pe_helper.py @@ -559,7 +559,7 @@ def vm_load_pe(e, align_s = True, load_hdr = True): data = str(s.data) data += "\x00"*(s.size-len(data)) to_c_helper.vm_add_memory_page(e.rva2virt(s.addr), to_c_helper.PAGE_READ|to_c_helper.PAGE_WRITE, data) - s.offset = s.addr + #s.offset = s.addr return #not aligned diff --git a/miasm/tools/to_c_helper.py b/miasm/tools/to_c_helper.py index 646aafbe..508c57d7 100644 --- a/miasm/tools/to_c_helper.py +++ b/miasm/tools/to_c_helper.py @@ -1149,7 +1149,7 @@ def load_pe_in_vm(fname_in, options, all_imp_dll = None, **kargs): codenat_tcc_init() runtime_dll = pe_helper.libimp(kargs.get('runtime_basead', 0x71111000)) - pe_helper.vm_load_pe(e, load_hdr = options.loadhdr) + pe_helper.vm_load_pe(e, align_s = False, load_hdr = options.loadhdr) if all_imp_dll == None: if options.loadbasedll: @@ -1174,7 +1174,7 @@ def load_pe_in_vm(fname_in, options, all_imp_dll = None, **kargs): for n in mod_list: fname = os.path.join('win_dll', n) ee = pe_init.PE(open(fname, 'rb').read()) - pe_helper.vm_load_pe(ee) + pe_helper.vm_load_pe(ee, align_s = False) runtime_dll.add_export_lib(ee, n) exp_funcs = pe_helper.get_export_name_addr_list(ee) exp_func[n] = exp_funcs -- cgit 1.4.1