[ Go to February 1997 Table of Contents ]

The Registry Revealed
Here's an overview of the Windows 95 Registry, excerpted from WinMag columnist John Woram's book, The Windows 95 Registry: A Survival Guide for Users.

-- by John Woram

It's quiz time: If you printed a hard copy of your Windows 95 Registry, how many pages would it fill?

A. About 25

B. About 250

C. About 1,000

D. About A+B+C

In most cases, the closest answer is D, but even that's conservative, because the Registry menu's Print option prints only two of the keys. If you insist on also printing the contents of the HKEY_DYN_DATA key, expect an extra 2,000 or so pages.

Which brings me to my next question: How many pages does it take to describe this oversized can of worms? I tried to answer that one last year in a little book called The Windows 95 Registry: A Survival Guide for Users, which came in at 344 pages. But the WINDOWS Magazine editors believe in condensing text. They said, "Very nice-now let's see what you can do in five pages." Naturally, I had to choose my words carefully.

This piece is about 3,000 words long, which works out to about one word per printed Registry page. Nevertheless, I hope it's enough (if not too much) to give you a taste of what awaits when you type REGEDIT in the Start menu's Run box. If you want more, have I got a book for you.

The Registry is divided into six sections, each identified as HKEY_SectionName, which raises the question, what's an HKEY? In Microspeak, it's the programming "handle" to a "key" (hence, HKEY) in which Windows 95 stores configuration information. If you use REGEDIT.EXE (the Registry Editor applet) to view the Registry, these six HKEYs will appear in the left-hand Key pane. If any key is highlighted, its contents appear in the right-hand Contents pane. The whole thing actually looks a lot like Windows 95 Explorer. A folder icon represents each of the keys, and a boxed plus sign to the immediate left of a Registry key indicates it contains one or more subkeys (analogous to subfolders). Each subkey may contain its own subkeys, and so on for several levels.

The Contents Pane

The Contents pane is divided into the following rows and columns:

Value. Forget everything you learned about the English language. In Microspeak, each horizontal row is called a value. Thus, information in the pane's two columns is referred to as the Value Name and the Value Data, even though the word Value doesn't appear in the Contents pane.

Data Type Icon. In each row, the icon to the left of the Name column indicates the format of the information in the Data column, as shown here:

Name. Next to the Data Type icon is a descriptive name for the data that follows. The icon and Name are treated as a single entity under the Name column.

Data. To the right is the data associated with Value Name, its format indicated by its Data Type icon. This data may take one of the following formats:

String Data. This describes any data in human-readable format, such as the following:


(value not set)

"" (two quotation marks, no space)


String data is always enclosed in quotation marks, with the exception of the (value not set) data and other parenthetical remarks that indicate an empty data block or null value.

Binary Data. Continuing the Microspeak tradition, data defined as binary doesn't appear in binary format. Instead, it's given in hexadecimal format, as shown here:

Name Data

EditFlags d8 07 00 00

Settings 60 00 00 00 00 01 ... 04 ... ff ff ff ... 00 00

You can recognize such binary data by the distinctive xx space yy space zz space format, where xx, yy and zz are hexadecimal numbers.

DWORD Data. As a final variation, hexadecimal data may be presented in dword (double-word) format, that is, as a 4-byte sequence, as shown here:

Name Data

Height 0x00000240 (576)

Width 0x00000300 (768)

The dword format uses the same icon as binary data. You'll recognize dword format by the 0x, followed by an unspaced 4-byte hexadecimal sequence, followed by a space and then its decimal equivalent in parentheses.

In case of format anxiety, double-click on any Contents pane icon. The Edit window's title bar will show one of the following legends, thus revealing the format of the data in that row:

Edit Binary Value

Edit DWORD Value

Edit String

If you edit the data, be sure to use the same format.

An HKEY Overview

For the purposes of this overview, I'll refer to two Registry HKEYs-HKEY_USERS (HKU) and HKEY_LOCAL_MACHINE (HKLM)-as master HKEYs. These two HKEYs contain global data pertaining to various possible hardware and user configurations. Unlike the other four, each of these two derives its contents from its own hidden Registry file.

Although these master HKEYs may contain data for several hardware configurations and for one or two users, you can enable only one of each of these configurations at a time. So, the master HKEYs write the appropriate data into three other HKEYs-HKEY_CLASSES_ROOT (HKCR), HKEY_CURRENT_USER (HKCU) and HKEY_CURRENT_CONFIG (HKCC)-every time Win95 opens. These three derived subkeys pertain only to the active hardware and current user configurations.

Win95 decides which hardware data to write into a derived key as it detects the current hardware configuration. It determines the configuration for the current user as the user enters a name and password. If the system isn't set up to require a user name, or if the user presses the Escape key in response to the opening name-and-password prompt, then Win95 selects data for a ".Default" user. It ignores data for unneeded hardware configurations and for an alternate user.

The contents of the sixth and final HKEY-HKEY_DYN_ DATA (HKDD)-are dynamically derived from system RAM each time you turn on your system, and they're not copied from, or written to, any other key.

Here's a brief summary of HKCR, one of the HKEYs. The entire structure of this key is nothing more than a duplicate version of all subkeys found under the HKLM/SOFTWARE/Classes key. Created every time Windows opens, its primary purpose is to provide backward compatibility with the Win3.x registration database. But more importantly, it provides convenient access to the Classes set of subkeys, which in their actual physical location are several levels below the HKLM key. In the present section, however, they're all immediately below the HKCR key, which makes it just that much easier to find, and possibly edit, them. A few typical examples of HKCR subkeys are as follows:

The Filename-extension Subkey. These subkeys are identified by a leading period, usually followed by the three characters of a conventional filename extension, such as .386, .bmp, .doc, .txt and so on. At its simplest, the Contents pane for each such key contains a single (Default) line, where the Data entry specifies the Class-definition subkey for any file with the cited extension. This convention indicates you can find additional information about this file type under a Class-definition subkey (such as Paint.Picture for .bmp). In some instances, the (Default) entry shows (value not set) in the Data column, which indicates there is no associated Class-definition subkey. In that case, the Extension subkey itself may lead directly to a Shell/Open/Command subkey set, and the latter subkey specifies the application that launches any file with the extension specified by the Extension subkey.

Class Identification (CLSID). A subkey with a CLSID number identifies a Win95 object for OLE automation purposes, and there's a subkey here for every such device registered on the system. Every CLSID label takes the following form:{aabbccdd-eeff-gghh-iijj-kkllmmnnoopp}

Each double-letter pair is a 1-byte hexadecimal number, and there are always 16 such numbers (bytes) in a 4-2-2-2-6 sequence enclosed by braces. Open almost any CLSID subkey and the Contents pane's (Default) entry identifies the object associated with that CLSID number, as shown here:

CLSID subkey name Data column

{21EC2020-3AEA-1069-A2DD-08002B30309D} "Control Panel"

{73FDDC80-AEA9-101A-98A7-00AA00374959} "WordPad Document"

Shell Key Structures

Many Filename-extension and other subkeys lead to one of several subkeys that specify various shell functions. What's a shell? As anyone who has shucked an oyster knows, a shell is that hard calcium-like structure that tries to protect its owner (in this case, the oyster) from the outside world (usually, a hungry diner). In computer jargon, the word describes any program that protects-or tries to protect-the operating system from the user, and vice versa. The general idea is the user communicates with the shell and the shell with the operating system. Acting as an interface between the two, the shell translates the needs of one into the requirements of the other. By so doing, the user can communicate with the operating system in something that approaches human, rather than machine, language.

In DOS, the shell was the COMMAND.COM program, which accepted a command and translated it into something the machine could understand. The Windows GUI is an improved shell (according to current wisdom) that further shields the user from the operating system's complexities. The basic Windows shell sometimes needs unique enhancements to accommodate a specific task, and these are handled by various shell subkey structures within the Registry. In each case, the information contained under one of these subkeys pertains only to the item directly above it. Here are examples of some of these keys:

The Shell Key. Each Action subkey under the Shell key contains instructions that pertain only to the item directly above it. The key usually leads to a Command subkey, which specifies the executable file that will perform the specified operation on the file whose context menu is open. A few examples are given here.

Edit. This subkey is under the Shell key in the Batfile, Regfile and Txtfile tree structures. In each case, its Command subkey specifies that the selected BAT, REG or TXT file will be loaded into the Notepad applet for editing.

Explore. You'll find this subkey under the CLSID/Shell key for the Folder, Inbox and Microsoft Network subkeys. In each case it opens the selected object in the two-paned Explorer view, in which the left pane shows the Desktop and the right pane is the Contents pane for the selected folder. The Open subkey on the same context menu displays the Contents pane only.

Find. This subkey is located under the CLSID keys for My Computer and Network Neighborhood, and is also under the Directory and Drive keys. (Note: If you can't find My Computer or Network Neighborhood in the Registry, try the following: On the Desktop, rename these icons by removing the space between the words, then reinsert the space. This action forces the Registry to write the object names into the appropriate Data columns, which you can now search to find the associated CLSID key for each object.) In each of these instances, a Command subkey launches EXPLORER.EXE. A Ddeexec (dynamic data exchange/execute) subkey specifies a subroutine embedded within EXPLORER.EXE that is to be executed (in this case FindFolder)

Install. This special-purpose subkey appears under the Inffile (INF file)/Shell and Scrfile (screen saver)/shell keys. If you open a context menu for either file type, the Install option will run the executable file that installs the selected file. In either case, a Command subkey specifies the appropriate command line, and a %1" parameter at the end of that line indicates the specific file selected is the one to be installed.

Open. As its name suggests, this key leads to a Command subkey that specifies the executable program that will open the selected file.

Openas. This special-purpose key appears under the Unknown key's Shell subkey. This key structure is used when Win95 isn't sure which executable program should open or print the selected file, in which case the context menu lists an Open With option. If you select this option, the Openas key Command subkey displays an Open With dialog box, in which you specify the program to open the file.

Play. The AudioCD, AVIFile and cdafile keys contain this shell subkey. In each case, a Command subkey specifies the executable program (cdplayer.exe or mplayer.exe) that loads and plays the selected file.

Print. Common to most document subkeys, the print option opens the appropriate executable program, loads and prints the selected file, then closes the executable program.

The Shellex Key. The Shellex (shell extension) key usually contains one or more Handler subkeys. These keys provide some additional feature or features not otherwise available-hence the shell extension terminology. As with the Action subkeys under the Shell key, the presence of a Handler subkey under a specific Shellex subkey ensures the features don't appear inappropriately.

ContextMenuHandlers. In addition to options placed on a context menu by the Shell key's Action subkeys, other options may be placed there via a ContextMenuHandlers subkey under a Shellex key, as shown here:

Object context menu options

Microsoft Network Connection Settings, Delete

My Computer Map Network Drive,

Disconnect Network Drive

Network Neighborhood Map Network Drive,

Disconnect Network Drive

Recycle Bin Empty Recycle Bin

Drive (removable) Copy Disk

In each case, a ContextMenuHandlers subkey specifies these unique context menu options. This key may also contain its own subkeys, such as the IconHandler subkey found under the Lnkfile, Piffile and a few other keys, where it does what you'd expect. For example, use Explorer to search the C:\WINDOWS folder and its subdirectories for *.LNK or *.PIF files. Open the context menu for any such file and select

Properties, and IconHandler should place its icon near the top of the General tab. If the IconHandler subkey were missing, a generic document shortcut icon would appear there instead.PropertySheetHandlers. The subkey beneath any key with this name serves as a pointer to a CLSID key. The PropertySheetHandlers key sometimes supports a single property sheet, as in the case of the AVIFile key. Here, the Contents pane for the PropertySheetHandlers key shows "AviPage" in its Data column. A subkey with that name appears below it, and AviPage's Contents pane points to the CLSID key associated with the AVI file. In the Contents pane of that key's InProcServer32 subkey, you'll find the following information:

(Default) "C:/WINDOWS/SYSTEM/mmsys.cpl"

This indicates the MMSYS.CPL file contains the Property sheet information required by AVI files. If that file is missing, the Details and Preview tabs on an AVI file's Properties sheet will also be missing.

The ShellNew Key. If you select the Desktop context menu's New option, a cascading menu displays a list of new options. You'll find a ShellNew key under the file extension subkey associated with each option's document type. For instance, the Contents pane for the HKCR/.bmp subkey points to a Paint.Picture subkey. The Contents pane for that key lists the text that appears on the cascading New menu (Bitmap Image), and the Shell/open/command subkey specifies the executable file that will launch to create the appropriate new document on the Desktop.

The ShellNew key's role varies depending on the information in its Contents pane. To illustrate this, open the ShellNew subkey under any file extension key, note the word that appears on the second line in the Contents pane, then find that word in the list that follows. In each of the following examples, the Data column's contents determine the action taken:

Command. The Data column specifies a command line that executes if you select the related option on the New menu. The command line specifies the path, filename and command line para- meters needed to create the specified new item.

Data. If a binary data string appears in the Data column, that string is written into a new file of the appropriate format. For instance, a multimedia application may write a Data entry into the Contents pane in the .mid (MIDI file) key's ShellNew subkey, such as the 18-byte header that appears at the beginning of any MIDI file. If this sequence appears in the Data column, the application that wrote the Data entry supports MIDI recording. Therefore, the New MIDI Sequence.mid file in the C:\WINDOWS\DESKTOP folder should be 18 bytes long. If the .mid subkey doesn't contain a ShellNew key, no MIDI sequence option will appear on the Desktop context menu's cascading New menu.

FileName. When FileName shows in the Name column, the Data column specifies a new document file that will be placed on the Desktop, not unlike the binary header just described. However, the binary header is written as a new file; a new document file is actually a copy of a blank document file currently located in the C:\WINDOWS\SHELLNEW folder. This blank file may be quite a bit larger than the 18-byte MIDI header described above because it contains all the basic data required for any new file created under the same format.

If you subsequently double-click on the new document file's icon, the executable that loads the file is the one specified under the FileType subkey associated with the file extension key. To locate it, open any file extension key and note the FileType listed in its Contents pane. Then locate the subkey with that name, and open its Shell/Open/Command subkey. The path and filename for the executable file are located in the (Default) row's Data column.

NullFile. The Data column shows an empty pair of quotation marks, and in this case, a null file (of 0-byte length) is created on the Desktop. A Nullfile entry is found under the .bmp and other subkeys because the format of the file you want to create is unknown, so Win95 can't write the correct header into the new file. Presumably, you'll open the Nullfile, add something to it and save it in whatever format you prefer. Win95 then writes the correct header into the file.

This is just a small peek into a small corner of one of six HKEYs in the Win95 Registry. Most of it is swiped from chapter 1 of my Registry book. Nevertheless, I hope it's enough to provide a general understanding of how the Registry works.

In addition to The Windows 95 Registry: A Survival Guide for Users (MIS:Press, 1996), Senior Contributing Editor John Woram is also the author of Windows Configuration Handbook (Random House, 1993).

Sidebar -- Safety First

Before you edit any Registry key, highlight it and select Registry/Export Registry File to export the key in its current state. Then make your changes. If your changes don't work, delete the edited key and import the saved version of the key to restore the Registry to its previous state.

Sidebar -- Practice Makes Perfect

For a practice edit session, highlight the HKEY_CLASSES_ROOT key, then select Edit/ New/Key. A "NewKey #1" key should appear at the bottom of the subkey list.

Sidebar -- Registry Editing as Easy as 1-2-3

Here's how to change the delay time for cascading menus. Use the same general procedure for similar Registry edits.

Open HKEY_CURRENT_USER/Control Panel and highlight the Desktop subkey. The Contents pane shows the current Desktop settings, which don't yet include a MenuShowDelay line.

Open the Edit menu and select New/String Value. A New Value #1 box should appear at the bottom of the Contents pane. Overtype this with MenuShowDelay and press Enter.

Select View/Refresh to sort the items in the Contents pane. Double-click on MenuShowDelay to open the Edit String dialog box. Type 1000 (or some other millisecond value, as desired) in the Value data box. When you click on the OK button, the dialog box closes and the new value appears in the Data column.

Windows Magazine, February 1997, page 217.

[ Go to February 1997 Table of Contents ]