Removing iTunes 10.4 m3u processing feature with a small loader

I just discovered that iTunes 10.4 finally introduced support to load m3u files. If you are importing large quantities of MP3 archives like me then you probably will be very annoyed by the mess that iTunes 10.4 will make out of this – playlists will be created and a ugly mess will emerge (and takes longer to process). So it was time to try to remove this feature, which is curious since I always wanted this in iTunes, before I surrended myself to its way of managing MP3s. A quick Google search shows that I am not the only one having “issues” with this new feature.

First attempt was to disassemble and search for the code. Well, iTunes is a huge program and I just wanted a quick hack (I did find more or less where the interesting code is). So why not searching for the string m3u and modify it? Most probably iTunes was processing the files based on extension and modifying that string would effectively remove this feature.

A quick test with GDB and voila, it works. No more m3u/m3u8 (unicode version) processing! Hurray. To make the change effective there are two solutions; first patch the binary, which would require an update to codesign, second create a small loader to patch the strings in memory, leaving the original binary intact. Second one is more fun, so here it is, a small loader for iTunes 10.4.1 that will remove this feature. For now it’s 32 bit only, which is the version that runs on Snow Leopard. I will test later with Lion.

To use this loader, execute the following commands in Terminal.app (after downloading and unpacking the loader.gz):

$ sudo cp /Applications/iTunes.app/Contents/MacOS/iTunes /Applications/iTunes.app/Contents/MacOS/iTunes.orig
$ sudo cp loader /Applications/iTunes.app/Contents/MacOS/iTunes
$ sudo chgrp procmod /Applications/iTunes.app/Contents/MacOS/iTunes
$ sudo chmod g+s /Applications/iTunes.app/Contents/MacOS/iTunes

And that’s it, you can click the usual iTunes icon. The program will start and no more m3u processing! If you check Activity Monitor, you will have two iTunes processes, one with a very small memory footprint (the loader), and another the real iTunes. When you exit iTunes the loader will also exit, so everything is nice & clean.

I might improve this loader to be smart and support any new iTunes updates, and maybe create a Cocoa application to launch iTunes with this m3u enabled or disabled. I need a small excuse to start coding Cocoa apps.

Have fun,
fG!

loader.gz
SHA256(loader)= 4cff14a3e2e5a58d4de22c74a064ab3448bdb63210440c232bedcd410acefdbf

Update:

Here it is a version that should work with all future iTunes updates and also for Lion with ASLR support (ASLR isn’t disabled by the loader!). Install as in the previous version.

loaderv2_snowleopard.gz
SHA256(loaderv2_snowleopard)= 35453a6622699cc60fa4edb5def8b0d597c56e2850c3d165b1d080fe31c97cfe

loaderv2_lion.gz
SHA256(loaderv2_lion)= 7d0bd9934042141061710abea349284c553afdaee90342d4034bd9a916e6d099