Minor fix for uc_ctl

This commit is contained in:
lazymio
2021-11-08 20:40:02 +01:00
parent 06f454d513
commit e836b62e01
3 changed files with 8 additions and 5 deletions

View File

@ -473,7 +473,8 @@ typedef enum uc_query_type {
// The arguments include both input and output arugments. // The arguments include both input and output arugments.
#define UC_CTL_IO_READ_WRITE (UC_CTL_IO_WRITE | UC_CTL_IO_READ) #define UC_CTL_IO_READ_WRITE (UC_CTL_IO_WRITE | UC_CTL_IO_READ)
#define UC_CTL(type, nr, rw) ((type) | ((nr) << 26) | ((rw) << 30)) #define UC_CTL(type, nr, rw) \
(uc_control_type)((type) | ((nr) << 26) | ((rw) << 30))
#define UC_CTL_NONE(type, nr) UC_CTL(type, nr, UC_CTL_IO_NONE) #define UC_CTL_NONE(type, nr) UC_CTL(type, nr, UC_CTL_IO_NONE)
#define UC_CTL_READ(type, nr) UC_CTL(type, nr, UC_CTL_IO_READ) #define UC_CTL_READ(type, nr) UC_CTL(type, nr, UC_CTL_IO_READ)
#define UC_CTL_WRITE(type, nr) UC_CTL(type, nr, UC_CTL_IO_WRITE) #define UC_CTL_WRITE(type, nr) UC_CTL(type, nr, UC_CTL_IO_WRITE)
@ -536,8 +537,10 @@ typedef enum uc_control_type {
uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_ARCH, 1), (arch)) uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_ARCH, 1), (arch))
#define uc_ctl_get_timeout(uc, ptr) \ #define uc_ctl_get_timeout(uc, ptr) \
uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_TIMEOUT, 1), (ptr)) uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_TIMEOUT, 1), (ptr))
#define uc_ctl_exits_enabled(uc, enabled) \ #define uc_ctl_exits_enable(uc) \
uc_ctl(uc, UC_CTL_WRITE(UC_CTL_UC_USE_EXITS, 1), (enabled)) uc_ctl(uc, UC_CTL_WRITE(UC_CTL_UC_USE_EXITS, 1), 1)
#define uc_ctl_exits_disable(uc) \
uc_ctl(uc, UC_CTL_WRITE(UC_CTL_UC_USE_EXITS, 1), 0)
#define uc_ctl_get_exits_cnt(uc, ptr) \ #define uc_ctl_get_exits_cnt(uc, ptr) \
uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_EXITS_CNT, 1), (ptr)) uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_EXITS_CNT, 1), (ptr))
#define uc_ctl_get_exits(uc, buffer, len) \ #define uc_ctl_get_exits(uc, buffer, len) \

View File

@ -118,7 +118,7 @@ void test_uc_ctl_exits()
} }
// Enable multiple exits. // Enable multiple exits.
err = uc_ctl_exits_enabled(uc, true); err = uc_ctl_exits_enable(uc);
if (err) { if (err) {
printf("Failed on uc_ctl() with error returned: %u\n", err); printf("Failed on uc_ctl() with error returned: %u\n", err);
return; return;

View File

@ -88,7 +88,7 @@ static void test_uc_ctl_exits()
uint64_t exits[] = {code_start + 6, code_start + 8}; uint64_t exits[] = {code_start + 6, code_start + 8};
uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_32, code, sizeof(code) - 1); uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_32, code, sizeof(code) - 1);
OK(uc_ctl_exits_enabled(uc, true)); OK(uc_ctl_exits_enable(uc));
OK(uc_ctl_set_exits(uc, exits, 2)); OK(uc_ctl_set_exits(uc, exits, 2));
r_eax = 0; r_eax = 0;
r_ebx = 0; r_ebx = 0;