
Some of the main topics in this chapter are
Many times, you have to rely on the Registry Editor to make changes to the Registry. For example, many of the fixes that you find in Microsoft's Knowledge Base require that you edit the Registry. A lot of suggestions that you find in the Windows NT resource kits also require that you edit the Registry. Thus, the Registry is just one of the many tools available to you for diagnosing and fixing problems.
REGEDT32 is your window into the Windows NT 4.0 Registry. Even though REGEDT32 is very powerful, it's a very simple program. It doesn't have a toolbar, but its menus are fairly straightforward. It displays each root key in its own MDI (multiple document interface) window. Within each window, it displays the organization of the Registry on the left side of the window and the actual data on the right side--not too complicated. You learn about using REGEDT32 in this chapter, including tips for getting around some of the limitations of REGEDT32.
CAUTION: Windows NT Server 4.0 provides an alternative Registry Editor: REGEDIT.EXE. It's identical to the REGEDIT.EXE found in Windows 95. Microsoft recommends that you not use REGEDIT.EXE in NT because it incorrectly handles some of the data types that are unique to the NT Registry (REG_EXPAND_SZ and REG_MULTI_SZ). In NT, you should only use REGEDIT.EXE to search the Registry, which is a capability that REGEDT32.EXE doesn't possess.
REGEDT32 is in the C:\WINNT\System32 folder. The file name is REGEDT32.EXE. Choose Run from the Start menu, type REGEDT32, and click OK. The REGEDT32 window displays. You can also drag REGEDT32.EXE from the C:\WINNT\System32 folder to the Start button to create a shortcut to it.
Figure 43.1 shows you what REGEDT32 looks like when you open it on your desktop window. You see one MDI window for each root key in the Registry. In each window, you see two panes, which REGEDT32 separates by a divider that you can drag left or right to change the size of each pane. The following sections describe the contents of each pane.
The left pane of REGEDT32 works similarly to the left pane of Windows Explorer.
The left pane of each root key's window shows the organization of that key--the hierarchy. Even though a key is physically stored in multiple hives, REGEDT32 displays the entire key as one logical unit. When you update a key in REGEDT32, it automatically updates the appropriate hive.
The title bar of each window indicates the name of the root key and the computer that contains the Registry you're editing. It contains several subkeys that REGEDT32 represents as folders. Each subkey can contain more subkeys (also represented by folders), and each of those subkeys can contain more subkeys. Double-click a folder that contains a plus sign (+) to open it or double-click a folder that contains a minus sign (-) to close it.
Mouse challenged? You can also use the keystrokes listed in Table 43.1 to move around REGEDT32. These keys are often the quickest way to maneuver because you don't have to stumble around with the mouse, trying to hit those tiny folder icons.
| Key | Description |
| Keypad + | Expands the selected folder one level |
| Keypad - | Collapses the selected folder one level |
| Keypad * | Expands all levels of the selected folder |
| [arrowup] | Moves up the list one key |
| [arrowdown] | Moves down the list one key |
| Home | Moves to the first key in the list |
| End | Moves to the last key in the list |
| Page Up | Moves up one screen in the list |
| Page Down | Moves down one screen in the list |
| Tab | Moves the highlight to the right pane |
The right pane shows the value entries for the key you've selected in the left pane. Each row in the right pane represents a single value entry and looks something like Name : Type : Value. Name is the value entry name, Type is the value entry type (REG_SZ, and so on), and Value is the value entry data. REGEDT32 separates each part with a colon (:). Therefore, Texas : REG_SZ : "Howdy" is a REG_SZ value entry named Texas that contains the word Howdy. Easy stuff.
Within some keys, you'll notice a value entry called (No Name). This shows up as (Default) in REGEDIT. This is a string value entry that represents the default value for that Registry key. All Registry keys contain this value entry, but some keys don't contain any additional value entries. REGEDT32 also doesn't show default value entries that haven't yet been assigned a value. Aside from (No Name), each key can contain zero or more value entries that have both a name and data.
TIP: You can make REGEDT32 read-only so that you can't accidentally mess up any settings while you're getting used to working with REGEDT32. Choose Options, Read Only Mode. Now, REGEDT32 won't enable you to make any changes to the Registry. Choose Options, Read Only Mode again to be able to make changes.
When you search the Registry, REGEDT32 looks for keys that match the text you specify. However, you can't use REGEDT32 to search for value entry names or value data, which makes this feature somewhat useless (you'll usually want to search for names and paths in value entries). Here's how to search the Registry for matching keys:
Make sure that you deselect Match Whole Word Only if you want to find partial matches.
3. Click Find Next, and REGEDT32 searches for a match. This can sometimes take quite a while--up to a few minutes on slower machines. If REGEDT32 finds a matching key, it selects that key in the left pane.
4. If the result isn't exactly what you had in mind, click Find Next again to repeat the search. When REGEDT32 reaches the bottom of the Registry, it displays a dialog box telling you that it can't find the requested key.
5. Close the Find dialog box.
TIP: If you need to search for value entry names and data, use REGEDIT.EXE.
NOTE: If you select any Registry key in the left pane of a window and press a key on the keyboard, REGEDT32 selects the first Registry key that starts with that character. Press the same key again, and REGEDT32 selects the next Registry key that starts with that character. For example, expand HKEY_CLASSES_ROOT. Then press the period key, and REGEDIT selects .386 if that's the first entry that begins with a period; press b, and REGEDIT selects .bat; press m, and REGEDIT selects .bmp. If you pause between keystrokes, REGEDIT starts your incremental search (a character by character search) over with the next key.
In REGEDT32, you can't rename a key or value entry. If you need to rename a key or value entry, use REGEDIT.EXE.
You can, however, work around this limitation. Save a key and its subkeys to a temporary hive, as described in "Saving and Restoring Keys" later in this chapter. Then, you can restore that temporary hive into a new subkey with a different name and remove the original key.
As a user, changing a value entry's setting is probably the number one activity you'll do with REGEDT32. You might want to personalize your desktop, for example, or you might need to adjust a TCP/IP setting to work better with your network:
2. Change the value, and click OK to save your changes.
The String Editor dialog box shows you the original data before you start editing.
Each line in the Multi-String Editor dialog box represents a separate string in REG_MULTI_SZ.
The editor for REG_EXPAND_SZ looks just like the editor for REG_SZ (String Editor).
In the DWORD Editor dialog box, select Decimal if your hexadecimal math is a bit rusty.
In the Binary Editor dialog box, you can use the Windows calculator (in Scientific mode) to convert decimal values to hexadecimal values for use with this dialog box.
TIP: Protect yourself when changing value data. Save to disk the Registry key that you're changing, as described in "Saving and Restoring Keys," later in this chapter. This way, if something goes terribly wrong, you can always restore the original key, as described in the same section.
NOTE: Changes that you make to the Registry might not be reflected immediately in Windows or the programs that are currently running. The only way to make sure is to restart Windows after closing REGEDT32 or restart any affected program.
Creating a new key or value entry is harmless--unless, of course, you know for sure that either Windows or another program will use your new key. For example, the Microsoft Knowledge Base might instruct you to create a new Registry key to fix a problem. That's useful. Creating a new key out of thin air is pretty useless, however. To create a new key or value entry, do one of the following, as appropriate:
TIP: To quickly add a value entry, move the highlight to the right pane by pressing Tab and then Insert.
Be very careful about deleting keys and value entries from the Registry; if you carelessly delete these, you'll probably prevent Windows from working properly. If you don't know for sure what will happen, or you haven't been instructed to do so, don't do it. If you're sure it's okay to proceed, use these steps:
2. Press Delete, and REGEDT32 asks you to confirm that you want to delete
the item.
3. Click Yes.
TIP: Before deleting a key, save it to disk as described in "Saving and Restoring Keys," later in this chapter. Then, if something goes wrong, you can restore it, as described in the same section.
NOTE: If you mess up badly while working in HKEY_LOCAL_MACHINE\System\CurrentControlSet, you can easily recover your system. Restart the computer, and press the spacebar when you see Press spacebar to invoke Hardware Profile/Last Known Good Menu.
You can save a key, all its subkeys, and all its value entries to disk as a hive. This is a hive separate from the other hives you find in C:\WINNT\System32\Config. Hives you create by saving a key use the same format as the system hives, however. Think of these as a temporary hive. You have to be a member of the Administrators group with Backup permission, though. Saving a key as a hive is very valuable for a number of reasons:
To save a key as well as all its subkeys and value entries as a hive, use these steps:
2. Choose Registry, Save Key from the main menu. REGEDT32 displays the
Save Key dialog box, which works exactly like every other Save As dialog box in Windows
NT 4.0.
3. Type the name of the hive (preferably without an extension because that's how Windows NT 4.0 likes to see hives) into which you want to save the key, and click Save.
Restoring a hive into a key replaces all of that key's subkeys and value entries with the contents of the hive. To restore a hive that you saved, as described in the previous section "Saving a Key, Its Subkeys, and Value Entries":
2. Choose Registry, Restore. REGEDT32 displays the Restore Key dialog box.
3. Select the hive, and click Open.
4. Click Yes to restore the hive.
NOTE: You can't load a REG file created by REGEDIT by using REGEDT32. Likewise, you can't load a file created by REGEDT32 by using REGEDIT. REGEDIT exports keys into text files (REG files), whereas REGEDT32 saves keys in binary files.
Loading a hive is very different from restoring a hive. When you restore a hive, the contents of the hive replace the key in which you restore it. When you load a hive, REGEDT32 loads that hive in its own space. That is, you get a new subkey under HKEY_LOCAL_MACHINE or HKEY_USERS. Loading a hive doesn't replace anything. Like saving and restoring hives, loading hives is very useful for certain purposes. First, you can load a hive from a computer that is working properly so that you can fix the problem. Second, you can load a user's NTUSER.DAT, if he or she isn't logged on to the computer so that you can fix problems or make other changes.
To load or unload a hive, you must have administrator privileges with Restore and Backup permissions. Here's how to proceed:
2. Choose Registry, Load Hive to access the Load Hive dialog box.
3. Select the hive you want to load, and click Open. REGEDT32 opens another
Load Hive dialog box in which you specify the name of the key in the Registry.
4. Type the name of the key into which you want to load the hive, and click
OK.
5. Click Yes to load the hive. REGEDT32 creates a new subkey by that name under the root key you chose in Step 1.
NOTE: You can't load a hive that contains a key that Windows NT 4.0 or another program is currently using. For example, if you want to load the System hive from a remote computer, you must first save a copy of that hive to another file. Then, you can load the copy in REGEDT32.
After you've made any changes you want to the hive you loaded earlier, use these steps to unload it:
2. Choose Registry, Unload Hive.
3. Click Yes, and REGEDT32 removes that subkey from the Registry. Any changes you've made, however, are saved to the hive on disk.
You can export the contents of a Registry key to a readable text file, which makes studying the file easier. Here's how:
2. Choose Registry, Save Subtree As. You see the familiar Save As dialog
box.
3. Type the name of the text file in which you want to save the key, and click Save.
NOTE: Unlike REGEDIT, however, you can't import the file back into the Registry with REGEDT32.
Figure 43.8 shows what this text file looks like in Notepad. It doesn't use the same format as REGEDIT when it exports a key into a REG file. In fact, REGEDT32 only exports the selected key; it doesn't export any subkeys.
You can save keys such as HKEY_LOCAL_MACHINE\Hardware to a text file, even though you can't save them as a hive.
© Copyright, Macmillan Computer Publishing. All rights reserved.