about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2018-06-09 23:31:24 +0200
committerGitHub <noreply@github.com>2018-06-09 23:31:24 +0200
commit93a9086a369666ca5fc9ac572405407f1459cb2f (patch)
treef4363f5df61130355002d5213f94677623e0826a
parent990060f21e515ff1a25246f8fdf0936a97ac698f (diff)
parent7d5bb2f4efb5b040d8c099097080f96bb59887e4 (diff)
downloadmiasm-93a9086a369666ca5fc9ac572405407f1459cb2f.tar.gz
miasm-93a9086a369666ca5fc9ac572405407f1459cb2f.zip
Merge pull request #752 from commial/fix/virtual-protect
Fix/virtual protect
-rw-r--r--miasm2/os_dep/win_api_x86_32.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/miasm2/os_dep/win_api_x86_32.py b/miasm2/os_dep/win_api_x86_32.py
index a88f4a8a..0101152a 100644
--- a/miasm2/os_dep/win_api_x86_32.py
+++ b/miasm2/os_dep/win_api_x86_32.py
@@ -734,12 +734,16 @@ def kernel32_VirtualProtect(jitter):
     flnewprotect = args.flnewprotect & 0xFFF
     if not flnewprotect in ACCESS_DICT:
         raise ValueError('unknown access dw!')
-    jitter.vm.set_mem_access(args.lpvoid, ACCESS_DICT[flnewprotect])
 
     if args.lpfloldprotect:
         old = jitter.vm.get_mem_access(args.lpvoid)
         jitter.vm.set_mem(args.lpfloldprotect, pck32(ACCESS_DICT_INV[old]))
 
+    for addr in jitter.vm.get_all_memory():
+        # Multi-page
+        if args.lpvoid <= addr < args.lpvoid + args.dwsize:
+            jitter.vm.set_mem_access(addr, ACCESS_DICT[flnewprotect])
+
     jitter.func_ret_stdcall(ret_ad, 1)