From fcd0d02bae96bcffaec34bd35b55071c8509d982 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sat, 29 Aug 2015 13:17:50 +0800 Subject: [PATCH] python: udpate binding after the last change on uc_mem_map() API --- bindings/python/unicorn/unicorn.py | 6 +++--- bindings/python/unicorn/unicorn_const.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bindings/python/unicorn/unicorn.py b/bindings/python/unicorn/unicorn.py index e207cd91..ae672227 100644 --- a/bindings/python/unicorn/unicorn.py +++ b/bindings/python/unicorn/unicorn.py @@ -73,7 +73,7 @@ _setup_prototype(_uc, "uc_mem_write", ctypes.c_int, ctypes.c_size_t, ctypes.c_ui _setup_prototype(_uc, "uc_emu_start", ctypes.c_int, ctypes.c_size_t, ctypes.c_uint64, ctypes.c_uint64, ctypes.c_uint64, ctypes.c_size_t) _setup_prototype(_uc, "uc_emu_stop", ctypes.c_int, ctypes.c_size_t) _setup_prototype(_uc, "uc_hook_del", ctypes.c_int, ctypes.c_size_t, ctypes.POINTER(ctypes.c_size_t)) -_setup_prototype(_uc, "uc_mem_map", ctypes.c_int, ctypes.c_size_t, ctypes.c_uint64, ctypes.c_size_t) +_setup_prototype(_uc, "uc_mem_map", ctypes.c_int, ctypes.c_size_t, ctypes.c_uint64, ctypes.c_size_t, ctypes.c_uint32) # uc_hook_add is special due to variable number of arguments _uc.uc_hook_add = getattr(_uc, "uc_hook_add") @@ -201,8 +201,8 @@ class Uc(object): # map a range of memory - def mem_map(self, address, size): - status = _uc.uc_mem_map(self._uch, address, size) + def mem_map(self, address, size, perms=UC_PROT_ALL): + status = _uc.uc_mem_map(self._uch, address, size, perms) if status != UC_ERR_OK: raise UcError(status) diff --git a/bindings/python/unicorn/unicorn_const.py b/bindings/python/unicorn/unicorn_const.py index bbcff20c..ad07f46b 100644 --- a/bindings/python/unicorn/unicorn_const.py +++ b/bindings/python/unicorn/unicorn_const.py @@ -59,5 +59,8 @@ UC_HOOK_MEM_INVALID = 36 UC_HOOK_MEM_READ = 37 UC_HOOK_MEM_WRITE = 38 UC_HOOK_MEM_READ_WRITE = 39 + +UC_PROT_NONE = 0 UC_PROT_READ = 1 UC_PROT_WRITE = 2 +UC_PROT_ALL = 3