Heart and Soul of Windows
Windows stores configuration data in the registry. The registry is a hierarchical database, which can be described as a central repository for configuration data (Microsoft's terminology) or as a configuration database (my terminology). A hierarchical database's characteristics make it ideally suited for storing configuration data. If you lay out the database in a diagram, like the one shown in Figure 1-1, it looks like an outline or an organization chart. This allows settings to be referenced using paths, similar to file paths in Windows. For example, in Figure 1-1, the path A\G\M references the shaded box. Each setting is an ordered pair that associates a value's name with its data. The registry's hierarchical organization makes all settings easy to reference.
Figure 1-1 The registry is a hierarchical database that contains most Windows settings.
You can do nothing in Windows that doesn't access the registry. I use a tool to monitor registry access and often leave it running while clicking around the operating system's user interface. I almost never see this monitor idle. With every click, Windows consults the registry. Every time I launch a program, the operating system consults the registry. Every application that I use looks for its settings in the registry. The registry is certainly the center of attention.
I've written other books about the registry, and in them, I call the registry the operating system's heart and soul. Aside from being a central place to store settings, the registry by its very nature allows complex relationships among different parts of Windows, applications, and the user interface. For example, when you right-click different types of files, you see different shortcut menus. Settings in the registry make this type of context-sensitive user interface possible. The settings for each user who logs on to Windows are separate from those of other users—again, because of the registry. The ability of Windows to use different configurations for laptop computers depending on whether they're docked or undocked is due in large part to the registry. Even Plug and Play depends on the registry.
For Power Users
So the registry is important, but what good does it do power users to learn about it? First, being a technology enthusiast implies that you like to dabble in technology to learn more about it. What better way to learn more about Windows than to figure out how and where it stores settings? This is analogous to tearing apart your VCR to learn how it works. If you've ever wondered why the operating system behaves in a certain way, the answer can often be found by consulting the registry.
Mastering the registry has concrete advantages for power users, too. Because it is the operating system's configuration database, backing up your settings is a bit easier than it would be without the registry. And unlike in the old days when settings were stored in initialization (INI) files, you always know where to begin looking when you need to find a value. But the biggest advantage of mastering the registry is more exciting and very real: you can customize Windows and the applications that run on it in ways that aren't otherwise possible. Windows has thousands of settings that you'll never see in any dialog box, but that you might want to customize. For example, you can redirect your Favorites folder to a different location, improve your Internet connection's performance, and add commands to any type of file's shortcut menu. Chapter 4, “Hacking the Registry,” details many different customization possibilities.
For IT Professionals
IT professionals rely on the registry because it enables most of the management features they use. Large portions of this book focus on those features and how they use the registry.
Policy management is one such feature. IT professionals use policies to configure computer and user settings to a standard, and users can't change those settings. For example, I use policies to configure users' screen savers to lock the desktop after 15 minutes of idle time. This secures the computers if users walk away from their desks without logging off of Windows. Policy management is a great boon to every IT organization because it can lower costs and boost user productivity.
IT professionals can also manage the registry's security so that users can run legacy applications in their restricted accounts instead of logging on to their computers as the administrator (a bad idea in any enterprise environment). You can manage the registry's security directly or by using a tool such as the Security Configuration And Analysis console to automate the process. (For more information on configuring security, see Chapter 8, “Configuring Windows Security.”)
IT professionals can also use a combination of scripts with the registry to automate customizations. One IT professional with whom I worked recently wrote scripts that cleaned up and configured users' computers after installing Windows on them. You can address most needs with a good script.
An indirect but important benefit of the registry for IT professionals is application compatibility. Microsoft defines standards for the locations in which different types of settings belong in the registry. The company has standards for file associations, Plug and Play configuration data, printer settings, application settings, and much more. Applications that follow these standards are more likely to work well with the operating system, as well as other applications, because they're all looking for the same settings in the same places. In fact, most applications that work well in Windows 2000 will also work well in Windows XP and Windows Server 2003, given that the overall structure of the registry doesn't change much between the operating systems.
The registry enables too many other management features for IT professionals to neglect mastering it. (See Figure 1-2.) Some of those features include the following:
Deployment customization
Folder redirection
Hardware profiles
Offline files
Performance monitoring
Roaming user profiles
Windows Management Instrumentation (WMI)
Figure 1-2 The registry enables local and remote administration.
Brief History of the Registry
MS-DOS got its configuration data from Config.sys and Autoexec.bat. The primary purpose of Config.sys was to load device drivers, and the primary purpose of Autoexec.bat was to run programs, set environment variables, and more, to prepare MS-DOS for use. Every application that ran on MS-DOS was responsible for managing its own settings. Neither of these configuration files is useful in Windows.
Windows 3.0 somewhat alleviated the limitations of Autoexec.bat and Config.sys by providing INI files for storing settings. INI files, which you've probably seen, are text files that contain one or more sections with one or more settings in each section. The main problems with INI files are that they provide no hierarchy, storing binary values in them is cumbersome (although not impossible), and they provide no standard for storing similar types of settings. INI files also cause other subtle problems, all related to the configuration file's inability to build complex relationships between applications and the operating system. One big problem for early versions of Windows was the sheer number of INI files that floated around on the average computer. Every application had its own INI files.
Windows 3.1 introduced the registry as a tool for storing OLE (object linking and embedding) settings, and Windows 95 and Microsoft Windows NT 3.5 expanded the registry into the configuration database that Windows XP and Windows Server 2003 use now. Even though INI files are no longer necessary because applications now have a far better way to store settings, you'll always find a handful of INI files, including Win.ini, on any computer.
A few years ago, people were more interested in the history of the registry than they are now. The registry has been around since before 1995, and everyone pretty much takes it for granted these days, so I won't waste any more book pages on its lineage. The history lesson is over; now you're living in the present.