Search code examples
c++ioshookjailbreaktweak

Cannot hook certain library calls using MSHookFunction


I'm having trouble using MobileSubstrate's MSHookFunction() to hook certain library function calls. For example, hooking memcpy and memset causes a crash on app launch however hooking memcmp works fine.

I assume that this is because the hooking code itself uses those function calls?

Is there any way to hook memcpy and memset on iOS?


Solution

  • I never got to the bottom of this. I was thinking that maybe MobileSubstrate calls functions in the same memory page that I'm trying to hook and therefore the mem protections get all messed up.

    I got around this by writing my own hooking function.