|
Registry Data Types
The MinAnimate value entry is of type REG_SZ. REG means Registry; SZmeans string, indicating that the value entry contains a string of text text characters, as opposed to, say, binary data. The WindowMetrics key also contains value entries of two other data types, REG_BINARYbinary data and REG_DWORD the double-word data type. Strings and binary data are the most widely used of the data types in the Registry. Double-word data comes third, followed by REG_MULTI_SZ multistring entries, and REG_EXPAND_SZ expandable strings. Table 11.1 provides a roundup of the five most widely used data types.
Table 11.1: The Five Most Widely Used Registry Data Types
|
Type |
Type Displayed |
Explanation |
|
String |
REG_SZ |
Text |
|
Multistring |
REG_MULTI_SZ |
Text, but with multiple text values |
|
Expandable String |
REG_EXPAND_SZ |
Text, but expandable |
|
Binary |
REG_BINARY |
A binary value, displayed as hexadecimal |
|
DWORD |
REG_DWORD |
Double-word: a 32-bit binary value displayed as an |
|
|
|
8-digit hexadecimal value |
Other Registry Data Types You’ll Seldom Need to Use
Beyond the five widely used data types listed in Table 11.1, the Registry can contain many different data types, such as REG_DWORD_BIG_ENDIAN a value stored in reverse order of double-word value, REG_ DWORD_LITTLE_ENDIAN another type of double-word value, REG_FULL_RESOURCE_DESCRIPTOR a hardware-resource list, REG_QWORD a quadruple-word value, and REG_FILE_NAME a filename. You shouldn’t need to mess with any of these unless you get into programming Windows. You can create and edit value entries with any of these data types. We’ll get to that a bit later in the article, after discussing where the Registry is stored and how to find information in it.
Where the Registry Is Stored
Most of the Registry is stored in several different files on your hard drive. Part of the Registry is created automatically when Windows boots and discovers which devices are attached to your computer. These files are binary and are called hives think bees, not allergies or hive files. Perhaps surprisingly, some of the hives aren’t hidden files, so you don’t even need to tell Windows to display hidden files before you can see them. But you do have to go through Windows’s veil of secrecy over the files by clicking the Show the Contents of This Folder link. Hive files containing computer-related information are stored in the Windowssystem32 config folder, where Windows is your Windows folder. Hive files containing user-specific information are stored in the UsersUsername folder for each user. These are the main hive files:
SYSTEM This file contains information about the computer’s hardware and about Windows. This information goes into the HKEY_LOCAL_MACHINESYSTEM key.
NTUSER.DAT This file contains information about the user’s preferences. Windows keeps an NTUSER.DAT file for each user in the UsersUsername folder. This information goes into the HKEY_CURRENT_USER subtree.
SAM This file contains the user database. This information goes into the HKEY_LOCAL_MACHINE SAM key.
SECURITY This file contains information on security settings. This information goes into the HKEY_LOCALMACHINESECURITYkey.
SOFTWARE This file contains information on the software installed on the computer. This information goes into the HKEY_LOCAL_MACHINESOFTWARE key.
DEFAULT This file contains information about the default user setup. This information goes into the HKEY_USERSDEFAULT key. Each of the hive files has a log file named after it: DEFAULT.LOG, SOFTWARE.LOG, NTUSER.DAT.LOG, and so on. These log files note the changes to the hive files so that, if a change is applied that crashes the system, Windows can read the log, identify the problem change, and undo it. Windows doesn’t let you open the hive files directly other than by using Registry Editor. But you can find keys and value entries or information in the Registry, change values, and create and delete keys and value entries of your own.
Finding Information in the Registry
There are two ways to find information in the Registry: by digging through the Registry looking for it, or by using the Find function. Digging through the Registry takes minimal explanation, because it’s very similar to browsing in Explorer in Explore mode. You can expand and collapse keys as you would drives and folders in Explorer, and you can use type-down addressing to reach the next key or entry matching the letters you type. But because of the number of keys and value entries the Registry contains, you’ll usually do better by searching through it rather than browsing. If you know the name of a key, the name of a value entry, or the data contained in a value entry, you can search for it. For example, if you wanted to find where FTP sites were listed, you might search for FTP Sites. If you wanted to find out what the entry for the Microsoft Office AutoCorrect file was called, you might search for .ACL, the extension of the AutoCorrect file. To search the Registry, follow these steps:
1. In Registry Editor, choose Edit Find or press Ctrl+F. Registry Editor displays the Find dialog box shown here.
2. In the Find What text box, type the term for which you want to search.
3. If you want to restrict the search, select only the check boxes for the items you’re looking at - Keys, Values, or Data - in the Look At group box.
4. If you want to search for only the entire string, select the Match Whole String Only check box. Selecting this check box prevents Find from finding the string you’re looking for inside other strings - it makes Find locate only whole strings that match the string in the Find What text box.
5. Click the Find Next button to start the search.
Because of the volume of information that Windows stores in the Registry, the first match you find may not be the key or value entry, or value you need. For example, if you use your company’s name as the Find item when looking for the RegisteredOrganization key for Windows, you may find another key, such as the registered organization for Internet Explorer. Close examination of the key will usually tell you whether you’ve found the key you were looking for. If not, press the F3 key or choose Edit Find Next to find the next instance.
Editing a Value Entry
To edit a value entry in the Registry, navigate to it or find it, and then double-click it. Alternatively, select it and choose Edit Modify or right-click it and choose Modify from the shortcut menu. Windows displays the Edit dialog box for the type of data the value entry contains.
String values and expandable string values are the easiest values to edit. In the Edit String dialog box , enter the text of the string in the Value Data text box, and then click the OK button. Multistring values are relatively simple to edit. In the Edit Multi-String dialog box enter all the data for the value entry on separate lines, and then click the OK button. Double-word values are the next easiest values to edit. In the Edit DWORD 32-bit Value dialog box , enter the data in the Value Data text box, then choose the Hexadecimal option button or the Decimal option button as appropriate in the Base group box. When you’re editing a built-in double-word value, you shouldn’t need to change the existing Base setting. Click the OK button. Binary values are difficult to change, and you probably won’t want to mess with them for fun. In the Edit Binary Value dialog box , edit the data in the Value Data text box with great care, and then click the OK button.
Adding a Key or a Value Entry
You can add a key or a value entry to the Registry either automatically or manually. To add a key or value entry to the Registry automatically, double-click a .reg file that you’ve received. For example, some programs sold via download use Registry keys to implement a license: You pay for the program and download it. The company then e-mails you a license and a .reg file. To add the registration data to your Registry, double-click the .reg file. Windows adds the necessary keys and value entries to the Registry. To add a key or a value entry to the Registry manually, follow these steps:
1. Right-click the key in which you want to create the new key or value entry, choose New from the context menu, and choose the appropriate item from the submenu: Key, String Value, Binary Value, DWORD 32-Bit Value, QWORD 64-Bit Value, Multi-String Value, or Expandable String Value. Registry Editor creates a new key named New Key #1 or a new value entry named New Value #1 or the next available number and displays an edit box around it.
2. Type the name for the key or value entry.
3. Press the Enter key or click elsewhere in the Registry Editor window. Registry Editor assigns the name you specified to the key or value entry. If you created a value entry, double-click it. Registry Editor displays the Edit dialog box for the value entry’s data type. Enter the data for the value entry as described in the previous section.
Deleting a Key or a Value Entry
Just as you can create keys and value entries, you can delete them. Generally speaking, it’s a bad idea to delete any keys other than those you’ve created. Windows itself and Windows programs protect some keys in the Registry, but you’ll find a surprising number that aren’t protected and that you can therefore delete freely. To delete a value entry, right-click it and choose Delete from the context menu. Registry Editor displays the Confirm Value Delete dialog box shown here. Click the Yes button to confirm the deletion. To delete a key, right-click it and choose Delete from the shortcut menu. Registry Editor displays the Confirm Key Delete dialog box shown here to make sure you want to get rid of the key and all its subkeys and value entries. Click the Yes button to delete the key.If the key or value entry is locked against deletion, Registry Editor displays an error message box.
Copying a Key Name
If you’re describing to someone how to find particular information in the Registry, you’ll need to get the key name right. But you don’t need to type it painstakingly - you can copy it instead. To copy a Registry key name, select it in the left pane in Registry Editor and choose Edit Copy Key Name. You can then paste it from the Clipboard into a program.
Examples of Working with the Registry
As mentioned at the beginning of the article, Microsoft reckons you should seldom or preferably never need to make changes to the Registry directly. But you’ll probably run into tips and tweaks, online or in magazines, that promise to improve Windows’ performance, compatibility, or behavior with a judicious change or two. This section presents some examples of working with the Registry to customize your system. Remember that tinkering with the Registry isn’t recommended, because it can have unexpected results. Before you try any of these examples, back up your Registry as described earlier in this article and make sure that you know how to restore it.
Evaluate Any Registry Changes Carefully before Trying Them
Before you try applying any Registry change that you read about online, think carefully about how much you trust the source of the information and whether you’re likely to realize the benefits promised by the change. Changes recommended by print magazines and by reputable online magazines are likely to be okay, but changes posted by supposedly friendly parties in newsgroups or on websites might be malicious rather than helpful. If you have any doubts, spend a few minutes searching for corroboration of the Registry change rather than applying it blindly and suffering the consequences. If you can’t find confirmation of what the change does, don’t try it.
|