A Closer Look at HKEY_CLASSES_ROOT
HKEY_CLASSES_ROOT is the section of the Registry that
controls all the data files on the system. It is nearly identical
on both Windows NT and Windows 95. For that reason, there is only
one appendix concerning it. The HKEY_CLASSES_ROOT handle
key includes all the file extensions and associations with executable
files, as shown in Figure C.1. It also determines how an application
will react when a document file is double-clicked.
Figure C.1. HKEY_CLASSES_ROOT
controls data files and their extensions.
HKEY_CLASSES_ROOT is really just a portion of HKEY_LOCAL_COMPUTER,
and settings can be edited in either location, as shown in Figure
C.2. As soon as one is changed, the other is also changed. HKEY_CLASSES_ROOT
is used, however, to make it easy for programmers to send information
during an installation. In Windows NT and Windows 95, HKEY_CLASSES_ROOT
is the same as HKEY_LOCAL_MACHINE\Software\Classes. Programmers
need not worry about the actual location when developing their
startup routines. Instead, they can just send data to HKEY_CLASSES_ROOT.
Figure C.2. HKEY_CLASSES_ROOT
and HKEY_LOCAL_MACHINE\Software\Classes are the same.
Table C.1 lists extensions from HKEY_CLASSES_ROOT in the
first column, and their corresponding file types in the second
column. These file types are also entries in HKEY_CLASSES_ROOT
and give more detail about the function of the files, including
their locations and the launching characteristics.
Table C.1. HKEY_CLASSES_ROOT extensions.
Extension
|
File Type
|
.ADM
|
ADM_auto_file
|
.aif
|
aifffile
|
.aifc
|
aifffile
|
.aiff
|
aifffile
|
.ani
|
anifile
|
.art
|
artfile
|
.au
|
aufile
|
.snd
|
aufile
|
.avi
|
AVIFile
|
.bat
|
batfile
|
.bfc
|
Briefcase
|
.cda
|
cdafile
|
.crt
|
certificatefile
|
.der
|
certificatefile
|
.clp
|
clpfile
|
.cmd
|
cmdfile
|
.com
|
comfile
|
.cpl
|
cplfile
|
.cur
|
curfile
|
.dat
|
DAT_auto_file
|
.dcx
|
DCXImage.Document
|
.dll
|
dllfile
|
.shb
|
DocShortcut
|
.drv
|
drvfile
|
.xla
|
EXCEL.Addin
|
.xlk
|
Excel.Backup
|
.xlc
|
Excel.Chart.5
|
.csv
|
Excel.CSV
|
.xld
|
Excel.Dialog
|
.dif
|
Excel.DIF
|
.xlb
|
Excel.Sheet.5
|
.xls
|
Excel.Sheet.5
|
.slk
|
Excel.SLK
|
.xlt
|
Excel.Template
|
.xlv
|
Excel.VBAModule
|
.xlw
|
Excel.Workspace
|
.xll
|
Excel.XLL
|
.xlm
|
ExcelMacrosheet
|
.exe
|
exefile
|
.fnd
|
fndfile
|
.fon
|
fonfile
|
.gif
|
giffile
|
.goc
|
gocserve
|
.hlp
|
helpfile
|
.ht
|
htfile
|
.htm
|
htmlfile
|
.html
|
htmlfile
|
.ico
|
icofile
|
.inf
|
inffile
|
.ini
|
inifile
|
.url
|
InternetShortcut
|
.job
|
JobObject
|
.jfif
|
jpegfile
|
.jpe
|
jpegfile
|
.jpeg
|
jpegfile
|
.jpg
|
jpegfile
|
.lnk
|
lnkfile
|
.mid
|
MIDFile
|
.mmm
|
MPlayer
|
.rmi
|
MPlayer
|
.gra
|
MSGraph.Chart.5
|
.grp
|
MSProgramGroup
|
.obd
|
Office.Binder.95
|
.obt
|
Office.Binder.Template
|
.obz
|
Office.Binder.Wizard
|
.ofn
|
Office.FileNew
|
.bmp
|
Paint.Picture
|
.pbk
|
pbkfile
|
.pcx
|
PCXImage.Document
|
.pma
|
PerfFile
|
.pmc
|
PerfFile
|
.pml
|
PerfFile
|
.pmr
|
PerfFile
|
.pmw
|
PerfFile
|
.pfm
|
pfmfile
|
.pif
|
piffile
|
.mov
|
PlayerFrameClass
|
.pnf
|
pnffile
|
.que
|
QueueObject
|
.ra
|
RealAudio File
|
.ram
|
RealAudio File
|
.reg
|
regfile
|
.rnk
|
rnkfile
|
.scr
|
scrfile
|
.shs
|
ShellScrap
|
.sys
|
sysfile
|
.tif
|
TIFImage.Document
|
.tiff
|
TIFImage.Document
|
.ttf
|
ttffile
|
.DIC
|
txtfile
|
.EXC
|
txtfile
|
.log
|
txtfile
|
.scp
|
txtfile
|
.txt
|
txtfile
|
.pic
|
ViewerFrameClass
|
.vir
|
virfile
|
.vsd
|
Visio.Drawing.4
|
.vss
|
Visio.Drawing.4
|
.vst
|
Visio.Drawing.4
|
.vsw
|
Visio.Drawing.4
|
.386
|
vxdfile
|
.wav
|
WAVFiles
|
.ARC
|
WinZip
|
.ARJ
|
WinZip
|
.gz
|
WinZip
|
.LZH
|
WinZip
|
.tar
|
WinZip
|
.taz
|
WinZip
|
.tgz
|
WinZip
|
.z
|
WinZip
|
.zip
|
WinZip
|
.wll
|
Word.Addin
|
.wbk
|
Word.Backup
|
.rtf
|
Word.RTF
|
.DOT
|
Word.Template
|
.wiz
|
Word.Wizard
|
.doc
|
WordDocument
|
.wri
|
wrifile
|
.xbm
|
xbmfile
|
.xif
|
XIfImage.Document
|
Other extensions listed in HKEY_CLASSES_ROOT can be found
in Table C.2. They have no corresponding entries in the Registry
because they have not yet been associated with an application.
The descriptions listed here do not have specific Registry entries.
Table C.2. Unassociated extensions.
Extension
|
Description
|
.ai
|
postscript file
|
.css
|
text/css file
|
.eps
|
postscript file
|
.fif
|
fractal file
|
.hqx
|
Macintosh binary file
|
.latex
|
x-latex file
|
.man
|
x-troff-man file
|
.movie
|
x-sgi-movie file
|
.mpe
|
video/mpeg file
|
.mpeg
|
video/mpeg file
|
.mpg
|
video/mpeg file
|
.PS
|
postscript file
|
.qt
|
video/quicktime file
|
.rpm
|
real audio plug-in
|
.sit
|
x-stuffit file
|
.wrl
|
x-world/x-vrml file
|
CLSID
Everything in Windows NT is dealt with as a number instead of
as a name. People, however, tend to deal with things by name.
CLSID is where all the numbers are listed for icons, applications,
directories, file types, and more. Each one must be unique, and
is assigned to the manufacturer by Microsoft. The manufacturer
then puts the CLSID into the installation program files
so it can update the Registry upon installation.
The Registry is the database that applications turn to when they
need instructions about what to do. For example, assume you have
a Microsoft Word 7 document with an embedded Excel 7 spreadsheet.
When you double-click the spreadsheet inside Word, the application
menus change to Excel menus and the spreadsheet is ready to edit,
just as if you were in Excel. How does it know to do that? Every
file created by Excel 7 has Excel's CLSID attached. Word
reads the CLSID, goes to the Registry for instructions,
and launches .DLL files or the application, depending on
the data under the CLSID.
If the embedded spreadsheet is from Excel 5 (and a later version
is not on the system), the reaction to the double-click is different.
Each version of each software has a different CLSID.
The CLSID key also includes information about other properties
of the application or function. For example, the CLSID
key for a .BMP (Paintbrush picture) extension lists the
file type, the default applications used for editing, running,
or printing the document, the default icons, and other information
required for correct use of the file. Figure C.3 shows the type
of numbers used for a CLSID. Although the number types
may all look the same in the graphic, they are actually quite
different. Each is a 128-bit unsigned integer, and has a combination
of letters and numbers assigned to each specific item.
Figure C.3. CLSID
numbers in HKEY_CLASSES_ROOT.
Streamlining Your Context-Sensitive Menus with HKEY_CLASSES_ROOT
One way to improve performance using the Explorer interface is
to set the menus to your preference. When you right-click just
about anything in NT or Windows 95, you get a menu of choices
on the screen (as shown in Figure C.4). Because the function is
part of Explorer, you get a drop-down context-sensitive menu when
you click anything that uses the Explorer functions. Included
are the desktop, icons, anything in the Explorer application (see
Figure C.5), My Computer, and the Open and Save functions in 32-bit
applications.
Figure C.4. Context-sensitive
menu at the desktop.
Figure C.5. Context-sensitive
menu in Explorer.
TIP: To learn more about
something you see on the desktop, right-click it and select Properties
from the menu. You can then see the settings and details for the
item, and you may even be able to change the nature of the item
directly from there. Right-clicking the My Computer icon takes
you to the SYSTEM functions of the Control Panel. Right-clicking
the Network Neighborhood icon takes you to the NETWORK
applet in the Control Panel.
Selecting the new option pops up an additional menu of choices,
as shown in Figure C.6. The choices above the line (Folder and
Shortcut) are set by Explorer and cannot be changed. The items
below the line are added when an application is installed. Some
applications are installed with Windows NT, and others are installed
by the user.
Figure C.6. Pop-up menu for creating new items.
To create a text document, right-click, select New, then click
Text Document. If you are at the desktop, a new document is created
on the desktop. If you are in another folder, a new text document
is created in that folder (as shown in Figure C.7).
Figure C.7. A new
text document in the My Documents folder.
Most of the file types are helpful, but what about Briefcase or
Wave Sound? If you do not find a file type to be useful, you can
remove it from your menu, thus streamlining your menus and saving
you time. Wave Sound is on the menu because of a key in HKEY_CLASSES_ROOT.
In HKEY_CLASSES_ROOT, the extension for a wave sound is
listed as .WAV. Notice the plus sign (+) in the folder
icon next to the listing (as shown in Figure C.8).
Figure C.8. The
.WAV extension in HKEY_CLASSES_ROOT.
When the tree is expanded to show the contents of the .WAV
key, the ShellNew subkey is shown. (See Figure C.9.) Delete
the ShellNew key to see the menu shown in Figure C.10 (note
that there is no option for creating a new Wave Sound).
Figure C.9. The ShellNew
key under .WAV in HKEY_CLASSES_ROOT.
Figure C.10. The
modified New menu.
Use this procedure to remove any items in the context-sensitive
New menu, thus streamlining your menus and improving your performance.
Adding to Your Context-Sensitive Menus with HKEY_CLASSES_ROOT
The opposite function, adding to context-sensitive menus, is
also available by editing HKEY_CLASSES_ROOT. For any item
you want to create, find the file extension in the list. Add a
key called ShellNew; in it, add a REG_SZ value called
NullFile. When it asks for the string, do not add anything.
Simply click OK to continue. The context menu pulls the name of
the data file from the Registry and lists it with the others in
the menu. The new file will be blank.
Associating a Data File with an Application
To associate a data file with a particular application, double-click
the data file. If the data file is not already associated with
an application, NT opens the dialog box shown in Figure C.11.
Choose the application to be associated with the extension, select
the Always use this program to open this file check box, and click
OK. Every time a file with the same extension in activated, NT
runs the associated application.
Figure C.11. Associating
a data file with an application.
What if you accidentally select the wrong application? Every time
you double-click the file, it runs the wrong program. What if
you change text editors, and you don't want all your text files
to be edited with NOTEPAD.EXE? You could edit the HKEY_CLASSES_ROOT
handle key in the Registry, or use a feature in Explorer. Hold
the Shift key down and right-click the data file. Select Open
With, and then scroll to the correct application to be associated
with the data file.
Summary
Besides extensions and file types associated with those extensions,
there are many more items in HKEY_CLASSES_ROOT. All of
these items are details for NT, the interface, and applications
to be run. You would normally edit only a very few of these items.
Everything but the context menu tips included here is changed
only by installing applications, by setting modifications inside
applications, or by creating associations.
You couldn't run the system without HKEY_CLASSES_ROOT;
you just hardly ever edit it manually. HKEY_CLASSES_ROOT
is one of the main reasons you need the Registry: for the control
of applications and the operating system. Given the sheer size
and complexity of this handle key, it is no wonder that SYSTEM.INI
and WIN.INI were no longer sufficient.