about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2018-06-04 17:10:32 +0200
committerAjax <commial@gmail.com>2018-06-04 17:10:32 +0200
commit7d5bb2f4efb5b040d8c099097080f96bb59887e4 (patch)
treeb5a4bb27fee84aac4c1014a585284da664650531
parentcad0b2bcd8cf3d275c36be2d9669c75b4207aeda (diff)
downloadmiasm-7d5bb2f4efb5b040d8c099097080f96bb59887e4.tar.gz
miasm-7d5bb2f4efb5b040d8c099097080f96bb59887e4.zip
VirtualProtect: act on multiple pages
Diffstat (limited to '')
-rw-r--r--miasm2/os_dep/win_api_x86_32.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/miasm2/os_dep/win_api_x86_32.py b/miasm2/os_dep/win_api_x86_32.py
index 90440a46..0101152a 100644
--- a/miasm2/os_dep/win_api_x86_32.py
+++ b/miasm2/os_dep/win_api_x86_32.py
@@ -739,7 +739,10 @@ def kernel32_VirtualProtect(jitter):
         old = jitter.vm.get_mem_access(args.lpvoid)
         jitter.vm.set_mem(args.lpfloldprotect, pck32(ACCESS_DICT_INV[old]))
 
-    jitter.vm.set_mem_access(args.lpvoid, ACCESS_DICT[flnewprotect])
+    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)