about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/os_dep/win_api_x86_32.py3
1 files changed, 2 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..90440a46 100644
--- a/miasm2/os_dep/win_api_x86_32.py
+++ b/miasm2/os_dep/win_api_x86_32.py
@@ -734,12 +734,13 @@ 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]))
 
+    jitter.vm.set_mem_access(args.lpvoid, ACCESS_DICT[flnewprotect])
+
     jitter.func_ret_stdcall(ret_ad, 1)