Keeping the Registry Safe


The sheer wealth of data stored in one place makes the registry convenient, but it also makes it very precious. If your registry went missing somehow, or if it got corrupted, Windows XP simply would not work. With that scary thought in mind, let’s take a moment to run through several protective measures. The techniques in this section should ensure that Windows XP never goes down for the count because you made a mistake while editing the registry.

Insider Secret

If you share your computer with other people, you may not want to give them access to the Registry Editor. You can prevent any user from using this tool by running the Group Policy editor. Open User Configuration, Administrative Templates, System, and then enable the Prevent Access To Registry Editing Tools policy. Note that you won’t be able to use the Registry Editor, either. However, you can overcome that by temporarily disabling this policy prior to running the Registry Editor.

Backing Up the Registry

Windows XP maintains what is known as the system state: the crucial system files that Windows XP requires to operate properly. Included in the system state are the files used during system startup, the Windows XP protected system files, and, naturally, the registry files. The Backup utility has a feature that enables you to easily back up the current system state, so it’s probably the most straightforward way to create a backup copy of the registry should anything go wrong. Note that you must be logged on as a member of the Administrators group or the Backup Operators group in order to back up the system-state files and folders. Here are the steps to follow to back up the system state:

  1. Select Start, All Programs, Accessories, System Tools, Backup. (Note that if you’re using Windows XP Home Edition, you might need to install Backup from the Windows XP CD. We explain how this is done in Chapter 12, “Maintaining Your System in 10 Easy Steps.”)

  2. When the Backup Or Restore Wizard appears, click the Advanced Mode link.

  3. Select the Backup tab.

  4. In the folder tree, open the Desktop branch and then the My Computer branch, if they’re not open already.

  5. Select the System State check box.

  6. Choose your other backup options, click Start Backup, and then follow the usual backup procedure (as discussed in Chapter 12).

Caution

Depending on the configuration of your computer, the system state can be quite large—up to 350 MB. Therefore, make sure the destination you choose for the backup has enough free space to handle such a large file.

Saving the Current Registry State with System Restore

Another easy way to save the current registry configuration is to use Windows XP’s System Restore utility. This program takes a snapshot of your system’s current state, including the registry. Then, if anything should go wrong with your system, the program enables you to restore a previous configuration. It’s a good idea to set a system restore point before doing any work on the registry. We show you how to work with System Restore in Chapter 12.

Insider Secret

Another way to protect the registry from inappropriate editing is to ensure that its keys have the appropriate permissions. By default, Windows XP gives members of the Administrators group full control over the registry, and it gives individual users control over the HKCU key when that user is logged on. (See Chapter 5, “Managing Logons and Users,” for more information on users, groups, and permissions.) To adjust the permissions, right-click the key in the Registry Editor, and then select Permissions. Make sure that only administrators have the Full Control check box selected.

Protecting Keys by Exporting Them to Disk

If you’re making just a small change to the registry, backing up all of its files may seem like overkill. Another approach is to back up only the part of the registry that you’re working on. For example, if you’re about to make changes within the HKEY_CURRENT_USER key, you could back up just that key, or even a subkey within HKCU. You do that by exporting the key’s data to a registration file, which is a text file that uses the .reg extension. That way, if the change causes a problem, you can import the .reg file back into the registry to restore things to the way they were.

Exporting a Key to a .reg File

Here are the steps to follow to export a key to a registration file:

  1. Open the Registry Editor and select the key you want to export.

  2. Select File, Export to display the Export Registry File dialog box.

  3. Select a location for the file.

  4. Use the File Name text box to enter a name for the file.

  5. If you want to export only the currently highlighted key, make sure the Selected Branch option is selected. If you’d prefer to export the entire registry, select the All option.

  6. If you’ll be importing this file into a system running Windows 9x (Windows 95, Windows 98, or Windows 98 Second Edition), Windows Millennium Edition (Me), or Windows NT, use the Save As Type list to choose the Win9x/NT 4 Registration Files (*.reg) item.

  7. Click Save.

Insider Secret

One common registry scenario is to make a change to Windows XP using a tool such as the Group Policy Editor or Tweak UI, and then try to find which registry setting (if any) was affected by the change. However, because of the sheer size of the registry, this is usually a needle-in-a-haystack exercise that ends in frustration. One way around this is to export some or all of the registry before making the change and then export the same key or keys after making the change. You can then use the FC (file compare) utility at the command prompt to find out where the two files differ. Here’s the FC syntax to use for this:

 FC /U pre_edit.reg post-edit.reg > reg_changes.txt 

Here, change pre_edit.reg to the name of the registration file you exported before editing the registry; change post_edit.reg to the name of the registration file you exported after editing the registry; and change reg_changes.txt to the name of a text file to which the FC output is redirected. Note that the /U switch is required because registration files use the Unicode character set.

Importing a .reg File

If you need to restore the key that you backed up to a registration file, follow these steps:

  1. Open the Registry Editor.

  2. Select File, Import to display the Import Registry File dialog box.

  3. Find and select the file you want to import.

  4. Click Open.

  5. When Windows XP tells you the information has been entered into the registry, click OK.

    Note

    You also can import a .reg file by locating it in Windows Explorer and then double-clicking the file.

    Caution

    Many applications ship with their own .reg files for updating the registry. Unless you’re sure that you want to import these files, avoid double-clicking them. They might end up overwriting existing settings and causing problems with your system.




Insider Power Techniques for Microsoft Windows XP
Insider Power Techniques for Microsoft Windows XP (Bpg-Other)
ISBN: 0735618968
EAN: 2147483647
Year: 2005
Pages: 126

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