We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
你好,我通过 xhook 成功 hook libc.so 了 clock_gettime 和 gettimeofday 函数,如下代码: xhook_register(".*/libc.so", "gettimeofday", (void )gettimeofday_docker, (void **)&real_gettimeofday); xhook_register("./libc.so", "clock_gettime", (void *)clock_gettime_docker, (void **)&real_clock_gettime); xhook_refresh(0);
我的问题是: 问题现象: 我想通过 hook 的函数修改原有函数的返回值,这些返回值是通过函数的参数返回回去的,如 gettimeofday 函数的参数 timev 会返回用户需要获取的时间:int gettimeofday_docker(struct timeval *timev, struct timezone *timez),我先用 real_gettimeofday 函数获取系统真正的时间,进行修改后,通过 gettimeofday_docker 的参数 timev 返回给用户,但实际测试效果是修改不生效。
请问,我该如何做才能让返回值生效,感谢回复。
The text was updated successfully, but these errors were encountered:
第一个参数换成".*\.so$"试试,xhook修改的是其他so的对libc的引用,而不是libc本身
Sorry, something went wrong.
No branches or pull requests
你好,我通过 xhook 成功 hook libc.so 了 clock_gettime 和 gettimeofday 函数,如下代码:
xhook_register(".*/libc.so", "gettimeofday", (void )gettimeofday_docker, (void **)&real_gettimeofday);
xhook_register("./libc.so", "clock_gettime", (void *)clock_gettime_docker, (void **)&real_clock_gettime);
xhook_refresh(0);
我的问题是:
问题现象:
我想通过 hook 的函数修改原有函数的返回值,这些返回值是通过函数的参数返回回去的,如 gettimeofday 函数的参数 timev 会返回用户需要获取的时间:int gettimeofday_docker(struct timeval *timev, struct timezone *timez),我先用 real_gettimeofday 函数获取系统真正的时间,进行修改后,通过 gettimeofday_docker 的参数 timev 返回给用户,但实际测试效果是修改不生效。
请问,我该如何做才能让返回值生效,感谢回复。
The text was updated successfully, but these errors were encountered: