Effective code injection for Snow Leopard 64-bit apps?

Recently I’m looking for a way to make [Safari AdBlock](http://burgersoftware.com/en/safariadblock) support Safari in 64-bit.

64-bit apps stopped loading [Input Manager](http://www.cocoadev.com/index.pl?InputManager) bundles, so it is impossible to use [SIMBL](http://www.culater.net/software/SIMBL/SIMBL.php) in 64-bit apps either. Neither does [PlugSuit](http://infinite-labs.net/plugsuit/) (which is using [mach_inject](http://rentzsch.com/mach_inject/)). The [web plugin solution](http://www.switchersblog.com/2007/08/the-end-of-th-2.html) suggested by 1Password team stopped working too. Frankly, I think it’s time to start looking for a better code injection technique for 64-bit Snow Leopard apps seriously.

What still works?

1. [Scripting Additions](http://developer.apple.com/technotes/tn/tn1164.html), it’s what 1Password using for all its plugins (for Safari, WebKit, Camino, NetNewsWire, etc.), basically it works for all apps that support Apple Scripts, but the problem is you’ll need to run a daemon to watch the launch of these apps, then send a custom Apple event to trigger the initialization of the code you inject.

2. Use a DYLD constructor as initialization point, then use `DYLD_INSERT_LIBRARIES` or techniques described [in this faq](http://www.mikeash.com/?page=pyblog/friday-qa-2009-01-30-code-injection.html) to trigger the load of this bundle or dynamic library. The problem is you will need all the users to modify their environment variables, which is cumbersome.

Is there any other solution? I’ll be glad to hear.

Author: Jiang Jiang

A software engineer from China, working on some OS for a fruit company. Interested in typography and science fiction.

One thought on “Effective code injection for Snow Leopard 64-bit apps?”

  1. SIMBL now works for 64 bit. I think using SIMBL is a good solution, because the code injection problem is done by SIMBL, and you don’t have to worry about it.

    SIMBL works using scripting additions at the moment I think.

Leave a Reply

Your email address will not be published. Required fields are marked *