Giter VIP home page Giter VIP logo

Comments (6)

BiteFoo avatar BiteFoo commented on May 18, 2024

补充下,test2中的my_test_add函数:

static void  my_test_add(int a,int b){
    __android_log_print(ANDROID_LOG_ERROR, "XHOOK====>> before ","a=%d ,b=%d", a,b);
    a=200;
    __android_log_print(ANDROID_LOG_ERROR, "XHOOK====>> after ","a=%d ,b=%d", a,b);
     ori_testadd(a,b);
}

from xhook.

caikelun avatar caikelun commented on May 18, 2024

你的意思是app中hook第一个点能成功,再加一个点就失败了?

你需要在调用xhook_refresh之前一次性注册完所有的hook点(用xhook_register),一旦调用过xhook_refresh之后,就不能调用xhook_register了(如果调用会有警告输出)。

这么设计主要是性能方面的考虑,xhook内部会维护一个map,用于记录所有注册的hook点、已hook成功的点、当前进程加载的so列表等信息,避免在下次调用xhook_refresh时执行重复的不必要的hook。

from xhook.

BiteFoo avatar BiteFoo commented on May 18, 2024

我没完全表述清楚,不好意思。test1和test2是两个不同的app,test1主要是我用来测试是否支持hook自身模块内函数功能,也是就Hook test_add函数。test1测试的时候是可以的。然后我把这个功能用在我的test2上,test2是我的app,测试hook tt_add函数,发现不能实现hook。

from xhook.

caikelun avatar caikelun commented on May 18, 2024

xhook只支持PLT/GOT hook方式,即hook调用者so中的对外调用点,不支持对包含目标函数实现的so本身进行hook。可以看下这个:https://github.com/iqiyi/xHook/blob/master/docs/overview/android_plt_hook_overview.zh-CN.md

from xhook.

BiteFoo avatar BiteFoo commented on May 18, 2024

谢谢,刚重新分析了,是这样,再次谢谢你的回答 。

from xhook.

caikelun avatar caikelun commented on May 18, 2024

不客气。

from xhook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.