-
Notifications
You must be signed in to change notification settings - Fork 746
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
使用过程中一点疑问 #17
Comments
补充下,test2中的my_test_add函数:
|
你的意思是app中hook第一个点能成功,再加一个点就失败了? 你需要在调用xhook_refresh之前一次性注册完所有的hook点(用xhook_register),一旦调用过xhook_refresh之后,就不能调用xhook_register了(如果调用会有警告输出)。 这么设计主要是性能方面的考虑,xhook内部会维护一个map,用于记录所有注册的hook点、已hook成功的点、当前进程加载的so列表等信息,避免在下次调用xhook_refresh时执行重复的不必要的hook。 |
我没完全表述清楚,不好意思。test1和test2是两个不同的app,test1主要是我用来测试是否支持hook自身模块内函数功能,也是就Hook test_add函数。test1测试的时候是可以的。然后我把这个功能用在我的test2上,test2是我的app,测试hook tt_add函数,发现不能实现hook。 |
xhook只支持PLT/GOT hook方式,即hook调用者so中的对外调用点,不支持对包含目标函数实现的so本身进行hook。可以看下这个:https://github.com/iqiyi/xHook/blob/master/docs/overview/android_plt_hook_overview.zh-CN.md |
谢谢,刚重新分析了,是这样,再次谢谢你的回答 。 |
不客气。 |
我在使用的过程中遇到一个问题,没想明白,所以来提问。
首先我写了一个测试demo,如下代码:
写了一个jni的调用,
使用xhook写一个Hook模块,如下代码,
hook.so
运行demo后,实际能hook到xhooktest.so中的test_add方法,
test1的日志:
这里的调用关系为,首先通过xhook来注册hook函数,接着调用hooktest.so中的函数test_add。这个test_add函数在hooktest.so中的,通过jni方法调用。
但是现在 有个问题是,按照上面的步骤,写另一个hooktest2.so的时候,调用里边的函数tt_add,如下
代码:
hook.so
hooktest2.so的代码:
test2日志如下:
请问下这时什么问题导致的?
The text was updated successfully, but these errors were encountered: