Image of Navigational Map linked to Home / Contents / Search Testing Autorun

by Mark Trescowthick - GUI Computing
Image of Line Break

It's amazing the odd things which attract attention on the Net... by far the largest response I've ever had to an article (and I'm still getting responses!) has been to a small piece I wrote over a year ago on using Microsoft's Autorun.

1998 Update : Those interested in AutoRunning HTML should click here - I still get more mail on this subject than almost any other!

Specifically, I complained that testing Autorun.inf files was a pain because cutting CDs was expensive. I've had a dozen or more responses and suggestions to overcome that problem, ranging from the innovative to the downright amazing. In fact, though, it's a problem that even Microsoft have addressed, in a Knowledgebase article at http://support.microsoft.com/support/kb/articles/q136/2/14.asp.

This small follow-up piece, then is really none of my work. It's a combination of Microsoft's and a number of readers' ingenuity. I apologise in advance to the readers in question for not crediting them directly, but multiple readers suggested similar techniques...

The Microsoft Way

There is a neat registry setting under Win95 (and perhaps under NT4 - I haven't checked) which controls on what media Autorun will work. The registry key in question is :

HKEY_CURRENT_USER\ 
   Software\
      Microsoft\
         Windows\
            CurrentVersion\
               Policies\
                  Explorer\
                     "NoDriveTypeAutoRun"

Badly named if you ask me, but there it is.

This is a 4-byte key, of which only the first byte is used. The other three bytes should be set to zero. This is a bitmask, with the bits corresponding to :

Type                   Bit
DRIVE_UNKNOWN       	0
DRIVE_NO_ROOT_DIR   	1
DRIVE_REMOVABLE     	2
DRIVE_FIXED         	3
DRIVE_REMOTE        	4
DRIVE_CDROM         	5
DRIVE_RAMDISK       	6

By default, this mask is set to 0x95, disabling Autorun on anything other than a local CD-ROM. Simply changing that mask to, for example, 0x91, will enable Autorun for floppy disks as well, though you'll probably need to force a refresh after inserting a floppy to get things started.

Ideal, though, for testing. If you can fit what you need on a floppy... if not, one great suggestion I had was to use a zip drive - and if 100MB isn't enough for you, well, I suggest you look at just what your Autorun is actually doing...

The Old-fashioned Way

There are still some DOS hackers out there, it would seem. Or, more precisely, some hackers who haven't forgotten...

Almost the first suggestion I received was to use good old SUBST to fool Win95 into using Autorun on part of a hard drive. Now, given the information is in the Knowledgebase, I can't really see why this should work (the default bitmask actually excludes DRIVE_UNKNOWN), but work it does. Sort of.

If you use SUBST to create a new logical drive, then the first time Win95 recognises it, it triggers the Autorun.inf present in the new drive's "root". But only the first time. This is, presumably, a handy side effect of an obscure bug/feature in Win95, but comes in very handy when you don't really want to hack around in the registry just to do a simple test. And, let's face it, most PCs have plenty of unused drive assignments...

I still think Autorun is a bit of a pain at times (the default in Explorer should always be to Explore, and Autorun allows you to change that) but at least I now have testing the damn thing under control.

My thanks to the many readers who took the time to email me suggestions, and my apologies for taking so long getting around to writing them up.



Written by: Mark Trescowthick
March '97

Image of Arrow linked to Previous Article
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]