Question

I have an app that loads a CFPlugin, not a problem, using the Apple boiler plate code.

The plugin has a bug - and its someone else's binary...

The plugin makes some calls into an Apple System Framework. If I could intercept the calls that the plugin wants to make to the framework, then all would be well. I don't even need to then call the 'real' versions. Essentially I want to call my version instead of Apple's CF based routine.

Intercepting calls to a framework call works in my code in my app, but the plugin still calls the 'real' framework call instead of my interception.

I'm not really a dyld expert, but it seems that the plugin, although in the address space of my app, somehow loads its own version of the Apple Framework?

Is there some magic I can do when loading the plugin, etc to have it call my interception code?

Was it helpful?

Solution

1) do DYLD interposing in a separate libFix.dylib as described in Amit's book: http://osxbook.com (involving __interpose DATA section)

2) use DYLD_INSERT_LIBRARIES=/path/to/libFix.dylib prior launching your app

this guy's comment may also help: http://www.mikeash.com/pyblog/friday-qa-2009-01-30-code-injection.html#comment-3fb6e4b8cf65ec984e7836e2b86a2875

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top