Both keys and values borrow their naming convention from the file system. Thus, you can uniquely identify a value with the name mark, which is stored in a key called trade, with the name trade\mark. One exception to this naming scheme is each key’s unnamed value. Regedit displays the unnamed value as (Default).
Values store different kinds of data and can be one of the 12 types listed in Table 4-1. The majority of registry values are REG_DWORD, REG_BINARY, or REG_SZ. Values of type REG_DWORD can store numbers or Booleans (on/off values); REG_BINARY values can store numbers larger than 32 bits or raw data such as encrypted passwords; REG_SZ values store strings (Unicode, of course) that can represent elements such as names, file names, paths, and types.
Value Type
Description
REG_NONE
No value type
REG_SZ
Fixed-length Unicode string
REG_EXPAND_SZ
Variable-length Unicode string that can have embedded environment variables
REG_BINARY
Arbitrary-length binary data
REG_DWORD
32-bit number
REG_DWORD_BIG_ENDIAN
32-bit number, with high byte first
REG_LINK
Unicode symbolic link
REG_MULTI_SZ
Array of Unicode NULL-terminated strings
REG_RESOURCE_LIST
Hardware resource description
REG_FULL_RESOURCE_DESCRIPTOR
Hardware resource description
REG_RESOURCE_REQUIREMENTS_LIST
Resource requirements
REG_QWORD
64-bit number
The REG_LINK type is particularly interesting because it lets a key transparently point to another key. When you traverse the registry through a link, the path searching continues at the target of the link. For example, if \Root1\Link has a REG_LINK value of \Root2\RegKey and RegKey contains the value RegValue, two paths identify RegValue: \Root1\Link\RegValue and \Root2\RegKey\RegValue. As explained in the next section, Windows prominently uses registry links: three of the six registry root keys are links to subkeys within the three nonlink root keys.
Registry Logical Structure
You can chart the organization of the registry via the data stored within it. There are six root keys (and you can’t add new root keys or delete existing ones) that store information, as shown in Table 4-2.
Root Key
Description
HKEY_CURRENT_USER
Stores data associated with the currently logged-on user
HKEY_USERS
Stores information about all the accounts on the machine
HKEY_CLASSES_ROOT
Stores file association and Component Object Model (COM) object registration information
HKEY_LOCAL_MACHINE
Stores system-related information
HKEY_PERFORMANCE_DATA
Stores performance information
HKEY_CURRENT_CONFIG
Stores some information about the current hardware profile
Why do root-key names begin with an H? Because the root-key names represent Windows handles (H) to keys (KEY). As mentioned in Chapter 1, HKLM is an abbreviation used for HKEY_LOCAL_MACHINE. Table 4-3 lists all the root keys and their abbreviations. The following sections explain in detail the contents and purpose of each of these six root keys.
Root Key
Abbreviation
Description
Link
HKEY_CURRENT_USER
HKCU
Points to the user profile of the currently logged-on user
Subkey under HKEY_USERS corresponding to currently logged-on user
HKEY_USERS
HKU
Contains subkeys for all loaded user profiles
Not a link
HKEY_CLASSES_ROOT
HKCR
Contains file association and COM registration information
Not a direct link; rather, a merged view of HKLM\SOFTWARE\Classes and HKEY_USERS\
HKEY_LOCAL_MACHINE
HKLM
Global settings for the machine.
Not a link
HKEY_CURRENT_CONFIG
HKCC
Current hardware profile
HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current
HKEY_PERFORMANCE_DATA
HKPD
Performance counters
Not a link
HKEY_CURRENT_USER
The HKCU root key contains data regarding the preferences and software configuration of the locally logged-on user. It points to the currently logged-on user’s user profile, located on the hard disk at \Users\
Subkey
Description
AppEvents
Sound/event associations
Console