Editing Values in the Registry

Each value entry in Registry Editor appears as a string that consists of three components, as shown in Figure 24.2.

Figure 24.2 The three components of a value entry

The following rules govern the content of these three value entry components:

The Registry preserves case as you type it for any entry but ignores case in evaluating the data. However, the data is defined by specific applications (or users), so applications that use the data might be case sensitive, depending on how the program that uses it treats the data.

To edit a value by using Regedt32 or Regedit

1. In the right pane of the Registry Editor window, double-click the value entry.

– Or –

In Regedt32, from the Edit menu, click String, Binary, DWORD, or Multi String as appropriate for the selected value. In Regedit, from the Edit menu, click Modify.

2. Edit the value that appears in the related Editor dialog box, then click OK.

The Binary and DWORD options in Regedt32 let you select the base of the number system you use to edit your data. In the Binary editor, you can edit your data as binary (base 2) or hexadecimal (hex—base 16). In the DWORD editor, you can edit your data in binary, hex, or decimal (base 10). Hex is the default base for both editors. The right pane of the Registry Editor always displays these types of data in hex.

BMW

Tip

To view numbers in decimal format, double-click the value entry and select the Decimal format option. Cancel the dialog box when you finish checking the value.

Information stored in a nonvolatile key remains in the Registry until you delete it. Information stored in a volatile key is discarded when you shut down the system. However, volatile keys can contain nonvolatile subkeys and nonvolatile keys can contain volatile subkeys. For example, the HKEY_LOCAL_MACHINE\ Hardware key is volatile, but many of its subkeys are nonvolatile.

Note

As your Registry grows in size, eventually you might want to set a larger value for RegistrySizeLimit. For more information, see "Registry Size Limit" in Chapter 23, "Overview of the Windows NT Registry."

Adding a Key

You can add a key to store data in the Registry. For example, you can add a subkey under CurrentControlSet\Services to start a service process you have written or to install a device driver that doesn't have an installation program.

To do this, you must have Create Subkey access permission for the key under which you are adding a subkey, as described in "Assigning Access Rights to Registry Keys," later in this chapter.

To add a key to the Registry by using Regedt32

Select the key or subkey under which you want the new key to appear.

From the Edit menu, click Add Key or press the INS key.

In the Key Name box of the Add Key dialog box, type the name that you want to assign to your key.

The key name cannot contain a backslash (\), and it must be unique in relation to other subkeys at the same level in the hierarchy. That is, Key1 and Key2 can each have a subkey named Key3, but Key1 cannot have two subkeys named Key3.

Leave the Class box blank. This box is reserved for a future use.

Click OK to display the new key in the Registry Editor window.

To add a key to the Registry with Regedit

Select the key or subkey under which you want the new key to appear.

From the Edit menu, click New, then click Key. A new folder appears under the selected key, with the name of the folder selected so that you can edit it.

Type a name for the key and press Enter.

Adding a Value Entry to a Registry Key

You can use the Registry editors to assign a new value entry to a key or edit the value entry of an existing key. When you do this, the value that you add appears in the data pane of the selected Registry window.

To determine value entries you might add, see the tuning and troubleshooting information in Regentry.hlp, which is included in the Windows NT Workstation Resource Kit CD.

To add a value entry to a Registry key by using Regedt32

1. Select the subkey to which you want to add a value entry.

2. From the Edit menu, click Add Value.

Tip

To quickly open the Add Value dialog box, switch to the right pane by using the TAB key or the mouse, then press the INS key.

3. In the Add Value dialog box, type the name you want to assign to the new value entry.

4. In the Data Type box, select the type that you want to assign to the value entry.

The data types are described in "Value Entries in the Registry Keys" in Chapter 23, "Overview of the Windows NT Registry."

5. Click OK, then type the value in the String Editor dialog box. Click OK again to display the new entry in the Registry Editor window.

To add a value entry to a Registry key by using Regedit

1. Select the subkey to which you want to add a value entry.

2. From the Edit menu, click New, then click String Value, Binary Value, or DWORD Value depending upon the data type of the value you are adding.

3. The new value entry appears in the right panel with the name of the value entry selected so you can edit it.

4. Type a name for the value entry.

5. To edit the value, double-click the value entry, then edit the value in the Value data box of the Datatype Editor dialog box, then click OK.

Deleting a Key or a Value Entry

To remove selected keys or value entries from the Registry, you can use the Delete command from the Edit menu or you can press the DELETE key. However, you cannot delete any of the predefined subtrees or change the name of a key.

Caution There is no Undo command for deletions. Registry Editor prompts you to confirm the deletions if Confirm On Delete is selected from the Options menu. When you delete a key, the message does not include the name of the key you are deleting. Check your selection carefully before proceeding. To recover a subkey of HKEY_LOCAL_MACHINE\System\CurrentControlSet, restart the computer. Press the spacebar immediately when you see the message Press spacebar now to invoke Hardware Profile/Last Known Good Menu.

In Regedt32, you can protect the Registry from accidental deletions by using the following methods:

From the Options menu, select Read Only Mode. When this option is selected, Regedt32 does not save any changes. This protects the data from accidental changes.

From the Options menu, select Confirm On Delete. When this option is selected, Regedt32 prompts you to confirm deletion of any key or value.