Appendix C. Fun with the Registry

Occasionally, in books, articles, and conversations, you’ll hear hushed references to something called the Windows Registry—usually accompanied by either knowing or bewildered glances.

The Registry is your PC’s master database of preference settings. For example, most of the programs in the Control Panel are nothing more than graphic front ends that, behind the scenes, modify settings in the Registry.

The Registry also keeps track of almost every program you install, every Plug and Play device you add, every multiple-user profile you create (Chapter 17), your networking configuration, and much more. If you’ve noticed that shortcut menus and Properties dialog boxes look different depending on what you’re clicking, you have the Registry to thank. It knows what you’re clicking and what options should appear as a result. In all, there are thousands and thousands of individual preference settings in your Registry.

As you can well imagine, therefore, the Registry is an extremely important cog in the Windows XP machine. That’s why Windows marks your Registry files as invisible and non-deletable, and why it makes a Registry backup every single time you shut down the PC. If the Registry gets damaged or randomly edited, a grisly plague of problems may descend upon your machine. Granted, Windows XP’s System Restore feature (described in this chapter) can extract you from such a mess, but now you know why the Registry is rarely even mentioned to novices.

In fact, Microsoft would just as soon you not even know about the Registry. There’s not a word about it in the basic user guides, and the only information you’ll find about it in the Help and Support center is a line that says, “It is strongly recommended that you do not edit Registry settings yourself. Incorrectly editing the Registry may severely damage your system.”

Still, the Registry is worth learning about. You shouldn’t edit it arbitrarily, but if you follow a step-by-step “recipe” from a book, magazine, Web site, or technical-help agent, you shouldn’t fear opening the Registry to make a few changes.

And why would you want to? Because there are lots of Windows settings that you can’t change in any other way, as you’ll see in the following pages.

Meet RegEdit

Windows XP comes with a built-in program for editing Registry entries, a little something called (what else?) the Registry Editor. (There are dozens of other Registry-editing, Registry-fixing, and Registry-maintenance programs, too—both commercial and shareware—but this one is already on your PC.)

As an advanced tool that Microsoft doesn’t want falling into the wrong hands, the Registry Editor has no Start-menu icon. You must fire it up by typing its name into the Run command. That is, choose Start->Run. Then in the Run dialog box, type regedit and press Enter. After a moment, you see a window like Figure C-1.

The Registry’s settings are organized hierarchically; in fact, the Registry Editor looks a lot like Windows Explorer. But there’s no easy way to figure out which part of the Registry holds a particular setting or performs a particular function. It’s like flying a plane that has no windows.

Figure C-1. The Registry’s settings are organized hierarchically; in fact, the Registry Editor looks a lot like Windows Explorer. But there’s no easy way to figure out which part of the Registry holds a particular setting or performs a particular function. It’s like flying a plane that has no windows.

The Big Five Hives

It turns out that Microsoft has arranged all of those software settings into five broad categories. Microsoft calls them hives or root keys, but they look and act exactly like folders in a Windows Explorer window. You expand one of these folders (keys) just as you would in Explorer, too, by clicking the little + button beside its name.

The names of these five hives are, frankly, just as weird as the term hives itself:

  • HKEY_CLASSES_ROOT. This root key stores all kinds of information about files: filename extensions, file types, shortcut menus, and so on.

    Note

    A number of Registry entries appear in more than one place, live mirrors of each other, for convenience and clarity. Edit one, make a change in “both” places.

    This root key, for example, is a pointer to the key at HKEY_LOCAL_MACHINESOFTWAREClasses. (More on this slash notation below.)

  • HKEY_CURRENT_USER. As you’d guess, here’s where you’ll find the settings pertaining to your account: how you’ve got your desktop arranged, your wallpaper setting, and so on, plus information about connections to printers, cameras, and so on. (This key, too, is a live duplicate—of the identical one in HKEY_USERS, described below.)

  • HKEY_LOCAL_MACHINE. All about your PC and its copy of Windows. Drivers, security settings, hardware info, the works.

  • HKEY_USERS. Here’s where Windows stores the information about all of the account holders (user profiles) on your PC, including the “Current_User’s.” You’ll rarely be asked to edit this root key, since the good stuff—what applies to your own account—is in the CURRENT_USER key.

  • HKEY_CURRENT_CONFIG. Most of this root key is made up pointers to other places in the Registry. You’ll rarely be asked to edit this one.

A Control Panel program (like Mouse, shown at left) is nothing more than a user-friendlier front end for a bunch of underlying Registry keys (right).

Figure C-2. A Control Panel program (like Mouse, shown at left) is nothing more than a user-friendlier front end for a bunch of underlying Registry keys (right).

Keys and Values

If you expand one of these hives by clicking the + button next to its name, you’ll see long list of inner “folders” called keys. These are the actual settings that the Registry tracks, and that you can edit.

Some of the keys contain other keys, in fact. Keep clicking the + buttons until you find the key you’re looking for.

In books, magazines, and tutorials on the Web, you’ll often encounter references to particular Registry subkeys written out as a Registry path, like this:

HKEY_CURRENT_USERControl PanelMouse

(You may see backslashes used instead of the arrows, however.) That instruction tells you to expand the HKEY_CURRENT_USER root key, then expand Control Panel within it, and finally click the Mouse “folder.” It works just like a folder path, like C:Documents & SettingsChrisDesktop.

If you actually try this maneuver, you’ll find, in the right half of the window, a bunch of keys named DoubleClickSpeed, MouseSpeed, MouseTrails, and so on. These should sound familiar, as they correspond to the options in the Mouse program of your Control Panel. (Figure C-2 clarifies this relationship.)

Each value usually contains either a number or a block of text. DoubleClickSpeed, for example, comes set at 500. In this case, that means 500 milliseconds between clicks, but each Registry value may refer to a different kind of units.

Tip

Many of the Windows Explorer keyboard shortcuts also work in RegEdit. For example, once you’ve clicked a key, you can press the right or left arrow to reveal and hide its subkeys. You can also type the first letter of a subkey’s name to highlight it in the left pane, or a value’s name in the right pane. And you can press the Backspace key to jump to the “parent” key, the one that contains the subkey.

Backing Up Key Values

In general, you won’t go into the Registry unless you truly want to make a change. That’s why the program is called RegEdit, not RegViewer.

As you know, though, making the wrong change can botch up your copy of Windows—and RegEdit has no Undo command and no “Save change before closing?” message.

That’s why it’s essential to back up a Registry key—or even its entire root key—before you change it. Later, if the change you made doesn’t work the way you’d hoped, you can restore the original.

To back up a key (including and all its values and subkeys), just select it and then choose FileExport. Save the resulting key somewhere safe, like your desktop. Later, you can reinstate the key by double-clicking the .reg file you exported. (Or, if you’re paid by the hour, open RegEdit, choose FileImport, and manually open the .reg file.)

Note

Importing a .reg file merges it with the data already in the Registry. Any values you edited will go back to their original versions, provided you haven’t renamed them.

This means, for instance, that if you export a key, rename one of the values in that key, and then re-import the .reg file, the value you renamed will still be there, along with the value by its original name. In other words, a .reg file is a very good idea, but it’s not a “get out of jail free card”; it won’t undo all types of changes.

The only way to get a true Registry backup is to back up the Registry hive files themselves. The Microsoft Backup program described starting in Section 16.7 can do this for you.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.147.215