April 15th, 2010

Why are there two values for NoDriveTypeAutoRun which disable Autoplay on drives of unknown type?

The Windows 2000 Resource Kit described the No­Drive­Type­Auto­Run policy as consisting of a bitfield whose values are as follows:

Value Meaning
0x1 Disables Autoplay on drives of unknown type.
0x4 Disables Autoplay on removable drives.
0x8 Disables Autoplay on fixed drives.
0x10 Disables Autoplay on network drives.
0x20 Disables Autoplay on CD-ROM drives.
0x40 Disables Autoplay on RAM drives.
0x80 Disables Autoplay on drives of unknown type.
0xFF Disables Autoplay on all types of drives.

Hey, wait, two of the entries are the same. What’s the difference between 0x1 (Disables Autoplay on drives of unknown type) and 0x80 (Disables Autoplay on drives of unknown type)?

The values in the bitfield correspond to return values of the Get­Drive­Type function:

#define DRIVE_UNKNOWN     0
#define DRIVE_NO_ROOT_DIR 1
#define DRIVE_REMOVABLE   2
#define DRIVE_FIXED       3
#define DRIVE_REMOTE      4
#define DRIVE_CDROM       5
#define DRIVE_RAMDISK     6

The value 0x1 corresponds to bit zero, which means that the Get­Drive­Type function could not tell what type of drive it is.

On the other hand, the value 0x80 does not correspond to any known return value of Get­Drive­Type. It’s reserved for future use.

My guess as to how this happened is that the original table did not have an entry for 0x80. Then somebody asked, “What does 0x80 mean?”

The response was, “It’s not used yet. It’s for some future unknown drive type that has yet to be invented.”

“Okay, thanks. I’ll just say that the drive type is unknown.”

Bingo, now you have two copies of “drives of unknown type.” The 0x1 means “drives whose type cannot be determined” whereas the 0x80 means “drives of a type not currently known to mankind.”

So let’s just pretend that the entry for 0x80 reads “Reserved for future use.” (The page is archived content, so it’s not like anybody’s going to be updating it.)

Pre-emptive snarky comment: “Autoplay is the stupidest feature on the face of the planet.” The issue here is not discussing whether Autoplay is a good idea or bad idea. I’m trying to improve the documentation. I try to avoid providing tips/support about controversial features because of the flame-fest that invariably results. This is an experiment to see if it’s safe to go back into the water.

Update: Comments have been disabled because everybody wants to discuss whether Autoplay is a good idea or not, even though that topic was explicitly taken off the table. Strike two.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.