Working with the Registry
for Windows
T
he Registry controls your computer settings, the software, the hardware — everything. Be very careful when modifying Registry
settings; you could render a device, an application, or your entire computer inoperative. Always make a backup of your Registry before
making any changes, and always read editing instructions carefully.
You should be extremely careful when editing the Registry. Make sure you completely understand the Registry’s components and
how to edit them before you attempt to change entries. Always make a backup of the Registry before editing it.
Understanding the Registry
The Registry is a central database that contains information about the computer, hardware, software, user preferences, and rights. Each time
you make a change to a display setting or install an application, for example, the change is recorded in the Registry. You might remember
that in Windows 3.11, the initialization INI files recorded any changes to the operating system; the Registry takes the place of the INI files in
newer versions of Windows.
The Registry presents a more structured environment than the old INI files for the complex makeup of Windows 98, 2000, and XP.
Advantages of using the Registry include the following: ✦
All of the information about a user and the computer is stored in one place.
✦ Information about different users and configurations can be
stored in the same database. ✦
Old INI files were text-based and therefore limited to a size of 64K; the Registry has no such space limits.
✦ Network-independent functions enable others to view the
Registry over the network; for example, administrators can check a user’s Registry when troubleshooting.
Caution
24 24
C H A P T E R
✦ ✦
✦ ✦
In This Chapter
Understanding the Registry
Backing up the Registry files
Modifying the Registry Using the Registry to
modify network settings
✦ ✦
✦ ✦
Part VI ✦ Managing the Network
The Registry is a complex tool that you can use to change settings that describe how your computer runs. Other methods of changing these settings also exist — through the Control
Panel, for example. It’s better to modify the Registry by using the Control Panel whenever possible rather than directly in the Registry, because if you make a mistake or there is an
error in the Registry, your computer may stop functioning. The problem is that there are a lot of other configurations and settings besides those in the Control Panel. That’s why you might
need to use the Registry from time to time.
Always make a backup of the Registry before you make any changes to it. If you make a mis- take, you can restore the backup to get you back to where you started. See the section
“Backing Up the Registry Files” later in this chapter for more information.
Warn your users that changes to the Registry can disable their computers. Also, make sure that you have backups of the Registry files on all computers in your office. Even if you don’t
keep them updated regularly, an outdated backup is better than none at all. Note that you must back up the Registry files of each computer, because Windows creates the Registry par-
ticular to that computer’s hardware and user information.
Defining the Registry database
The Registry is organized in keys, which describe specific information about the computer or user. For example, the HKEY_CURRENT_USER contains information describing the user’s set-
tings, preferences, favorites, and other data. The HKEY_LOCAL_MACHINE key contains infor- mation about the computer’s configuration, hardware, software, and so on.
Small Business
Tip
Changing the Configuration in the Control Panel
The Windows Control Panel offers icons and dialog boxes as a method of changing certain envi- ronmental options in the operating system. You can change the computer’s date and time, for
example, or the colors you use on the desktop. Following are some of the settings you can change in the Control Panel:
•
Desktop themes represent various colors and pictures you can use in Windows. When you choose a theme, an image appears on the desktop instead of a solid background,
the desktop icons change to suit the scheme, and dialog box and menu colors change to match the scheme colors.
•
Display enables you to set solid colors or wallpaper designs for the desktop; fonts and colors for menus, dialog boxes, title bars, and so on; icon properties; the screen area; and
other options.
•
Internet Properties offer various preferences you can set, including a home page address, connection options, and multiple choices for running your browser and e-mail program.
•
The Keyboard icon enables you to adjust how the keyboard reacts to text entry, and it also defines languages you use in Windows.
•
The Network icon enables you to add or remove network clients, adapters, services, and protocols.
When you use the Control Panel to make changes to your computer settings, those changes are recorded in the Registry. The Control Panel creates an easy-to-use interface to the Registry.
Chapter 24 ✦ Working with the Registry for Windows
Each key contains subkeys, values, or both. The Registry Editor is a program you can use to view or edit Registry entries. Figure 24-1 illustrates the Registry keys, subkeys, and a value.
Note that the keys and subkeys appear in the left window pane; values appear in the right window pane.
Figure 24-1: Keys and subkeys appear as folders in the Registry Editor.
Keys
Keys represent different types of configuration data. In each key is information that relates to that key. The Windows Registry has six keys; following is a description of each:
✦ HKEY_CLASSES_ROOT contains general information about Windows, such as the regis-
tered file types and their properties, Object Linking and Embedding components, and so on.
✦ HKEY_CURRENT_USER includes all settings for the default user.
✦ HKEY_LOCAL_MACHINE contains all information about the computer, such as
installed hardware, the software configuration, drivers, and so on. The configurations in this key apply to any and all users logged on to the computer.
✦ HKEY_USERS contains settings specific to each user who logs on to the computer.
These settings include desktop colors, applications installed by individual users, and so on.
✦ HKEY_CURRENT_CONFIG manages Plug and Play as well as other information about
the current configuration of the computer. If multiple users exist, and each has a differ- ent computer configuration, those configurations are found in this key.
✦ HKEY_DYN_DATA in Windows 98 reports the status of hardware devices in the
Device Manager, a tab found in the System icon of the Control Panel.
Subkeys
Subkeys are folders, or subfolders, of keys. Each subkey contains more subkeys, or values. Some subkeys exist under multiple keys, which occurs because Windows stores a subkey
under any and all keys to which it relates.
Part VI ✦ Managing the Network
Following are explanations of the subkeys in each key: ✦
HKEY_CLASSES_ROOT • The subkeys in this key affect file extensions, such as .bmp, .com, .doc, .tif, .gif,
and so on. These subkeys define the file type associated with the extensions. ✦
HKEY_CURRENT_USER • AppEvents deals with the sounds that play when something happens within the
system, such as Windows starting up or an error occurring. • Control Panel contains all the settings in the Control Panel, including network,
date, time, and so on. • Display lists screen resolution and other screen settings.
• InstallLocationsMRU lists the paths recently used for installing software. All these paths begin with A, B, D, or another letter representing a floppy drive, CD-ROM
drive, Zip drive, or network path. • Keyboard layout contains any special information about key assignments and
dynamic library links DLLs. • Network contains drive definitions, network types, usernames as they appear in a
login file, paths, and many of the recently accessed paths to networked comput- ers. This key is discussed in more detail later in this chapter.
• RemoteAccess includes addresses, usernames, and other information related to Internet accounts or other networks to which you have access via phone line or
dedicated line. • Software includes subkey names for the drivers and programs on your computer.
Some programs have no settings or defaults, and others have several. Settings might include a path to a network computer, default drivers, or other settings.
✦ HKEY_LOCAL_MACHINE
• Config contains the computer’s configurations, including settings for the display and printers.
• Driver includes any special settings for hardware or software drivers. • Enum manages the information for all installed hardware components, including
the monitor, networking hardware, USB ports, and so on. • Hardware contains settings for all ports on the computer, such as COM, LPT, and
USB, if applicable. • Network contains user login information, including username, password, and so
on if the computer is on a network, of course. • Security names domains and other network information, if the network is
installed. • Software includes subkeys for all installed software and drivers, such as Office
programs, modem drivers, and so on. • System includes the information necessary for Windows to start up, such as
error information, Plug and Play device addressing, the computer’s name, and so on.
Chapter 24 ✦ Working with the Registry for Windows
✦ HKEY_USERS
• Default contains the common settings for the desktop, Start menu, programs, and so on, and each Username contains the settings specific to that user. Each user
listed in this key contains the following subkeys which are defined the same as those in HKEY_CURRENT_USER: AppEvents, Control Panel,
InstallLocationsMRU, Keyboard layout, Network, RemoteAccess, and Software.
✦ HKEY_CURRENT_CONFIG
• This key contains the following subkeys: Display, Enum, Software, and System as defined in the HKEY_LOCAL_MACHINE key.
✦ HKEY_DYN_DATA
• Config Manager manages the information for all installed hardware components, including the modem, ports, Plug and Play adapters, and so on.
• PerfStats contains information about dial-up adapters.
Values
Values are the statements contained within a key or subkey. Values might name a file, a com- mand, an error message, a path, a machine address, and so on. Figure 24-2 shows font values,
stored in the HKEY_CURRENT_CONFIG key, and the Display subkey.
Figure 24-2: Display fonts are defined in this key.
Deciding when to modify the Registry
You should not modify the Registry directly unless it’s absolutely necessary. Modifying the Registry could cause computer hardware, software, or even your entire computer to fail if
you edit, move, or delete the wrong value. It’s best to modify the Registry automatically through the Control Panel, installation and
setup programs, and various Windows utilities. You can change all settings and configura- tions within Windows without going to the Registry.
Part VI ✦ Managing the Network
You do need to resort to editing the Registry, however, when you see recurring errors or Windows messages for which you cannot find a purpose. You might uninstall an application,
for example, but every time you boot the computer, a message appears telling you Windows cannot find a file directly related to that program. Another example might be that you cannot
uninstall a program through Windows, so you have to delete related entries in the Registry.
If you must modify the Registry, you should use the Registry Editor; however, save this method of editing the Registry as your last resort. In addition, before you edit the Registry,
you must back up your Registry files in case you make a mistake and your computer crashes.
Backing Up the Registry Files
The Windows 98 Registry is completely contained in two files: user.dat and system.dat. Generally, these files are stored in the \Windows directory on the computer’s hard disk.
Windows 2000 and XP use only the ntuser.dat file to store information about each user who logs on to the computer. The ntuser.dat file is stored in \Documents and Settings in each indi-
vidual’s folder.
The user.dat file contains login names, settings for the Start menu, desktop colors and icons, and other information specific to the user. The user.dat file is automatically stored in the
\Windows or the \Documents and Settings directory when you install Windows.
If you want to control a user’s environment using Windows 98 — say, to keep the user from changing display settings, adding software, and so on — you can store the user.dat file on the
server in a clientserver network. Include with your permissions or rights a user profile that forces the user.dat file to load whenever the user logs on to the server. This way, each time
the user logs on to the server, the default user settings load onto the computer and overwrite any changes the user may have made previously. For more information about user profiles,
see the network operating system’s documentation. The system.dat file must stay on the local computer; do not transfer it to a server drive.
In Windows 98, the system.dat file contains information about the hardware and software set- tings on the computer. This file includes all the necessary information to start Windows, load
device drivers, and prepare the operating system to run the software. The system.dat file is located in the computer’s \Windows directory as well.
In Windows 2000 and XP, many files take the place of the system.dat. You can alter many DAT and INI files through the Registry. These files contain the necessary data needed to start
Windows, just as the system.dat file in Windows 98 does.
Backing up the Registry
You can back up the Registry by exporting it in a file to a folder on your computer, to another drive on the network, or to a CD or other backup media. Exporting the Registry takes only a
few minutes and should be done each time you make major changes to your computer, such as adding hardware or installing a program. You definitely should back up the Registry files to
each computer on your network; restoring the Registry is much faster and easier than losing all your data and then reinstalling Windows and all your applications.
Small Business
Tip
Chapter 24 ✦ Working with the Registry for Windows
You use the Registry Editor to back up the Registry, to import a Registry or Registry entry, and to edit the Registry. The Export feature in the Registry Editor, by default, saves the
backup file to the My Documents folder. You can, and should, choose to back up the file to another media type, such as a tape, Zip disk, CD, or network drive. To back up the Registry,
follow these steps:
1. Open the Registry Editor by clicking Start ➪ Run. Type regedit in the Open text box and
click OK.
2. Click File ➪ Export. The Export Registry File dialog box appears. 3. In the File Name text box, enter a name, such as the date 091203.
4. Optionally, choose a folder in which to store the file. 5. Click Save. Windows returns to the Registry Editor when it is finished backing up the
Registry.
Recovering the Registry
If your computer crashes or you find odd things happening to your desktop settings, pass- words, or other configurations, you might have a corruption of the Registry. You first should
try everything you can think of to fix the problems. Because those same symptoms often indi- cate a virus or worm, you should check your computer for a bug first. If you’ve tried every-
thing you can think of and worse comes to worst, you can restore the Registry files and hope that alleviates the problems.
Make sure you never replace a Windows Registry with the Registry of a different version of Windows. You could completely incapacitate your computer if you do.
Fixing a problem
Fixing a problem before restoring the Registry might take some detective work. You must decide if the problem is with the hardware, with a specific program, or with the operating sys-
tem. If the problem is with a specific program, you can try reinstalling the program on top of the original; often, reinstalling corrects a corrupted file, and it usually doesn’t harm your data
files. Just to be safe, however, make a backup of your data before reinstalling the program.
Caution
System State Data
In addition to backing up the Registry, you should keep backups of other system files in Windows 2000 and XP. The SYSVOL folder, for example, is a shared folder on a Windows 2000 or 2003
server. The SYSVOL stores the domain’s public files. The Active Directory, if you’re using Windows server, is another important folder to back up. The Active Directory stores all the information
about the network, such as user passwords, profiles, configurations, and so on, plus other perti- nent information about the network.
For either Windows 2000 or XP, you should back up the system files. System files are the ones that enable Windows to load and run the operating system. There are other system files you
should back up, including the Registry. You can use the Windows Backup program to perform a system state backup. For more information about the Windows Backup program, see Chapter 21.
Part VI ✦ Managing the Network
Make sure each of your users knows the importance of writing down error messages before dismissing the dialog box. They also should write down exactly what they were doing when
the error occurred. If you have this information to start with, detecting the problem will be much easier.
If you think the problem is with the operating system, check the Control Panel. If, for exam- ple, you’re having trouble with your desktop settings, check the Display icon. If the trouble
seems to be with the mouse, check the Mouse icon. The icons open Properties dialog boxes that contain settings, options, tests, and information about the device and its interaction with
the operating system. Try to fix your problems here first.
If you think you have a hardware problem, use the Device Manager in My Computer Properties, or you can use the System icon in Windows 98 Start ➪ Control Panel. The Device Manager
lists hardware devices and notifies you if there is a hardware failure. Figure 24-3 illustrates the Device Manager. Note that you can display the specific device by clicking the plus sign next
to the device category. Here, for example, the CD-ROM device is a Mitsumi CD-ROM.
Figure 24-3: Look at your hardware devices in the Device Manager.
If there is a problem with any device listed in the Device Manager, Windows notifies you by displaying a red X or a yellow exclamation point through the device. If you see one of these
indicators on a device, select the device and click the Properties button. In the device’s Properties dialog box, you see the Device status area, which tells you if there is a problem
and what the problem might be. Figure 24-4 shows the CD-ROM Properties dialog box. Note the Device status area.
Small Business
Tip
Chapter 24 ✦ Working with the Registry for Windows
Figure 24-4: Check the status of the device.
For more troubleshooting techniques and ideas, see Appendix A.
Importing a Registry file
Before importing a Registry file, make sure you use the latest copy of your backed up Registry file and that the version of the operating system is correct.
If you exported your Registry files from the Registry Editor, you can recover them easily from that same program. Open the Registry Editor and choose Registry ➪ Import Registry File.
Choose the file you saved, and then click the Open button. You can alternatively open the Windows Explorer and double-click the file with a .reg exten-
sion. Double-clicking the file automatically imports it into the Registry. You can also export and import hives and keys to the Registry instead of the entire Registry.
You might do this to change or reapply certain settings for hardware, software, or user settings. Note
Cross- Reference
Part VI ✦ Managing the Network
Modifying the Registry
You can use several tools to modify the Registry. Each offers its own advantages and disad- vantages. The Registry Editor is the easiest tool to use. The Registry Editor displays the keys,
subkeys, and values in an easy-to-understand hierarchy. Also, the Registry Editor offers short- cuts and tools that help you edit the files.
Copying Programs and Registry Entries
If you need to copy a program from one computer to another, and you cannot locate the instal- lation disks, you can copy the program files, plus Registry entries, to make the program work.
This happens when, for instance, you’re using an old program, you’ve lost the original installation disks or they’ve become damaged, or for some other reason you need to copy the program
instead of install it.
1. The first step is to network the two computers together. You can use a crossover cable, a
hub or switch, or wireless methods to network the computers.
2. Next, you copy the software program’s folder; the folder might be in the root or it might
be in the Program Files folder. The third step you take involves the Registry.
3. In the original computer’s Registry, use the Edit ➪ Find command to locate the name of
the software you’re copying. Alternatively, you can search in HKEY_LOCAL_MACHINE\SOFTWARE or HKEY_CURRENT_USER\SOFTWARE for the pro-
gram’s Registry folder.
4. Select the folder, click File ➪ Export. Name the file by the program’s name, so you can
easily recognize it. There might be more than one folder relating to the program. Close the Registry when you’re done.
5. Copy the REG files to the second computer. On the second computer, open the Registry
Editor. Click File ➪ Import. Select the REG files and click Open. Windows automatically places the software folder in its rightful place in the Registry.
6. The last step in copying a program is to locate the executable file for the program on the
second computer usually an EXE or application file in the program’s folder. You can make a shortcut on the desktop, if you like. Double-click the EXE file. As the program
opens, it might ask for certain files it cannot find, most generally DLL files. Search for each file on the first computer, copy it to the location the second computer expects to
find the file, and try opening the program again. You might not have to copy any DLL files; you might have to copy several.
When this step is complete, your copied program should work on the second machine.
Chapter 24 ✦ Working with the Registry for Windows
Starting the Registry Editor
The Registry Editor appears in a window similar to the Windows Explorer. Two panes display the Registry information. In the left pane, you see the keys and subkeys; in the right pane, you
see the values. The file that opens the Registry Editor is the regedit.exe file, and it’s located in the \Windows
folder. To open the Registry editor, follow these steps:
1. Choose Start ➪ Run. The Run dialog box appears. 2. In the Open text box, type regedit.
3. Click the OK button. The Registry Editor appears.
Figure 24-5 shows the Registry Editor as it appears in Windows 98 when you first start it. Note that the six Registry keys appear in the left pane.
In Windows 2000 and XP, only five keys appear; HKEY_DYN_DATA does not appear in later editions of Windows. In addition, the menu names are different. Instead of Registry, Windows
XP uses File. Windows XP also adds Favorites to its menus, as shown in Figure 24-6.
Using Policies to Modify the Registry
As an alternative to using the Registry Editor, you can use the System Policy Editor in Windows 98 or the group policies in Windows and 2000 and XP to modify Registry values. Chapter 23
explains how to use policies to control and manage your users. Any changes you make with the System Policy Editor or group policy also affect the Registry.
The System Policy Editor and group policies present options in well-defined categories and easy- to-understand options, unlike the Registry Editor. Instead of entering cryptic values and searching
through confusing keys, you can check boxes that represent options such as Hide Share Passwords with Asterisks, Disable Password Caching, Require Alphanumeric Windows Password,
and Minimum Windows Password Length.
Almost all options in the Registry can be set somewhere else within Windows. Password options, for example, are set in the Passwords dialog box, Access Control is set in the Network dialog box,
and so on. Even though the System Policy Editor and Group Policies offer numerous choices and options for
controlling the network, the Registry Editor is more adaptable, albeit more difficult to learn and to use.
Part VI ✦ Managing the Network
Figure 24-5: Use the Registry Editor to modify values.
Figure 24-6: The Registry Editor in Windows XP looks similar to the one in Windows 98.
Using the menus
The menus offer commands that enable you to print, find values, import and export the files, and more. Following are descriptions of the menu commands. If you do not completely under-
stand the effects changes to the Registry will make, do some testing on a seldom used com- puter before making global changes on the network.
Chapter 24 ✦ Working with the Registry for Windows
Registry or File menu
The Registry Windows 98 or File Windows 2000, XP menu contains the following commands:
ImportExport Registry File Use these commands to back up and restore the entire
Registry or parts of the Registry.
Load Hive Windows XP and 2000 Use this command to edit hives or move a hive
from one system to another. The hive is a section of the Registry saved to a file on your computer.
ConnectDisconnect Network Registry These commands enable you to edit the
Registry of another computer on the network. To set this up, you need to install the Remote Registry service in the Network dialog box, change your access control to
User-level also in the Network dialog box, be on a clientserver network, and have permissions to make the changes over the network.
Print Use this command to print the values in the right pane.
Exit This command closes the Registry Editor.
Edit menu
The Edit menu contains the following commands:
Modify Windows 98 This command appears only when a value is selected. It
enables you to modify the selected value.
New This command enables you to create a new subkey or value within any Registry key. Delete
Use this command to erase a value, subkey, or key. Be very careful when delet- ing keys; you can render your computer useless by deleting things from the Registry.
Rename This command enables you to change the name of a key, subkey, or value. Be
very careful when changing names; you can render your computer useless by changing names.
Copy Key Name Use this command to create a copy of the key name without copying
the subkeys and values.
Find This command enables you to search for a keyword in the Registry. If you want
to view the first appearance of Internet Explorer in any key, for example, you can use the Find command.
Find Next Use this command to find each subsequent occurrence of the keyword you
enter in the Find dialog box.
View menu
The View menu contains the following commands:
Status bar Using this command shows or hides the Status bar, which contains helpful
information, such as the path to a subkey, as shown in Figure 24-7. If you’re buried deeply in subkeys, the Status bar can remind you of the key you’re working in.
Split This command enables you to change the dividing line between the window
panes. Click the Split option to change the mouse tool into an arrow that can move the division line to the left or the right.
Refresh This command redraws the screen. Use this command, for example, if you’ve
added a new subkey and it’s not showing up in the left window pane.
Part VI ✦ Managing the Network
Figure 24-7: Use the Status bar to remind you of your location in the Registry.
Favorites menu
The Favorites menu appears only in Windows 2000 and XP. It contains the following commands:
Add to Favorites
This command enables you to choose a Registry key or value that you often edit and make that value a favorite, for easier location. Favorites list at the
end of the Favorite menu in the Registry Editor.
Remove Favorite
Use this command to select and remove any favorite from your Favorites list.
Help menu
The Help menu contains the following commands:
Help Topics
This command offers Content, Index, and Find features similar to other Windows Help.
About Registry Editor
Issuing this command results in displaying the copyright infor- mation, the physical memory available, and the percentage of free system resources.
Displaying keys, subkeys, and values
The Registry Editor works similarly to the Windows Explorer. In the left pane are listed the Registry keys and subkeys. In the right pane are listed specific values relating to the keys.
To display a key’s subkeys, click the plus sign or double-click the key folder. Subkeys also have plus signs you can click to display their contents. If a subkey doesn’t have a plus sign,
simply double-click the folder to display its contents.
The plus sign indicates that the key or subkey contains more subkeys, or folders. A minus sign indicates that all subkeys are displayed.
Tip
Chapter 24 ✦ Working with the Registry for Windows
If you’re searching for a specific value, such as a program name, username, address, or other value, you can use the Find command. To use the Find command, follow these steps:
1. In the Registry Editor, move to the top of the window so that you’re sure you search the
entire Registry.
2. Choose Edit ➪ Find. The Find dialog box appears, as shown in Figure 24-8.
Figure 24-8: Use the Find dialog box.
3. Type the word in the Find What text box, and then click the Find Next button. The
Searching the Registry dialog box appears.
4. When a match is found, the Registry opens to the key, subkey, and value matching the entry. Figure 24-9 shows the results of entering wingate in the Find What text box of the
Find dialog box. Note the path to the key in the Status bar.
Figure 24-9: Find the program’s values in the Registry.
5. To find the next occurrence of the key word in the Registry, press F3, or choose Edit ➪
Find Next.