about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2011-08-08 14:05:27 +0200
committerserpilliere <devnull@localhost>2011-08-08 14:05:27 +0200
commitc9c9bc8300270fa97fc1a49e996b06ecdaf5291b (patch)
tree7e990d17b86d15780355fcd22a8bd2b672b516bc
parent7f8c548bb8123d2fb20461a8e161258c8fa372d2 (diff)
downloadmiasm-c9c9bc8300270fa97fc1a49e996b06ecdaf5291b.tar.gz
miasm-c9c9bc8300270fa97fc1a49e996b06ecdaf5291b.zip
fix tipo
-rw-r--r--example/sandbox_pe.py2
-rw-r--r--miasm/tools/win_api.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/example/sandbox_pe.py b/example/sandbox_pe.py
index 1b6457be..d76acd01 100644
--- a/example/sandbox_pe.py
+++ b/example/sandbox_pe.py
@@ -41,7 +41,7 @@ if filename and os.path.isfile(filename):
 runtime_dll, dll_dyn_funcs = preload_lib(e, patch_vm_imp = True, lib_base_ad = 0x7c811111)
 # set winapi to ours
 win_api.runtime_dll = runtime_dll
-
+win_api.current_pe = e
 dll_dyn_ad2name = dict([(x[1], x[0]) for x in dll_dyn_funcs.items()])
 dyn_func = {}
 
diff --git a/miasm/tools/win_api.py b/miasm/tools/win_api.py
index 80abb523..5a4d1edc 100644
--- a/miasm/tools/win_api.py
+++ b/miasm/tools/win_api.py
@@ -61,6 +61,7 @@ module_cur_hwnd = 0x88800
 
 module_file_nul = 0x999000
 runtime_dll = None
+current_pe = None
 
 """
 typedef struct tagPROCESSENTRY32 {
@@ -856,7 +857,7 @@ def kernel32_GetModuleHandleA():
         print libname
         eax = runtime_dll.lib_get_add_base(libname)
     else:
-        eax = e.Opthdr.Opthdr.ImageBase
+        eax = current_pe.NThdr.ImageBase
         print "default img base" , hex(eax)
     regs = vm_get_gpreg()
     regs['eip'] = ret_ad