From 5acb454b7b59e55f35146681e9164126a971ae61 Mon Sep 17 00:00:00 2001 From: xorstream Date: Wed, 16 Dec 2015 13:46:14 +1100 Subject: [PATCH] Fixed the unicorn_dynload.c version of uc_hook_add() to handle UC_HOOK_MEM_*_PROT and UC_HOOK_MEM_*_UNMAPPED. --- bindings/msvc/unicorn_dynload.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bindings/msvc/unicorn_dynload.c b/bindings/msvc/unicorn_dynload.c index 0c6a7eee..ca9b4e2a 100644 --- a/bindings/msvc/unicorn_dynload.c +++ b/bindings/msvc/unicorn_dynload.c @@ -232,9 +232,17 @@ uc_err uc_hook_add(uc_engine *uc, uc_hook *hh, int type, void *callback, void *u va_start(valist, user_data); switch(type) { + // note this default case will capture any combinations of + // UC_HOOK_MEM_*_PROT and UC_HOOK_MEM_*_UNMAPPED default: - break; case UC_HOOK_INTR: + case UC_HOOK_MEM_READ_UNMAPPED: + case UC_HOOK_MEM_WRITE_UNMAPPED: + case UC_HOOK_MEM_FETCH_UNMAPPED: + case UC_HOOK_MEM_READ_PROT: + case UC_HOOK_MEM_WRITE_PROT: + case UC_HOOK_MEM_FETCH_PROT: + case UC_HOOK_MEM_FETCH: // 0 extra args ret = gp_uc_hook_add(uc, hh, type, callback, user_data); break; @@ -248,7 +256,7 @@ uc_err uc_hook_add(uc_engine *uc, uc_hook *hh, int type, void *callback, void *u case UC_HOOK_MEM_READ: case UC_HOOK_MEM_WRITE: case UC_HOOK_MEM_READ | UC_HOOK_MEM_WRITE: - // 2 extra arg + // 2 extra args begin = va_arg(valist, uint64_t); end = va_arg(valist, uint64_t); ret = gp_uc_hook_add(uc, hh, type, callback, user_data, begin, end);