Antibioticss / tinyhook

A tiny macOS inline hook framework
MIT License
9 stars 2 forks source link

More Examples? #2

Open TheKidThatCodes opened 1 week ago

TheKidThatCodes commented 1 week ago

would it be possible if an example of how to hook a function at an offset in the main binary, from an included dylib also, clang is telling me it does not like your void pointer arithmetic

Antibioticss commented 18 hours ago

You need to get the address of the function you want to hook in the memory, then hook it like this

tiny_hook(your_function_address, your_hook_function, NULL);

You can use _dyld_get_image_vmaddr_slide to get the start of the image, then add an offset to get the function address.