diff --git a/hook.c b/hook.c index 850c9564..109a20d2 100644 --- a/hook.c +++ b/hook.c @@ -91,7 +91,7 @@ size_t hook_add(struct uc_struct *uc, int type, uint64_t begin, uint64_t end, vo } // return 0 on success, -1 on failure -uc_err hook_del(struct uc_struct *uc, uc_hook_h hh) +uc_err hook_del(struct uc_struct *uc, uchook hh) { if (hh == uc->hook_block_idx) { uc->hook_block_idx = 0; diff --git a/include/hook.h b/include/hook.h index 8c095b28..08e9e9b0 100644 --- a/include/hook.h +++ b/include/hook.h @@ -8,7 +8,7 @@ size_t hook_add(struct uc_struct *uc, int type, uint64_t begin, uint64_t end, void *callback, void *user_data); // return 0 on success, -1 on failure -uc_err hook_del(struct uc_struct *uc, uc_hook_h hh); +uc_err hook_del(struct uc_struct *uc, uchook hh); // return NULL on failure struct hook_struct *hook_find(struct uc_struct *uc, int type, uint64_t address); diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index f3b4c1f2..1aae5c11 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -22,7 +22,7 @@ extern "C" { struct uc_struct; typedef struct uc_struct ucengine; -typedef size_t uc_hook_h; +typedef size_t uchook; #include "m68k.h" #include "x86.h" @@ -375,7 +375,7 @@ uc_err uc_emu_stop(ucengine *uc); for detailed error). */ UNICORN_EXPORT -uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback, void *user_data, ...); +uc_err uc_hook_add(ucengine *uc, uchook *hh, uc_hook_t type, void *callback, void *user_data, ...); /* Unregister (remove) a hook callback. @@ -390,7 +390,7 @@ uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback, for detailed error). */ UNICORN_EXPORT -uc_err uc_hook_del(ucengine *uc, uc_hook_h hh); +uc_err uc_hook_del(ucengine *uc, uchook hh); typedef enum uc_prot { UC_PROT_NONE = 0, diff --git a/regress/block_test.c b/regress/block_test.c index 06a0fa21..7aaf1b93 100644 --- a/regress/block_test.c +++ b/regress/block_test.c @@ -62,7 +62,7 @@ int main() { } fprintf(stderr, "ok %d - uc_mem_write\n", count++); - uc_hook_h h1, h2; + uchook h1, h2; err = uc_hook_add(uc, &h1, UC_HOOK_BLOCK, cb_hookblock, NULL, (uint64_t)1, (uint64_t)0); if (err != UC_ERR_OK) { diff --git a/regress/nr_mem_test.c b/regress/nr_mem_test.c index 0e70829b..b804dd79 100644 --- a/regress/nr_mem_test.c +++ b/regress/nr_mem_test.c @@ -55,7 +55,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type, int main(int argc, char **argv, char **envp) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; uint32_t eax, ebx; diff --git a/regress/rep_movsb.c b/regress/rep_movsb.c index 97b00c15..0d91cbef 100644 --- a/regress/rep_movsb.c +++ b/regress/rep_movsb.c @@ -90,7 +90,7 @@ static void hook_mem_write(ucengine *uc, uc_mem_type type, int main(int argc, char **argv, char **envp) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; uint8_t buf1[100], readbuf[100]; diff --git a/regress/ro_mem_test.c b/regress/ro_mem_test.c index 0c0390ff..49db748e 100644 --- a/regress/ro_mem_test.c +++ b/regress/ro_mem_test.c @@ -95,7 +95,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type, int main(int argc, char **argv, char **envp) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; uint8_t bytes[8]; uint32_t esp; diff --git a/regress/sigill.c b/regress/sigill.c index ad7af47f..b7317888 100644 --- a/regress/sigill.c +++ b/regress/sigill.c @@ -21,7 +21,7 @@ int main() int size; uint8_t *buf; ucengine *uc; - uc_hook_h uh_trap; + uchook uh_trap; uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc); if (err) { fprintf (stderr, "Cannot initialize unicorn\n"); diff --git a/regress/timeout_segfault.c b/regress/timeout_segfault.c index 2632a51f..73070978 100644 --- a/regress/timeout_segfault.c +++ b/regress/timeout_segfault.c @@ -38,7 +38,7 @@ static void test_arm(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r0 = 0x1234; // R0 register int r2 = 0x6789; // R1 register @@ -94,7 +94,7 @@ static void test_thumb(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int sp = 0x1234; // R0 register diff --git a/samples/mem_exec.c b/samples/mem_exec.c index 075a5a4b..3b63012c 100644 --- a/samples/mem_exec.c +++ b/samples/mem_exec.c @@ -143,7 +143,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type, int main(int argc, char **argv, char **envp) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; uint32_t esp, eip; int32_t buf1[1024], buf2[1024], readbuf[1024]; diff --git a/samples/mem_protect.c b/samples/mem_protect.c index f1476593..dfabd0fb 100644 --- a/samples/mem_protect.c +++ b/samples/mem_protect.c @@ -161,7 +161,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type, int main(int argc, char **argv, char **envp) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; uint32_t addr, testval; int32_t buf1[1024], buf2[1024], readbuf[1024]; diff --git a/samples/mem_unmap.c b/samples/mem_unmap.c index 44866536..0bf61911 100644 --- a/samples/mem_unmap.c +++ b/samples/mem_unmap.c @@ -156,7 +156,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type, int main(int argc, char **argv, char **envp) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; uint32_t addr, testval; int32_t buf1[1024], buf2[1024], readbuf[1024]; diff --git a/samples/sample_arm.c b/samples/sample_arm.c index 38e8590a..81ec691b 100644 --- a/samples/sample_arm.c +++ b/samples/sample_arm.c @@ -29,7 +29,7 @@ static void test_arm(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r0 = 0x1234; // R0 register int r2 = 0x6789; // R1 register @@ -85,7 +85,7 @@ static void test_thumb(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int sp = 0x1234; // R0 register diff --git a/samples/sample_arm64.c b/samples/sample_arm64.c index 61a58f20..3541b2f6 100644 --- a/samples/sample_arm64.c +++ b/samples/sample_arm64.c @@ -28,7 +28,7 @@ static void test_arm64(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int64_t x11 = 0x1234; // X11 register int64_t x13 = 0x6789; // X13 register diff --git a/samples/sample_m68k.c b/samples/sample_m68k.c index 049041cb..b8fef353 100644 --- a/samples/sample_m68k.c +++ b/samples/sample_m68k.c @@ -25,7 +25,7 @@ static void hook_code(ucengine *uc, uint64_t address, uint32_t size, void *user_ static void test_m68k(void) { ucengine *uc; - uc_hook_h trace1, trace2; + uchook trace1, trace2; uc_err err; int d0 = 0x0000; // d0 data register diff --git a/samples/sample_mips.c b/samples/sample_mips.c index 0806f60e..e604563c 100644 --- a/samples/sample_mips.c +++ b/samples/sample_mips.c @@ -29,7 +29,7 @@ static void test_mips_eb(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r1 = 0x6789; // R1 register @@ -78,7 +78,7 @@ static void test_mips_el(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r1 = 0x6789; // R1 register diff --git a/samples/sample_sparc.c b/samples/sample_sparc.c index ab9a9867..540b7d36 100644 --- a/samples/sample_sparc.c +++ b/samples/sample_sparc.c @@ -29,7 +29,7 @@ static void test_sparc(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int g1 = 0x1230; // G1 register int g2 = 0x6789; // G2 register diff --git a/samples/sample_x86.c b/samples/sample_x86.c index 9bdd8232..aecad6b5 100644 --- a/samples/sample_x86.c +++ b/samples/sample_x86.c @@ -171,7 +171,7 @@ static void test_i386(void) ucengine *uc; uc_err err; uint32_t tmp; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r_ecx = 0x1234; // ECX register int r_edx = 0x7890; // EDX register @@ -232,7 +232,7 @@ static void test_i386_jump(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; printf("===================================\n"); printf("Emulate i386 code with jump\n"); @@ -328,7 +328,7 @@ static void test_i386_invalid_mem_read(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r_ecx = 0x1234; // ECX register int r_edx = 0x7890; // EDX register @@ -385,7 +385,7 @@ static void test_i386_invalid_mem_write(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2, trace3; + uchook trace1, trace2, trace3; uint32_t tmp; int r_ecx = 0x1234; // ECX register @@ -457,7 +457,7 @@ static void test_i386_jump_invalid(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r_ecx = 0x1234; // ECX register int r_edx = 0x7890; // EDX register @@ -513,7 +513,7 @@ static void test_i386_inout(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2, trace3, trace4; + uchook trace1, trace2, trace3, trace4; int r_eax = 0x1234; // EAX register int r_ecx = 0x6789; // ECX register @@ -574,7 +574,7 @@ static void test_x86_64(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2, trace3, trace4; + uchook trace1, trace2, trace3, trace4; int64_t rax = 0x71f3029efd49d41d; int64_t rbx = 0xd87b45277f133ddb; @@ -689,7 +689,7 @@ static void test_x86_64(void) static void test_x86_64_syscall(void) { ucengine *uc; - uc_hook_h trace1; + uchook trace1; uc_err err; int64_t rax = 0x100; diff --git a/samples/shellcode.c b/samples/shellcode.c index f185db97..31f72ffc 100644 --- a/samples/shellcode.c +++ b/samples/shellcode.c @@ -90,7 +90,7 @@ static void test_i386(void) { ucengine *uc; uc_err err; - uc_hook_h trace1, trace2; + uchook trace1, trace2; int r_esp = ADDRESS + 0x200000; // ESP register diff --git a/uc.c b/uc.c index 6001e61f..210616bf 100644 --- a/uc.c +++ b/uc.c @@ -521,7 +521,7 @@ uc_err uc_emu_stop(ucengine *uc) static int _hook_code(ucengine *uc, int type, uint64_t begin, uint64_t end, - void *callback, void *user_data, uc_hook_h *hh) + void *callback, void *user_data, uchook *hh) { int i; @@ -537,7 +537,7 @@ static int _hook_code(ucengine *uc, int type, uint64_t begin, uint64_t end, static uc_err _hook_mem_access(ucengine *uc, uc_hook_t type, uint64_t begin, uint64_t end, - void *callback, void *user_data, uc_hook_h *hh) + void *callback, void *user_data, uchook *hh) { int i; @@ -806,7 +806,7 @@ MemoryRegion *memory_mapping(struct uc_struct* uc, uint64_t address) } static uc_err _hook_mem_invalid(struct uc_struct* uc, uc_cb_eventmem_t callback, - void *user_data, uc_hook_h *evh) + void *user_data, uchook *evh) { size_t i; @@ -825,7 +825,7 @@ static uc_err _hook_mem_invalid(struct uc_struct* uc, uc_cb_eventmem_t callback, static uc_err _hook_intr(struct uc_struct* uc, void *callback, - void *user_data, uc_hook_h *evh) + void *user_data, uchook *evh) { size_t i; @@ -844,7 +844,7 @@ static uc_err _hook_intr(struct uc_struct* uc, void *callback, static uc_err _hook_insn(struct uc_struct *uc, unsigned int insn_id, void *callback, - void *user_data, uc_hook_h *evh) + void *user_data, uchook *evh) { size_t i; @@ -895,7 +895,7 @@ static uc_err _hook_insn(struct uc_struct *uc, unsigned int insn_id, void *callb } UNICORN_EXPORT -uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback, void *user_data, ...) +uc_err uc_hook_add(ucengine *uc, uchook *hh, uc_hook_t type, void *callback, void *user_data, ...) { va_list valist; int ret = UC_ERR_OK; @@ -951,7 +951,7 @@ uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback, } UNICORN_EXPORT -uc_err uc_hook_del(ucengine *uc, uc_hook_h hh) +uc_err uc_hook_del(ucengine *uc, uchook hh) { return hook_del(uc, hh); }