THE WINDOWS REGISTRY


The registry is a database that stores every changeable piece of information related to Windows, including hardware and software configuration. In 9x, it is stored in two files, system.dat and user.dat. In 2000 and XP, the registry is stored in a series of files. Every change that a user or a program makes is stored in the registry. For this reason, the registry is delicate. Make one wrong move and your computer can become unbootable. Microsoft warns you over and over again that they bear no responsibility for a registry-editing mistake, even if they tell you what changes to make. They insist that every change can be made in a safer place, such as Control Panel. This is absolutely not true. If you search Microsoft’s Web site for solutions to problems, you’ll find that often, the registry is the only place to make certain changes and to correct certain problems. If the registry never needed to be modified directly, Microsoft wouldn’t provide a registry editor with every installation, which, of course, they do.

Backing Up the Registry

It is highly advisable to back up the registry before editing so that incorrect changes can be undone. The registry is automatically backed up every time the system is booted, but you can’t always depend on this being successful. Instructions are provided here and later in this chapter. It is possible to back up portions or the entire registry.

Windows 9x Registry Backups

There are a few different ways to back up the registry in 9x. One way starts with booting into DOS. You might recall that you can do this in 95/98 by selecting to reboot into DOS in the shutdown menu. You can also use a boot floppy (this is the only way to do this in Me). The same procedure can also be done by booting into Safe Mode, Command Prompt Only, which you do by pressing F8 at the beginning of booting and making the appropriate selection. Once you get a command prompt, navigate to the Windows folder if you’re not already there. (If you get a C:\> prompt, type “CD Windows” and then press <Enter>. If you get an A:\> prompt, type “C:\”, press <Enter>, and then type “CD Windows” and then press <Enter> again.) Once you have reached the C:\>WINDOWS prompt, type the following, pressing <Enter> after each line:

attrib -r -h -s system.dat attrib -r -h -s user.dat copy system.dat *bu copy user.dat *.bu 

Then, restart the computer. See Chapter 13, “Command-Line Tutorial,” for a tutorial on using commands in MS-DOS. The attrib command changes the attributes of the file. The minus sign turns off each attribute; r represents the read only attribute; h, the hidden; and s means system. This is necessary in order to do anything with these files. The copy command is self-explanatory—these commands are making copies of the two files and naming them System.bu and User.bu.

Note

Windows names the automatically backed up registry files System.da0 and User.da0. These final characters are zeros.

To restore these backups, get to the C:\>WINDOWS prompt as described in the backup instructions and type the following, again pressing <Enter> at the end of each line:

attrib -r -h -s system.dat attrib -r -h -s system.da0 attrib -r -s -h user.dat attrib -r -s -h user.da0 ren system.dat system.daa ren system.da0 system.da1 ren user.dat user.daa ren user.da0 user.da1 copy system.bu system.dat copy user.bu user.dat

Then, restart the computer (ren is the rename command). If you need to restore the automatic backup in 95 (it should be handled automatically by 98 and Me), type the following, pressing <Enter> after each line:

attrib -h -r -s system.dat attrib -h -r -s system.da0 attrib -h -r -s user.dat attrib -h -r -s user.da0 copy system.da0 system.dat copy user.da0 user.dat

Then, restart the computer.

There are utilities you can use to back up the registry. On the Windows 95 installation disc is a utility called ERU in the Other\Misc\ERU folder. Run the program from the CD-ROM and follow the prompts. For more information, search the Microsoft Knowledge Base for Article 139437 entitled “Windows 95 Emergency Recovery Utility.”

Windows 98 and Me have a utility called the Registry Checker. This is actually a combination of two program files. Scanreg.exe runs only in DOS, while Scanregw.exe runs in both DOS and Windows. Registry Checker runs automatically and, if it discovers no registry problems, makes a new backup of the registry every day in which the computer is successfully booted. If it finds problems, it will attempt to restore the backup automatically, and if that proves unsuccessful, Registry Checker will attempt to repair the registry. You can run scanregw in either the Run dialog or from a command prompt. For more information on Registry Checker and other information about the 9x registry, search the Microsoft Knowledge Base for “Chapter 31—Windows 98 Registry.”

Instructions on backing up and restoring the entire registry in 2000 and XP appear later in this chapter. Because backing up portions of the registry is done with the registry editor, we’ll discuss partial backups with the editor next.

The Registry Editor: Regedit.exe (All Versions)

Regedit is available only by typing “regedit” in the Run dialog or at a Windows command prompt. Open the editor and take a look. You’ll see that the registry has five keys: HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, and HKEY_CURRENT_CONFIG, shown in Figure 11.5.

click to expand
Figure 11.5: The registry has five keys.

A key is like a root folder in Windows. It is the highest item in the hierarchy. Click the plus sign next to any of the keys and the next level of the hierarchy becomes visible (see Figure 11.5). These are called subkeys, just as folders inside other folders are called subfolders. The last subkeys in the hierarchy have values (called Name in the editor), and some of the values have data, as you can see in Figure 11.6. The other column, labeled Type, refers to the type of data (REG_SZ,REG_DWORD, etc.). Data types aren’t important for this discussion. Now, look at the bottom of Figure 11.6. This displays the full path to the last subkey you are on.

click to expand
Figure 11.6: Keys, values, and data.

Editing the registry is very similar to editing any text document. The Edit menu contains straightforward commands, as shown in Figure 11.7. Especially helpful are the Find and Find Next commands. In addition, the basic keyboard shortcuts such as <Ctrl> + <C> for copying the selected item work in the registry. For more information, search for “keyboard shortcuts” in Windows Help.


Figure 11.7: Regedit’s Edit menu.

Backing Up and Restoring Registry Keys

Regedit’s File menu has two commands for backing up and restoring keys and subkeys. These are the Import Registry File and Export Registry File commands. With a key selected, click the Export command. You can then give the file a name and save it anywhere on the system. Make sure to keep a record of the file’s name and location. If you need to restore the file, click the Import command and browse for the file, and click Open when you find it. These commands also give you the opportunity to back up and save the entire registry by selecting the All option button at the bottom of the Export dialog box.

Tip

Unless and until you become experienced with editing the registry, it is recommended to limit editing to exact instructions by Microsoft support personnel and documents. If you do make a serious mistake editing the registry in 2000 or XP, and you have not backed it up first, you can still restore the registry using the Last Known Good boot option, discussed later in this chapter. Windows 2000 also has a registry editor called Regedt32.exe (type regedt32 at the Run dialog or command prompt). This looks much like the Sysedit.exe program covered in Chapter 2. It has some important capabilities that regedit doesn’t have, although it lacks a Find command. Microsoft recommends using Regedt32 for editing in Windows 2000. For more information on Regedt32, search Windows 2000 Help or the Microsoft Knowledge Base.




The A+ Certification & PC Repair Handbook
The A+ Certification & PC Repair Handbook (Charles River Media Networking/Security)
ISBN: 1584503726
EAN: 2147483647
Year: 2003
Pages: 390

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net