Skip to content

Autorun.inf is painful – and it doesn’t need to be

I’m finishing up a special promotional DVD project where I’ll be giving out some DVDs of content at the Microsoft SharePoint Conference. Those DVDs will contain videos encoded for Silverlight playback at 1024×768 so I can’t transcode them to play on a regular DVD player – I needed to make them automatically start an HTML page which had the Silverlight Video player on it. That’s what autorun.inf is supposed to do – allow you to directly start content when media is inserted. The problem is that it has been exploited on USB drives to spread viruses so now there are all sorts of restrictions and things that used to work don’t necessarily work any longer. The frustrating part is that you won’t know why your file isn’t working because there are all sorts of old posts with success.

The autorun.inf file is a variation of the INI file format which contains a single header, [autorun], followed by a set of values including open, icon, and shellexecute. Open and shellexecute are supposed to be what happens when someone opens the media or when it’s inserted respectfully. Icon is a link to an icon file which should be displayed for the drive. It seems simple enough – except that it’s not.

If you provde an html file the file won’t start. There are enough posts on this on the Internet about how you have to have a "runner" since directly starting html files isn’t supported. OK, I’m good at batch files. I create a .bat file and try it again. That doesn’t work. I try every variation of capitalization and variation of options trying to figure out what’s going on. It doesn’t work and I email a friend who tells me that there are continuing problems and that many folks are using all sorts of pre-made runners. Well, being a developer I decided to write my own – because that’s the way I roll.

Mine I decided should have two modes. The first mode would be accepting parameters on the command line and just running whatever is found there. However, I thought that users might just click on the autorun.exe that I was creating so I needed another way to get the command and parameters and so I created an option that if there were no parameters I’d read from a .cfg file. It’s a .cfg file because it’s a simple text file, it’s not an XML based .config file. Other than some silly bugs because I was tired all worked well and when I used the autorun.exe in the autorun.inf file it started working. This left me with just one problem – and it’s one I chose not to solve. When my DVD pops in I get a dialog:

(I purposefully blurred out the icon and the disc title so you can come ask me about it at the conference if you want to know more about it.) The problem in the dialog is that the Publisher not specified appears. As it turns out the problem is that I don’t have a code signing certificate from a trusted root. As a result the Autoplay dialog won’t show my name. I decided that I didn’t need a code signing certificate for just this. If I were developing lots of software that needed to be signed I’d probably get a cert but at several hundred dollars per year it seemed like overkill for this.

So the good news is that I did solve it – and I came up with a good testing process. I’d use Nero Burning ROM to create an ISO image through the image writer virtual burner. I’d then use MagicDisc to mount the ISO on my system. This even would work through VMWare so I could test XP – which is what lead me to the understanding that XP would play my autorun.inf and Windows 7 wouldn’t so it had to be issues w/ protection.

So, how could the experience be better? Windows could tell you it is blocking autorun information because of security concerns and offer to allow you to override it. I would have still worked at a supportable workaround – like the one I found, but it would definitely reduce the head scratching as I’m trying to figure out how I could be messing up something that’s supposed to be drop-dead simple.

I love it when the simple things become complicated – not.

1 Comment

  1. I found a way to have a web html launch from autorun.inf.
    the autorun.inf-
    [autorun]
    shellexecute=startup.cmd /min
    icon=MakeAWeb.ico
    ;Theicon file should also reside in the root directory of the CD
    the startup.cmd
    start “yourfilename”.html. substitute your root filename for “yourfilename”


Add a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: