March 22nd, 2011

Why is there the message '!Do not use this registry key' in the registry?

Under Software\Microsoft\Windows\Current­Version\Explorer\Shell Folders, there is a message to registry snoopers: The first value is called “!Do not use this registry key” and the associated data is the message “Use the SH­Get­Folder­Path or SH­Get­Known­Folder­Path function instead.” I added that message. The long and sad story of the Shell Folders key explains that the registry key exists only to retain backward compatibility with four programs written in 1994. There’s also a TechNet version of the article which is just as sad but not as long. One customer saw this message and complained, “That registry key and that TechNet article explain how to obtain the current locations of those special folders, but they don’t explain how to change them. This type of woefully inadequate documentation only makes the problem worse.” Hey, wow, a little message in a registry key and a magazine article are now “documentation”! The TechNet article is historical background. And the registry key is just a gentle nudge. Neither is documentation. It’s not like I’m going to put a complete copy of the documentation into a registry key. Documentation lives in places like MSDN. But it seems that some people need more than a nudge; they need a shove. Let’s see, we’re told that the functions for obtaining the locations of known folders are SH­Get­Folder­Path and its more modern counterpart SH­Get­Known­Folder­Path. I wonder what the names of the functions for modifying those locations might be? Man that’s a tough one. I’ll let you puzzle that out for a while. Okay, here, I’ll tell you: The corresponding functions go by the completely unobvious names SH­Set­Folder­Path and SH­Set­Known­Folder­Path.

Sorry you had to use your brain. I’ll let you get back to programming now.

Topics
History

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.