Share via


Windows ConfidentialLooking Smart by Being Stupid

Raymond Chen

WHEN YOU insert a CD into your computer, Windows® might ask you what it should do-even though you told it what to do last time. Why does Windows forget your autoplay settings? Well, it doesn't; it's just double-checking with you.

There were two problems with the way Windows XP handled CD autoplay. First, many users found that after installing a program that supported CD autoplay, they didn't know how to make that program their new default CD autoplay program. If they had previously selected a program and ticked "Always perform this action," there was no easily discoverable way to undo the always flag to cause the CD autoplay dialog to reappear and give the user an opportunity to select the new program as the default.

Second, certain poorly behaved programs, upon installation, secretly hacked the undocumented CD autoplay settings in order to set themselves as the default CD autoplay handler-thus, overriding the user's choice.

Simply put, for users the two problems were: "I just installed this program and I want it to be my CD autoplay program," and its converse "I just installed this program and I don't want it to be the CD autoplay program."

Windows Vista treats autoplay settings globally

Windows Vista treats autoplay settings globally(Click the image for a larger view)

Windows XP Service Pack 2 (SP2) introduced new CD autoplay behavior in an attempt to address these problems. When it sees that a new CD autoplay handler is available, Windows now shows you the CD autoplay dialog one more time. This gives you a chance to pick that new program you just installed or un-pick that program you just installed if it was rude enough to set itself as the new default player.

You also get the CD autoplay dialog the first time you insert a CD after upgrading to Windows XP SP2. This is a "better late than never" dialog, meant to address any handlers that were installed before you upgraded to Windows XP SP2.

In the old days, the OS only had to concern itself with helping developers interface with a feature. But, in the current software landscape, it also has to worry about stopping programmers who are trying to abuse that interface.

There's another case where it may appear that Windows has forgotten your autoplay settings. When you insert a removable storage device, such as a USB drive, you may get prompted even though you've already selected an option and ticked "Always perform this action." This is not because Windows has forgotten your settings, but rather that it remembered them all too well.

When you select an option for a removable storage device, Windows remembers the setting for that device. If you plug in a different device, you get a new prompt since you didn't specify how you wanted this different device to behave. The intent of this design is so you can say that your digital camera should default to "View pictures" whereas your music player should default to "Play music." (If the device doesn't have a serial number, then plugging it into a different USB port causes it to be treated as a different device.)

In response to the confusion created by the Windows XP design, the behavior has changed in Windows Vista™. The autoplay settings are now treated as global rather than per-device. If you say "Take no action," then Windows Vista will take no action regardless of which device you insert or where you plug it in. Sometimes the way to make the operating system look smarter is to make it more stupid.

Raymond Chen's Web site, The Old New Thing (blogs.msdn.com/oldnewthing), and identically titled book (Addison-Wesley, 2007) deal with Windows history and Win32 programming. In his spare time, he has been known to score 7th grade essays.

© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.