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
Patch Hook for sub_123abc Not Working #10
Comments
What did you add to the following structure?
It should have been something like:
Otherwise your code looks fine, and should have worked. Your hook should work on any thread. Though it's conceivable that LogWithFormat() might not have worked, for some reason. Try putting in a NULL dereference and see what happens. Spotify should crash, of course. |
Thank you for the response. I wasn't quite sure what to do with the user_hooks. I added the |
One other thing I didn't notice before: HC_INSERT_LIBRARY needs to be a full path. As for your compile problem ... I have no idea at all :-( |
Yet one more thing: The HookCase extension displays useful error messages in the Console app, if the Console app is running before you try to use HC_INSERT_LIBRARY. They all begin with "HookCase", so you can filter on that. |
So this is embarrassing but the compiler errors were because I accidentally put the hook in the |
So it looks like the subroutine I was hooking isn't actually called? I hooked a subroutine that is always called in the entry point and I received the log message. It looks like the code was fine, my understanding of how Spotify deals with media control keys was the problem. |
Actually I've discovered a bug here -- just not the one you reported. To work around it, use full paths both in HC_INSERT_LIBRARY and the executable. For example:
I'll open an issue on it when I understand it more fully. |
First of all, I'd like to say this is an impressive project (even though I don't understand half the code).
So I am trying to insert a hook into the Spotify app so I can keep track of what songs I skip. In IDA, I found the procedure that handles the media control keys. I found that the code is identical to that in https://github.com/nevyn/SPMediaKeyTap so I was able to obtain the function signature.
I basically copy and pasted your template library and added the following code to hook the desired, unnamed procedure:
However, when I run with
HC_INSERT_LIBRARY=skiphook.dylib /Applications/Spotify.app/Contents/MacOS/Spotify
, I get no output when using the media control keys.The only thing I can think of is that this procedure is passed as a callback, so it presumably runs on not the main thread. Would this affect the hook?
The text was updated successfully, but these errors were encountered: