facebook / fishhook

A library that enables dynamically rebinding symbols in Mach-O binaries running on iOS.
BSD 3-Clause "New" or "Revised" License
5.18k stars 966 forks source link

Save previous pointer automatically #18

Closed uroboro closed 8 years ago

uroboro commented 8 years ago

Removes the need to do so manually via dlsym calls. Also allows having multiple hooks on the same symbol.

facebook-github-bot commented 8 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

facebook-github-bot commented 8 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

grp commented 8 years ago

I like this, but it does change the API for existing users. What's the motivation for the change?

uroboro commented 8 years ago

Besides the two reasons on the first comment, it was done to have a similar hooking interface as other projects like cydiasubstrate's MSHookFunction, rd_route's rd_route, mach_override's mach_override_ptr and substitute's substitute_hook_functions. The first three having an interface that accepts the target function symbol, its replacement and a pointer to save the previous address in. Using the address dlsym returns would skip all other hooks when calling the original implementation.

grp commented 8 years ago

Sounds good. I'm okay with breaking compatibility since fishhook is mostly for debugging anyway. :)

grp commented 8 years ago

Thanks!

uroboro commented 8 years ago

No problem!

kastiglione commented 8 years ago

:cake:

tirodkar commented 8 years ago

The current podspec with the tag pointing to release 0.1 does not include this change. Could we have the podspec point to master or create a new release 0.2 with this change?