on some hook events, uc_hook_add() should not allow more than 1 handler. this add UC_ERR_HOOK_EXIST error type

This commit is contained in:
Nguyen Anh Quynh
2015-10-10 18:01:47 +08:00
parent 5b24c24e82
commit b1d41d414b
6 changed files with 46 additions and 10 deletions

View File

@ -9,5 +9,8 @@ def hook_mem_read_unmapped(mu, access, address, size, value, user_data):
mu = unicorn.Uc(unicorn.UC_ARCH_X86, unicorn.UC_MODE_32)
for x in range(0, 1000):
mu.hook_add(unicorn.UC_HOOK_MEM_READ_UNMAPPED, hook_mem_read_unmapped, None)
try:
for x in range(0, 1000):
mu.hook_add(unicorn.UC_HOOK_MEM_READ_UNMAPPED, hook_mem_read_unmapped, None)
except unicorn.UcError as e:
print("ERROR: %s" % e)