Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 uc_hook_add 的代码示例 #2

Open
Aryb1n opened this issue Apr 23, 2023 · 0 comments
Open

关于 uc_hook_add 的代码示例 #2

Aryb1n opened this issue Apr 23, 2023 · 0 comments

Comments

@Aryb1n
Copy link

Aryb1n commented Apr 23, 2023

您好,学习时看到,uc_hook_add 的代码示例中,这里是否有点笔误

// 这样只有两个参数的回调是否是应该用于 UC_HOOK_INSN 的类型的回调
void hook_syscall(uc_engine* uc, void* user_data)
{
    int i;

    uc_reg_read_batch(uc, syscall_abi, ptrs, 7);

    printf("syscall: {");

    for (i = 0; i < 7; i++) {
        if (i != 0) printf(", ");
        printf("%" PRIu64, vals[i]);
    }

    printf("}\n");
}

int main()
{
    // 如果 Hook 的类型是 UC_HOOK_CODE,是否 回调应该是有四个参数
    if ((err = uc_hook_add(uc, &sys_hook, UC_HOOK_CODE, hook_syscall, NULL, 1, 0))) {
        uc_perror("uc_hook_add", err);
        return 1;
    }
    // ...
}

感谢抽空解惑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant