Understanding Windows Registry
Understanding Windows Registry
Understanding
The Registry
Editing the registry is not as hard as you might think, but you need to understand
what you’re doing, and it’s essential to make a backup before you make any
changes so that you can back them out if necessary.
By Mike Lewis
along with an icon which shows alias for HKEY_LOCAL_MACH- cludes REGEDIT.EXE, although this
whether the data is binary or string. INE\Software\Classes. might not be the same as the one found
Continuing with the hard disk anal- An alias is not a copy. Rather, it is in Windows 9x. If you upgraded from
ogy, you can identify any key or value another view of the same information. Windows 3.1 to Windows NT, you will
by specifying the path along its branch, If you edit the data in the alias, the have the original 3.1 version of RE-
using the familiar backslash notation. change is immediately reflected in the GEDIT.EXE.
For example, information about in- part of the tree to which the alias refers, As far as the Windows 9x version is
stalled dial-up networking connec- and vice versa. Only one edit actually concerned, its operation is completely
tions is held in HKEY_CUR- takes place, but you are seeing it from straightforward, with all its functions
RENT_USER\RemoteAccess\Addre- two different viewpoints. Figure 3 lists being easily accessible from the regis-
sses. If you drill down through this the aliases in the Windows 9x registry. try and Edit menus. You can also right-
path in the left pane, you will see the One of the root keys, click on an item to edit, delete or
relevant data in the right pane. In this HKEY_DYN_DATA, works slightly rename it, or to create new keys or
example, each data item corresponds differently. This key is essentially a values.
to one DUN connection. RAM-resident copy of certain parts of When you edit a data item in the
the registry which Windows needs to editor, the change is written to the reg-
Aliases get at quickly. It is created at boot time istry almost immediately - you do not
and discarded at shut-down; it never explicitly save the file. If you make a
I said earlier that the registry is di- gets written back to disk. mistake, the only recourse (apart from
vided into six broad sections, one for Because aliases only exist while restoring from a backup) is to edit the
each root key. This is certainly how the Windows is running, they will not get same item again.
registry is usually regarded, but it is backed up if you create your backup Conversely, if another process
not strictly true. The reason is that all copies from DOS. This is not a problem changes a registry item while the edi-
but two of the root keys are in fact as the information in the aliases is all tor is open, the editor will pick up the
aliases for other parts of the tree. available elsewhere in the registry. new setting straight away - although
To see an example of this, drill Windows always re-creates the aliases you might need to refresh the display
down from HKEY_CLASSES_ROOT. during startup. in order to see it (to do so, select View,
You will see that this root key contains Refresh, or press F5).
a large number - perhaps many hun- Registry Editors
dreds - of sub-keys at the first level Remote Registries
down. The first group of these sub- The main tool for viewing and edit-
keys have names which look like file ing the registry is the Microsoft Regis- As well as letting you view and edit
extensions, while the names of the re- try Editor, REGEDIT.EXE. Although the registry on your local machine, the
mainder resemble those of applica- third-party editors exist, you will Microsoft Registry Editor can also ac-
tions. probably want to stick with the official cess registries on other computers on
Now locate HKEY_LOCAL_MA- Microsoft product, given the critical the network. If your machine and the
CHINE\Software\Classes. As you nature of the registry editing process. remote computer are both running NT
can see, this contains exactly the same (That’s not to say that REGEDIT.EXE 4.0, this operation is completely
sub-keys, values and data as is itself completely reliable; the Mi- straightforward. But if either or both
HKEY_CLASSES_ROOT. That’s be- crosoft Knowledge Base notes several machines have Windows 9x, you must
cause HKEY_CLASSES_ROOT is an bugs in the Windows 95 version, but first install the Remote Registry serv-
these are unlikely to cause problems in ice, which in turn depends on having
day-to-day operations.) user-level security enabled and Re-
HKEY_CLASSES_ROOT Windows NT 4.0 comes with a sec- mote Administration services in-
HKEY_CURRENT_USER ond editor: REGEDT32.EXE. This sup- stalled. For step-by-step instructions
HKEY_LOCAL_MACHINE ports certain NT-specific features on setting this up, see Article Q141460
HKEY_USERS
which REGEDIT.EXE does not know in the Microsoft Knowledge Base.
HKEY_CURRENT_CONFIG
HKEY_DYN_DATA about, such as the ability to maintain Once you have installed the neces-
security settings. However, it lacks the sary components, you can access the
very useful search function found in other computer’s registry by selecting
Figure 2 - The six root keys. the standard version. NT 4.0 also in- Connect Network Registry from the
File: E1209.2
PC Support Advisor Update 127 (May 1999) Page 6
End-User Support:Operating Systems
The Registry
registry menu within the editor. Hav- this number can be varied by editing In the case of NT, if the system is
ing done so, you will be able to view SCANREG.INI. configured for dual-booting you
and edit the remote registry in the Windows NT does not include a should boot to DOS or Windows 9x
same way as the local registry. When specific registry backup tool. How- before copying the registry files. Alter-
you have finished, go back to the reg- ever, the standard NT backup utility, natively, boot to DOS from a startup
istry menu and select Disconnect Net- NTBACKUP.EXE, is able to back up floppy. The files which you should
work Registry. the registry, but only to supported tape copy are those stored in the SYS-
drives. TEM32\CONFIG directory, which is
Registry Backup off the Windows directory. Note that
Manual Backups you cannot use this method if the Win-
Backing up the Windows registry Another way of backing up the reg- dows directory is on an NTFS parti-
presents a specific problem: you can- istry is simply to copy the relevant tion, as the booted operating system
not directly copy the relevant files files. You cannot do this while Win- will not be able to access it.
while they are open, and they are al- dows is running but, in the case of Whatever the operating system,
ways open while Windows is running. Windows 9x, you can work round this you can restore the registry by revers-
However, there are a couple of tech- either by booting to DOS (hold down ing the above process.
niques you can use to work round this. F8 during startup, then select Com-
mand Prompt Only) or by exiting to Exporting The Registry
Backup Utilities DOS from the Shut Down dialog. Another approach to backing up
For Windows 95 users, the easiest The two registry files, SYS- the registry is to export it. Exporting
approach is to use the Configuration TEM.DAT and USER.DAT, are the registry is not the same as copying
Backup utility (Figure 4). This copies flagged as hidden, system and read- it. Instead, the process creates a text file
the registry to a compressed backup only. Before copying them, you will which contains the registry data in a
file, the name of which is REG- need to use the ATTRIB command to format similar to that of an INI file (see
BACKn.RBK, where n is a sequence switch off these flags. Once that’s done, Figure 5). If you need to restore the
number. Up to nine generations of you can copy the two files from the registry, you can do so by re-importing
backup can be made. You are Windows directory to another suitable the text file.
prompted to enter a description for the location. Finally, use ATTRIB again to An advantage of this approach is
backup to help you subsequently iden- restore the flags. that you do not have to export the en-
tify it. The backup is always created in
the Windows directory, but you are
free to move it elsewhere.
The same utility can be used to re-
store and delete backups. It can only
restore from the Windows directory
so, if you have moved the file to an-
other directory, you must move it back
before running the utility.
The Configuration Backup utility is
not installed by default. You will find
it on the Windows CD-ROM, in the
\OTHER\MISC\CFGBACK direc-
tory. You can copy the two files
(CFGBACK.EXE and a help file) from
this directory to your hard disk, or you
can run the executable directly from
the CD-ROM.
In Windows 98, the best way of
backing up the registry is to use the
Registry Checker (SCANREGW.EXE).
This creates a backup automatically
each time the computer starts, but it
can also be run on demand. The
backup is held in a CAB file, named
RBn.CAB (where n is a sequence
number), in the SYSBCKUP directory
(this is a hidden directory off the Win-
dows directory). By default, five gen- Figure 4 - The Configuration Backup tool provides the simplest way of
erations of backup are maintained, but backing up and restoring the registry in Windows 95.
tire registry. If you want to try out Automatic Backups ple of extra benefits. As its name sug-
changes which only affect one branch, If the worst happens and you find gests, it performs a check, albeit a rudi-
you can limit the export to that branch. yourself with a damaged registry and mentary one, on the integrity of the
Another benefit is that you can per- no recent backup, there is an escape registry. It does this at boot time. If it
form both the export and import op- route. As soon as Windows has suc- detects a problem, it will automatically
erations from within Windows. cessfully booted, it automatically cre- restore the most recent backup. It will
To start the export process, launch ates a backup, which you can then use also defragment the registry if it de-
the Microsoft Registry Editor, select to restore the registry if the need arises. tects more than half a megabyte of
the branch that you wish to copy, This is not always an ideal solution, as empty space.
choose Export Registry File from the you can only restore the registry as it In the case of Windows 95, only one
Registry menu, and specify the name was at the start of the session, but it generation of automatic backup is
and location of the export file. Note should be enough to get you out of maintained. This consists of two files,
that the Save dialog includes a choice trouble. named SYSTEM.DA0 and USER.DA0.
between exporting the selected branch In Windows 98, these automatic They are hidden, system read-only
and exporting “all”, that is, the whole backups are held in the CAB files cre- files in the Windows directory. If you
registry. ated by the Registry Checker. If you need to restore from them, boot to
The resulting file has the extension need to restore from them, boot to DOS, change the attributes (on the
REG. You can view its contents by DOS, then type SCANREG /RE- backup and the existing registry files),
opening it in a text editor. When work- STORE to launch the command-line and copy the backups over the existing
ing with this file, take care not to dou- version of the utility. You will see a list files. This will only work if you have
ble-click on it, as this will re-import it. of the available backups, from which not booted to Windows since the reg-
You can also import the REG file by you can select the one you wish to istry became corrupted.
selecting Import Registry File from the restore.
Registry menu. The Registry Checker offers a cou- Registry Contents
For the remainder of the article, I
will describe the most important keys
and values in the registry of a typical
PC. As you read this, you might want
to follow along by having your own
registry open in the editor. For conven-
ience, I’ll deal with the root keys in the
order in which they appear in the edi-
tor.
HKEY_CLASSES_ROOT
This branch is an alias for
HKEY_LOCAL_MACHINE\Softwa-
re\Classes (see below), and is a direct
descendant of the REG.DAT file found
in Windows 3.1. It is mainly used to
keep track of file extensions and their
associated applications, documents
and OLE objects. It is a particularly
large branch, with a very large number
of sub-keys at the first level down (I
counted over a thousand on my own
PC).
The first group of these first-level
sub-keys have names that look like file
extensions: .JPG, .XLS and the like.
There is one of these for each “regis-
tered” document type, that is, for each
type of file listed in the File Types tab
in the Options dialog in Windows Ex-
plorer. As a minimum, the sub-key’s
data contains a reference to the class
definition associated with the docu-
Figure 5 - You can export the registry to a text file, in INI format. ment.
File: E1209.4
PC Support Advisor Update 127 (May 1999) Page 8
End-User Support:Operating Systems
The Registry
The class definitions themselves are certain installation routines to create a tion and state of every toolbar and win-
held in the remaining first-level sub- history list for the control which dow, a recently-used file list, the recent
keys. These contain a descriptive name prompts the user for the location of the locations for opening and saving each
for the document type (as it appears in source files. of the file types, and quite a lot more.
the Type column in folder windows), This is followed by Keyboard Lay- This is an unusually large example -
a pointer to the default icon and, where out, which contains settings from the most applications don’t store as much
relevant, information about how the Language tab in Keyboard Properties. as this.
application handles the documents as It includes a key named Preload, which Although HKEY_CURRENT_-
OLE objects and how the documents in turn holds a key for each installed USER\Software is mainly intended for
are manipulated from the Windows keyboard layout. These keys act as third-party vendors, Microsoft also
shell - for example, the actions avail- pointers to keys within HKEY_LO- has a presence there. The key includes
able from the menu which appears CAL_MACHINE\System\Curren sub-keys for each installed Microsoft
when you right-click on the file. t-ControlSet\Control\Keyboard Lay- application (for example, HKEY_-
Although HKEY_CLASSES_ROOT outs, which in turn contain references CURRENT_USER\Software\Micro-
is updated automatically as applica- to the keyboard drivers. soft\Office\8.0\PowerPoint) and also
tions are installed and uninstalled, The next first-level sub-key is Net- for Windows itself (HKEY_CUR-
there might be times when you need to works. It in turn contains two keys: RENT_USER\Software\Microsoft-
edit it yourself. For example, you Persistent lists the mapped drives \Windows\CurrentVersion) . The lat-
might want to restore a file association which are configured for reconnection ter holds user-specific settings for the
which a new application has taken at logon; Recent holds a key for each Windows applets, Internet Explorer,
over from an existing one. However, share on a connected computer which Task Manager and other components.
rather than editing the registry di- has been accessed from this computer. In Windows NT, there are some ad-
rectly, it is easier and safer to make this In each case, this shows the connection ditional first-level keys below
type of change from the File Types tab type and provider name. HKEY_CURRENT_USER. They in-
in the Options dialog. Next, the RemoteAccess sub-key clude Console (settings for the Com-
contains details of the user’s Dial-Up mand Prompt window), Environment
HKEY_CURRENT_USER Networking connections. The key it- (environment variables read at logon)
This root key contains information self contains settings common to all and Unicode (references to applica-
specific to the user, and is an alias for connections, such as the area code and tions that support Unicode).
the user’s branch within HKEY_US- the number of redial attempts. Below
ERS (described below). If user profiles this, the Addresses and Profile keys HKEY_LOCAL_MACHINE
are enabled, it relates to the user who contains settings for specific connec- This is another large root key. It is
is currently logged on. The key con- tions. the home of all the computer-specific
tains seven first-level sub-keys. The last of the first-level sub-keys in information, including details of the
The first of the first-level sub-keys HKEY_CURRENT_USER is easily the hardware configuration and any ma-
is named AppEvents, and contains de- largest. It is named Software, and it is chine-specific settings for the installed
tails of the sounds which the user has one of the two parts of the registry applications. Whereas each user who
associated with system or application specifically intended for use by appli- logs onto the PC sees different settings
events. It is organised into two subsidi- cations (the other is also named Soft- in HKEY_CURRENT_USER, they all
ary keys: EventLabels contains the ware, and is in HKEY_LOCAL- see the same information in
names of the events, and Schemes con- _MACHINE). HKEY_LOCAL_MACHINE. It con-
tains references to the corresponding Immediately below HKEY_CUR- tains seven first-level sub-keys.
sound files. Schemes is itself organised RENT_USER\Software, there is a key The first of the first-level sub-keys,
by application, and for each event for each vendor which has applica- named Config, contains all the hard-
within the application there is a cur- tions installed on the computer. This in ware profiles which have been set up
rent and a default setting. turn contains a key for each of the ven- for the machine (do not confuse these
The second of the first-level sub- dor’s installed applications and, in with user profiles, which are in
keys is named Control Panel. This con- some cases, a further sub-key for each HKEY_USERS). Each hardware pro-
tains the settings that used to be made installed version of the application. Be- file has its own key, one level down
from Control Panel in Windows 3.1: yond that, the content of each key is for from HKEY_LOCAL_MACHINE\-
colour schemes, screen savers, wallpa- the vendor to decide. Typically, they Config; these are named 0001, 0002,
per, keyboard repeat rate, mouse contain user preferences, histories and etc. Each profile contains configura-
speed and so on. These settings are the like. tion details for the monitor, printers
spread over a number of subsidiary As an example, my own registry and other devices present in the pro-
keys, each of which roughly corre- includes a key named HKEY_CUR- file, as well as certain Internet-related
sponds to one of the old Control Panel RENT_USER\Software\JASC\Paint- settings.
modules. Shop Pro 5, which in turn contains 43 The second of the first-level sub-
The next first-level sub-key is called sub-keys. As well as my preferences keys is Enum. This holds information
InstalledLocationsMRU. It is used by for PaintShop Pro, these store the posi- about all the devices and peripherals
File: E1209.6
PC Support Advisor Update 127 (May 1999) Page 10
New Reviews from Tech Support Alert