diff options
| author | Ajax <commial@gmail.com> | 2018-06-04 17:09:37 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-06-04 17:09:37 +0200 |
| commit | cad0b2bcd8cf3d275c36be2d9669c75b4207aeda (patch) | |
| tree | e643ab8b9c6a6243b5db1912959bdf3a3e277056 | |
| parent | dadfaabc3fff5edb9bf4ef7e7e8c4cfc4baccb94 (diff) | |
| download | miasm-cad0b2bcd8cf3d275c36be2d9669c75b4207aeda.tar.gz miasm-cad0b2bcd8cf3d275c36be2d9669c75b4207aeda.zip | |
VirtualProtect: get old access *before* setting the new one
| -rw-r--r-- | miasm2/os_dep/win_api_x86_32.py | 3 |
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) |