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

Raymond Chen

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.

0 comments

Discussion is closed.

Feedback usabilla icon