Registry Structure
For a better understanding of the logical structure of the registry, we will compare this to
the file system that exists on the disk. The registry contains keys, which are similar to
folders, and values, which can be compared to the files stored on the disk. Registry keys
are container objects that can store both subkeys and values. Registry values contain the
data (like the files). The top-level keys of this hierarchical structure are called root keys.
The convention used to name registry keys and values is also similar to the one used to
name files and folders. For example, a typical folder path such as D:\WORK\BHV is
comparable to a typical registry path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet.
In Windows 2000/XP and Windows Server 2003, the registry comprises the following
five root keys: HKEY_CLASSES_ROOT, HKEY_CURRENT_USER,
HKEY_LOCAL_MACHINE, HKEY_USERS, and HKEY_CURRENT_CONFIG. This
hierarchical registry structure is illustrated in Fig. 1.7.
Figure 1.7: Hierarchical structure of the registry
All of the names of the root keys begin with the HKEY_ string, which indicates that this
is a handle that can be used by a program. The handle represents the value used uniquely
to identify the resource that can be accessed by a program. Table 1.1 lists the root keys
that exist in Windows NT/2000, Windows XP, and Windows Server 2003 registries, the
respective abbreviations that are often used to designate these root keys, and provides a
brief description.
Table 1.1: Registry Root Keys
Root key Abbrevi
ation
Description
HKEY_LOCAL_M
ACHINE
HKLM Contains global hardware information and operating
system data, including bus type, system memory, device
drivers and other information used during the system
boot process. Information on this key is applicable to all
users who log on to the local system. Actually, this key is
a placeholder that corresponds to no physical file stored
on the disk. Instead, it contains other keys that do:
(HKEY_LOCAL_MACHINE\SYSTEM,
HKEY_LOCAL_MACHINE\SAM,
HKEY_LOCAL_MACHINE\SECURITY,
HKEY_LOCAL_MACHINE\SOFTWARE). This key
has three top-level aliases - HKEY_CLASSES_ROOT,
HKEY_CURRENT_CONFIG, and HKEY_DYN_DATA
- a hidden registry key that serves as a placeholder for
performance data lookups.
HKEY_CLASSES_
ROOT
HKCR This key contains information concerning filename
associations, OLE (Object Linking and Embedding)
information associated with COM objects, and file-class
associations (this data is equivalent to the registry that
existed in earlier Windows versions). Parameters
contained in this key are equivalent to those stored under
the HKEY_LOCAL_MACHINE\Software\Classes key.
You can find more detailed information on the
HKEY_CLASSES_ROOT key in the "OLE
Programmer's Reference" manual included with the
Windows Platform Software Development Kit (SDK).
HKEY_CURRENT_
CONFIG
HKCC Contains the configuration data of the current hardware
profile. Hardware profiles are sets of modifications
introduced into the standard configuration of services and
devices set by the Software and System subkeys of the
HKEY_LOCAL_MACHINE root key. The
HKEY_CURRENT_CONFIG key contains only changed
data.
Moreover, the data contained in this key is also contained
in the
HKEY_LOCAL_MACHINE\System\CurrentControlSet\
HardwareProfiles\Current key.
Table 1.1: Registry Root Keys
Root key Abbrevi
ation
Description
HKEY_CURRENT_
USER
HKCU Contains the user profile of the user who is currently
logged on to the system, including environment
variables, desktop settings, network settings, and
application settings.
This key is a reference to the HKEY_USERS\user_SID
key, where user_SID is the Security ID of the user who is
currently logged on to the system.
HKEY_USERS HKU Contains all active user profiles, including
HKEY_CURRENT_USER and the default user profile.
Users who can access the server through the network do
not have profiles under this key because their profiles are
loaded remotely on their workstations.
Windows NT/2000, Windows XP, and Windows Server
2003 require that each user who logs on to the system
have his or her own user account. The HKEY_USERS
key contains the \.Default subkey, which is used before
any user logs on to the system. It also contains other
subkeys associated with the Security ID assigned to the
appropriate user.
Registry data are parameters stored within registry keys. Each parameter has its own
name, data type, and value. The three parts of the registry entry are also stored in the
following order:
All registry data types defined and used in Windows NT/2000, Windows XP, and
products of the Windows Server 2003 family are listed in Table 1.2.
Table 1.2: Registry Data Types
Data type Description
Table 1.2: Registry Data Types
Data type Description
REG_BINARY Binary data. Most hardware components
use binary information. Registry editors
display this information in hex.
REG_DWORD This data is represented as a 4-byte binary
value (double word). Most services and
device drivers use this data type. Registry
editors display this data using binary, hex,
or decimal formats.
REG_EXPAND_SZ Expandable data string. This text string
contains a variable name, which can be
substituted by a variable value when called
by an application.
REG_MULTI_SZ Multi-string field. Normally, all values that
actually represent lists of text strings have
this data type. A NULL character is used as
a separator.
REG_SZ Text string in user-friendly format.
Normally, this data type is used for
component descriptions.
REG_DWORD_LITTLE_ENDIAN 32-bit number in little-endian format.
Equivalent of the REG_DWORD data type.
When using the little-endian format, the
lowest bit ("little end") appears first when
representing the value. For example, the
A02B hex value will be represented as
2BA0.
The little-endian format is used in Intel
processors.
REG_DWORD_BIG_ENDIAN 32-bit number in big-endian format. In
contrast to the little-endian format, the
highest bit ("big end") appears first when
representing the value.
REG_LINK Unicode symbolic link. This data type is
intended for internal use only.
The REG_LINK is especially interesting
Table 1.2: Registry Data Types
Data type Description
because it allows one registry entry to
reference another registry key or registry
value. For example, if a registry contains
the entry \Root1\Link with the REG_LINK
data type and its value is \Root2\RegKey,
and the RegKey key contains the RegValue
value, then this value can be identified
using the following two paths:
\Root1\Link\RegValue and
\Root2\RegKey\RegValue.
Windows NT/2000, Windows XP, and
Windows Server 2003 make active use of
this method. For example, some of the root
keys listed in Table 1.1 are links to the
nested keys of other root keys.
REG_NONE No defined data type.
REG_QWORD 64-bit value.
REG_QWORD_LITTLE_ENDIAN 64-bit value represented using little-endian
notation. Equivalent of the REG_QWORD
data type.
REG_RESOURCE_LIST List of hardware resources, which are only
used in
HKEY_LOCAL_MACHINE\HARDWAR
E.
REG_FULL_RESOURCE_DESCRIPTOR Hardware resource handle, which is only
used in
HKEY_LOCAL_MACHINE\HARDWAR
E.
REG_RESOURCE_REQUIREMENTS_LIS
T
List of hardware resources, which is only
used in
HKEY_LOCAL_MACHINE\HARDWAR
E.
Registry Data Storage
All Windows NT-based operating systems, including Windows 2000, Windows XP, and
products of the Windows Server 2003 family, store registry entries as an atomic structure