看板 ott
作者 標題 Understanding the Windows 9x Registry: Part I
時間 2010年01月16日 Sat. PM 11:53:30
Topic links:
what is the registry?
what form does it take?
the physical structure
what's in the root keys?
registry aliases
Leaf through almost any edition of PC User (or most other computer
magazines or Windows help sites) and you're bound to come across a
bunch of techniques and tips which involve editing the Registry.
Each of those tips carries a rider about the inherent dangers of
the process.
If you've been intimidated by the warnings and shied away, or if
you've ignored the perils and tinkered with the Registry without
really knowing much about it, now is a good time to become more
familiar with this core component of Windows.
What is the Registry?
The Registry is the central repository for configuration data –
user settings and machine-dependent settings – in Windows. It
keeps track of installed programs; program interactions; hardware
configuration; individual user preferences; and system
customisations. Most of the information in the Registry is placed
there automatically by Windows itself, and by utilities and
applications via their setup routines and optional settings. It's
also possible to edit Registry data directly.
The Registry, introduced with Windows 95, replaced the old INI
files used to store configuration settings. INIs were handy
because they were short text files, easily edited with Notepad.
But they had many limitations including size restrictions, lack of
internal organisation and lack of support for multiple users and
alternative hardware configurations. The Registry does away with
all these limitations and makes it easier to track changes and
recover settings after a crash.
What form does it take?
The Registry is organised as a hierarchical database. That simply
means the information is stored in a tree-like structure, somewhat
similar to the hierarchy you're familiar with through using
Windows Explorer:
FOLDER -> SUB-FOLDER -> FILE
In the Registry, the hierarchy goes:
KEY -> SUBKEY -> VALUE
with each key having one or more subkeys and each subkey
containing a value.
Each value is stored with a value name and value data. The data
also has a data type which identifies the kind of information –
string, binary and so on – stored in the value.
There are six main keys, also known as the root keys. They are:
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_CURRENT_CONFIG
HKEY_DYN_DATA
We'll look at each of these root keys shortly.
![[圖]](http://www.geekgirls.com/images/win9xregistry.jpg)
The Registry displayed in the Registry Editor, with all root keys
except HKEY_CLASSES_ROOT expanded to show the major subkeys. Click
the image to see a full-size screenshot.
The physical structure
So much for the logical organisation of the Registry. Physically,
the Registry is stored on your hard drive in two or more files:
System.dat contains the hardware- and computer-specific Registry
data
User.dat contains user-specific information.
In Windows Me, there's a third file called Classes.dat, which
stores the HKEY_CLASSES_ROOT data. In network environments,
there's often another registry file, Policy.pol, which contains
network or company-wide settings established by the system
administrator.
What's in the root keys?
Everything in the Registry branches out from the six root keys,
whose names all begin with HKEY (it stands for handle to a key,
which is programmer's terminology).
HKEY_CLASSES_ROOT contains information pertaining to OLE (object
linking and embedding), file association mappings, Windows
shortcuts and some other aspects of the user interface.
In HKEY_CLASSES_ROOT you'll find the names of all registered file
types (such as .doc, .exe, .html and so on) and their associated
properties. This key is, in fact, a pointer to another subkey,
HKEY_LOCAL_MACHINE\Software\Classes.
HKEY_CURRENT_USER contains user-specific information. The contents
of this key are derived from information in the HKEY_USERS key at
logon time.
HKEY_LOCAL_MACHINE contains computer-specific information,
including info about installed hardware and software settings. The
information in this key is used by all users of the computer.
HKEY_USERS contains user information such as default application
settings, desktop configuration and so on. Some of the information
is user-specific and some is available to all users of the
computer. The default, generic settings are stored in a subkey
HKEY_USERS\.DEFAULT. A new subkey is created for each user who
logs onto the computer. At first, that new subkey contains a copy
of the contents of the .DEFAULT subkey. As the user changes
desktop and application settings, those changes are stored in the
user's subkey.
HKEY_CURRENT_CONFIG handles Plug & Play settings and information
about multiple hardware configurations. Settings in this key are
derived from a subkey of HKEY_LOCAL_MACHINE\Config.
HKEY_DYN_DATA maintains a dynamic record of the current status of
the computer.
Registry aliases
Although we talk about the six root keys in the Registry, there
are really only two keys – HKEY_LOCAL_MACHINE and HKEY_USERS.
Three of the four 'non-real' keys are aliases, the Registry
equivalent of Windows shortcuts, deriving their contents from
subkeys of LOCAL_MACHINE and USERS. Anything you change in one key
is reflected in its alias. The fourth 'non-real' key,
HKEY_DYN_DATA, is created on-the-fly from device status
information each time the computer boots.
Alias
Branch from which alias is derived
HKEY_CLASSES_ROOT
HKEY_LOCAL_MACHINE\Software\Classes
HKEY_CURRENT_USER
HKEY_USERS\username
HKEY_CURRENT_CONFIG
HKEY_LOCAL_MACHINE\Config\profile
Coming up
In the second part of this series (which I'll publish in the next
few weeks) we'll delve more deeply into the Registry courtesy of
Regedit, the Registry Editor.
c 2002 Rose Vines
--
※ 來源: DISP BBS (http://disp.twbbs.org)
※ 作者: ott 來自: 118.166.9.59 時間: 2010-01-16 23:53:30
※ 看板: ott 文章推薦值: 0 目前人氣: 0 累積人氣: 79
回列表(←)
分享