Chapter 38: Registering Programs and File Types
What Is the Registry? Early versions of Windows scattered configuration settings among dozens of different files. Many settings were stored in C:\Windows\Win.ini and C:\Windows\System.ini, but programs were as likely to use their own INI files as the standard ones, and there was no consistency in the way that INI files were created and maintained. In Windows 95, Microsoft created the Registry, a single centralized database in which programs keep their setup information. The Registry contains all of the information that the INI files contained, as well as other settings from around the system. All subsequent versions of Windows store configuration information settings in the Registry, and the win.ini and system.ini files remain only for backwards compatibility with older programs.
The Registry contains configuration settings for Windows itself, as well as for most programs you have installed. It also includes user profile information and information about each hardware component.
Most of the time, the Registry works automatically in the background, but in a few circumstances, you may want to edit it yourself.
Where Is the Registry Stored? The Registry is stored in a group of files in your C:\Windows\System32\Config folder (assuming that Windows XP is installed on C:). The files with no extension (Default, Software, System, Sam, Security, Userdiff) contain the actual Registry entries. The .sav files are copies of the corresponding files made when you installed Windows. User profile information is stored in files named Ntuser.dat in the user's folder in C:\Documents And Settings.
Although Registry Editor looks and works the same as the Windows Me/9x Registry Editor, the location and format of the Registry files are quite different. The Windows XP Registry system is based on Windows 2000/NT and is much larger than its Windows Me/9x equivalent.
What Are Hives and Keys? The Registry is organized much like the Windows file system. The Registry contains a set of hives, which are like folders, inside of which are stored keys. Additional keys can be stored within keys. Each key defines a setting or behavior for Windows or an installed application. Key pathnames are written with reverse slashes between them, much like filenames, so a typical key name is
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SysaudioThis key is in the HKEY_LOCAL_MACHINE hive, which contains a key named System, which in turn contains a key named CurrentControlSet, which contains a key named Services, which contains a key named Sysaudio. Each key can have one or more values, each of which consists of a name, a data type, and some data. A key at any level can contain any number of values, so in the example, values can be associated with HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services or HKEY_LOCAL_MACHINE\System. (In practice, most of the values are stored at the lowest level or next lowest level.)
The data type of a value can be REG_BINARY (a series of binary or hexadecimal digits), REG_DWORD (four-byte numeric value, also called a DWORD), REG_EXPAND_SZ (variable-length string, or text), REG_SZ (fixed-length string), REG_MULTI_SZ (list of strings, separated by spaces, commas, or other punctuation), or REG_FULL_RESOURCE_DESCRIPTOR (larger grouping of information for storing a resource list, usually for a hardware driver). You never change the data type of a value: you change the data. (But only if you are sure you know what you are doing!)
The Top-Level Hives The Registry comes with these hives at the top level of the tree structure (directly under the My Computer entry in the Registry):
- HKEY_CLASSES_ROOT File associations for file types
- HKEY_CURRENT_USER Configuration information for the current user account
- HKEY_LOCAL_MACHINE Configuration information about the computer, for all users
- HKEY_USERS Configuration information for all user accounts
- HKEY_CURRENT_CONFIG Hardware profile information for the hardware profile that your computer uses at startup