mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 20:48:31 +00:00
python bindings: added mem_protect
This commit is contained in:
parent
fe2ecdf6f9
commit
94012558fb
1 changed files with 8 additions and 0 deletions
|
@ -105,6 +105,7 @@ _setup_prototype(_uc, "uc_emu_stop", ucerr, uc_engine)
|
||||||
_setup_prototype(_uc, "uc_hook_del", ucerr, uc_engine, uc_hook_h)
|
_setup_prototype(_uc, "uc_hook_del", ucerr, uc_engine, uc_hook_h)
|
||||||
_setup_prototype(_uc, "uc_mem_map", ucerr, uc_engine, ctypes.c_uint64, ctypes.c_size_t, ctypes.c_uint32)
|
_setup_prototype(_uc, "uc_mem_map", ucerr, uc_engine, ctypes.c_uint64, ctypes.c_size_t, ctypes.c_uint32)
|
||||||
_setup_prototype(_uc, "uc_mem_unmap", ucerr, uc_engine, ctypes.c_uint64, ctypes.c_size_t)
|
_setup_prototype(_uc, "uc_mem_unmap", ucerr, uc_engine, ctypes.c_uint64, ctypes.c_size_t)
|
||||||
|
_setup_prototype(_uc, "uc_mem_protect", ucerr, uc_engine, ctypes.c_uint64, ctypes.c_size_t, ctypes.c_uint32)
|
||||||
|
|
||||||
# uc_hook_add is special due to variable number of arguments
|
# uc_hook_add is special due to variable number of arguments
|
||||||
_uc.uc_hook_add = getattr(_uc, "uc_hook_add")
|
_uc.uc_hook_add = getattr(_uc, "uc_hook_add")
|
||||||
|
@ -247,6 +248,13 @@ class Uc(object):
|
||||||
raise UcError(status)
|
raise UcError(status)
|
||||||
|
|
||||||
|
|
||||||
|
# protect a range of memory
|
||||||
|
def mem_protect(self, address, size, perms=UC_PROT_ALL):
|
||||||
|
status = _uc.uc_mem_protect(self._uch, address, size, perms)
|
||||||
|
if status != UC_ERR_OK:
|
||||||
|
raise UcError(status)
|
||||||
|
|
||||||
|
|
||||||
def _hookcode_cb(self, handle, address, size, user_data):
|
def _hookcode_cb(self, handle, address, size, user_data):
|
||||||
# call user's callback with self object
|
# call user's callback with self object
|
||||||
(cb, data) = self._callbacks[user_data]
|
(cb, data) = self._callbacks[user_data]
|
||||||
|
|
Loading…
Reference in a new issue