Helping people with computers... one answer at a time.
There are many potential ways to store program and system settings. Windows uses the registry. It's very complex, but its intentions were good.
Why does Windows have a registry? What's the benefit? What was so bad about older programs that could work all alone in their own directory?
I'm sure that any of us who've faced registry corruption have asked this question. As has anyone looking to twiddle by hand some obscure setting in a program.
In "the old days" settings were often kept in plain text files which in turn were kept with the program. Easy to find, easy to edit.
The Windows Registry changed all that.
If it helps any, the intentions were good.
The Windows Registry is a central database of organized program and system settings and information.
That all sounds very simple in concept, but in fact it's incredibly complex.
The registry exists to address a couple of basic issues and implement a couple of basic features:
Separation of "machine" settings from "user" settings. There are certain settings that apply to the machine - your network configuration perhaps. Other settings apply only to the user of that machine - say a color scheme or font size. In the past there was little need for distinction, but that has changed as we'll shortly see. The "HKEY_Local_Machine" and "HKEY_Current_User" branches of the registry are the most obvious place where this distinction is visible.
Support for different settings for different users. This is more complex than it appears. Windows is actually a multi-user operating system. Depending on your version that could mean multiple users at once, using Terminal Services on Windows Server, or only one of several different users at a time on all other versions. Somehow Windows needs to track that fact that you like your settings one way, while another person logging onto that same machine might like things another way. And yet the software that responds to those settings needs a quick and easy way to look for the settings it needs for the currently logged in user. The various sub branches of the "HKEY_Users" and the way that they "appear" as "HKEY_Current_User" depending on who's logged in are the primary drivers of this distinction.
A centralized location for shared software. One of Windows' earliest goals was to make it easy to share software components. Rather than re-inventing the software to do something, multiple programs could use the functionality exposed in a single DLL. The registry provides a central and standardized place to locate the components that provide shared functionality.
Roaming support. This isn't something that most home users ever see. In fact many corporate installs never bother with this either, but the registry is an important component of roaming. When properly set, your settings - even your desktop - can be made available on any machine you happen to log into. (I've never actually seen it in use, and I understand it's difficult to set up.)
Registry level security. The registry supports the full Windows security model. That means that access to individual settings can be restricted.
Now, while you can argue whether or not the registry actually achieves these goals (in my opinion it actually does) or whether it needs to even have some of these goals (the jury's out), there's little arguing that it does all this in an exceptionally complex way.
On top of that, and in part because it's so complex, the registry has been abused to no end. The most common offenders are applications that don't uninstall their settings when they themselves are uninstalled. Once the application is gone it's often difficult to identify the registry keys that are "left over" and no longer actually in use. Doing so is one of the functions of a registry cleaner.
Personally, I'd prefer text based setting files, perhaps organized in a way to achieve most of the goals listed above. Linux certainly seems to do this fairly well. But regardless of why the registry is what it is, it's what we have under Windows.
The good news is that most folks never really need to know or care about the registry. Applications and the operating system as well as the occasional utility or toolkit typically handle putting a more reasonable user interface on managing most registry settings that users might want to change.
Unfortunately exceptions do happen, and they can be daunting.
Comments on this entry are closed.
If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.
If you don't find your answer, head out to http://askleo.com/ask to ask your question.