Click here to Skip to main content
13,094,411 members (55,742 online)
Click here to Skip to main content
Add your own
alternative version


112 bookmarked
Posted 24 Jul 2001

COM IDs & Registry keys in a nutshell

, 24 Jul 2001
Rate this:
Please Sign up or sign in to vote.
An article about COM IDs and the Registry

Sub-sections list Sub-sections:

Some COM definitions Return to sub-sections list

COM Interface

When we are talking about Interface, we are as well talking about the separation between interface definition and implementation. Therefore, an interface defines a contract between the implementor and the user that physically prevents the user from accessing any of the details of the implementation.

You can look an Interface as a set of methods. This set of methods provides you services. You do not care about the implementation of these methods so long as you can use the services you need. COM interface refers to a predefined group of related functions that a COM class implements, but does not necessarily represent all the functions that the COM class supports.

One object-oriented programming (OOP) scholar says that we should concentrate upon the outside view of an object, and he calls this contract programming (B. Meyer, Object-Oriented Software Construction, 1988).

COM uses the concept of contract programming.

One of the rules in the COM world is that all COM interfaces must derive, either directly or indirectly, from the IUnknown interface.

COM class
Component Object Class (coclass)

(from the Platform SDK: COM / COM Class Objects and CLSIDs)

"A COM server is implemented as a COM class. A COM class is an implementation of a group of interfaces in code executed whenever you interact with a given object.

There is an important distinction between a C++ class and a COM class. In C++, a class is a type. A COM class is simply a definition of the object, and carries no type, although a C++ programmer might implement it using a C++ class. COM is designed to allow a class to be used by different applications, including applications written without knowledge of that particular class's existence. Therefore, class code for a given type of object exists either in a dynamic linked library (DLL) or in another application (EXE)."

COM object

A COM object is an instance of a COM Class at the runtime.

COM class object
Class Factory

(from the Platform SDK: COM / COM Class Objects and CLSIDs)

"The basic way to create an instance of a class (COM Class) is through a COM class object. This is simply an intermediate object that supports functions common to creating new instances (COM Object) of a given class (COM Class). Most class objects used to create objects from a CLSID support the IClassFactory interface, an interface that includes the important method CreateInstance. You implement an IClassFactory interface for each (COM) class of object that you offer to be instantiated.

Servers that support some other custom class factory interfaces are not required to support IClassFactory specifically. However, calls to activation functions other than CoGetClassObject (such as CoCreateInstanceEx) require that the server support IClassFactory."

The Platform SDK: Automation refers to a class factory as "An object that implements the IClassFactory interface, which allows it to create other objects of a specific class.". I will just add that it could be other class factory interfaces (not only the IClassFactory interface) such as the IClassFactory2 or a custom interface.

COM component

COM component refers to a binary module, such as a DLL or an Executable. After registering, a component will expose one or more COM Class Object (or Object Factory).

Type Library

Type libraries contain the specification (metadata) for one or more COM elements, including classes, interfaces, enumerations, and more. These files are stored in a standard binary format. A type library can be a stand-alone file with the .tlb filename extension, or it can be stored as a resource in an executable file, which can have a .ocx, .dll, or .exe file name extension.

COM IDs Return to sub-sections list

In COM world, you have to identify different pieces such as coclasses, interfaces, type libraries, applications, etc. These pieces must be unique in the world.
COM uses the Globally Unique IDentifier (GUID) to define these different IDs.
In an Interface Definition Language (IDL) file, you have to use the attribute uuid that stands for Universally Unique IDentifier. A UUID and a GUID are equivalent.
So, what is a GUID ? A GUID is a 128-bit number, usually represented in hexadecimal, which is guaranteed "to be unique across space and time". For example, the following number is a GUID:
COM borrows this identify system to the Distributed Computing Environment (DCE) naming scheme. The DCE RPC system uses UUIDs.

The main COM IDs are:
  • LIBID: the Type Library ID, based on GUID.
  • APPID: the Application ID, based on GUID.
  • CLSID: the COM Class ID, based on GUID.
  • IID: the Interface ID, based on GUID.
  • PROGID: the Program ID, based on a text string.
In short, we can have:

Nota: this scheme is not complete, e.g. the Class factory is missing.

To obtain a GUID/UUID you can use:
  • the UUIDGEN.EXE found in the \TOOLs directory of the COM Toolkit (or "\Microsoft Visual Studio\Common\Tools").
  • the GUIDGEN.EXE found in the "\Microsoft Visual Studio\Common\Tools" directory.
  • the COM API function CoCreateGuid().

The Registry Return to sub-sections list

Before starting, here are some acronyms used in the Windows registry documentation and their meaning:
  • HKLM: the HKEY_LOCAL_MACHINE key. Information registered under this key might apply to all users on the local computer.
  • HKCR: the HKEY_CLASSES_ROOT key, a short cut for HKEY_LOCAL_MACHINE\Software\Classes.
Class registration and file extension informations are stored under the HKEY_LOCAL_MACHINE\Software\Classes key.
COM retrieves the information about COM Classes from the local Registry. With Windows 2000 there is now a global implementation repository called Active Directory. COM uses the registry as well to look for Interface properties and security-related configuration in order to manage the marshalling and distributed access.

All COM Classes related configuration information on the local workstation is stored in the following registry keys:
  • HKEY_CLASSES_ROOT, for backward compatibility.
  • HKEY_LOCAL_MACHINE\Software\Classes, Available on Windows NT 4.0 .
  • HKEY_CURRENT_USER\Software\Classes, Available on Windows 2000.
On Windows 2000 you can register COM class not only as the local machine level but also at the user level, and so you should be very careful as the HKCR is a merged view of HKLM\Software\Classes key and HKCU\Software\Classes key. This is due to the fact that in Windows 2000 class registration and file extension information are stored under both the HKLM key and the HKCU key.

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{GUID} or (Windows 2000 only)
Return to sub-sections list

A CLSID is a globally unique identifier that identifies a COM class object.

AppID node

 {<CLSID_value>} The CLSID_value is a 128-bit Globally Unique Identifier (GUID) that identifies the CLSID key
 @    String value
The human-readable name.
 AppID    String value
It is a 128-bit Globally Unique Identifier (GUID) that identifies the AppID key.
 AutoConvertTo  Automatic object class conversion
 @    String value
The class identifier (CLSID) of the object to which a given object or class of objects should be converted.
 AutoTreatAs  Assigns the TreatAs value
 @    String value
The CLSID that will automatically be assigned to the TreatAs entry.
 AuxUserType  Identifies object as a control
 2  ShortDisplayName
 @    String value
Specifies an application's short display name, used in menus, including pop-ups (e.g. "Chart").
 3  ApplicationName
 @    String value
Specifies an application name, used in the Results field of the Paste Special dialog box (e.g. "Super Graph 2001 Chart").
 Control  Identifies an object as an ActiveX Control
 @    String value
This optional entry is used by containers to fill in dialog boxes. The container uses this subkey to determine whether to include an object in a dialog box that displays ActiveX Controls.
 Conversion  Conversion used by the Convert dialog
 @  </>  String value
The file format an application can read (convert from).
 @  </>  String value
The file format an application can read and write (activate as).
 DataFormats  Formats supported by applications
 DefaultIcon  Provides default icon information
 @    String value
Specifies the full path to the executable name of the object application and the resource index of the icon within the executable (e.g. "c:\toto\titi.exe,0").
 InprocHandler  Registers a 16-bit handler DLL
 @    String value
Specifies the custom handler used by the application.
 InprocHandler32  Registers a 32-bit handler DLL
 @    String value
Specifies the custom handler used by the application.
 InprocServer  Registers a 16-bit in-process server DLL
 @    String value
Specifies the path to the in-process server DLL.
 InprocServer32  Registers a 32-bit in-process server DLL
 @    String value
Specifies the path to the 32-bit in-process server.
 ThreadingModel    String value
Specifies the threading model of the apartment the server can run in.
In-process servers are loaded into an existing apartment and so do not call CoInitialize or CoInitializeEx; they must use the registry to specify an application's threading model.
Allowable values are:
ThreadingModel=Apartment. Single-threaded apartment.
ThreadingModel=Both. Single-threaded or multithreaded apartment.
ThreadingModel=Free. Multithreaded apartment.
ThreadingModel=Neutral. Neutral apartment (available in Windows 2000).
 Insertable  Indicates whether the object is insertable in COM applications.
Objects of this class should appear in the Insert Object dialog box's list box when used by COM container applications.
 @    String value
Specifies the path to the 32-bit in-process server.
 LocalServer  Full path to a 16-bit local server application
 @    String value
Specifies the full path to the local server, and can include command-line arguments.
 LocalServer32  Full path to a 32-bit local server application
 @    String value
Specifies the full path to the local server, and can include command-line arguments.
 MiscStatus  Specifies how to create and display an object
 ProgID  Programmatic identifier for a class
 @    String value
Associates a ProgID with a CLSID. Generally, the ProgID structure is like: <vendor>.<component>.<version>
and must:
  • Have no more than 39 characters.
  • Contain no punctuation (including underscores) except one or more periods.
  • Not start with a digit.
 ToolBoxBitmap32  Identifies the module name and resourdeID for a 16 x 16 bitmap to use for the face of a toolbar or toolbox button
 @    String value
Specifies the module name and the resourceID for the bitmap (e.g. "c:\toto\titi.dll,5").
 TreatAs  Specifies the CLSID of a class that can emulate the current class
 @    String value
CLSID of the Class that is to perform the emulation.
Emulation is the ability of one application to open and edit an object of a different class, while retaining the original format of the object.
 Verb  Verbs associated with an application
 Version  Version number of the control
 @    String value
The version number of the control.
The version number should match the version of the type library associated with the control.

Return to sub-sections list

The AppID registry key groups the configuration and security options for all coclasses exposed by a COM Sever and it is localised in the registry like that:

AppID node

 {<AppID_value>} The AppID_value is a 128-bit Globally Unique Identifier (GUID) that identifies the AppID key
 @   String value
Generally the human-readable name of the component.
 AccessPermission   Binary value
Sets an ACL that determines access.
 ActivateAtStorage   String value
Configures the client to activate on the same system as persistent storage. Any value beginning with Y or y means that ActivageAtStorage should be used
 AuthenticationLevel    DWORD value
Sets the default authentication.Values are from 1 through 6, and correspond to the RPC_C_AUTHN_LEVEL_xxx constants.
Be aware that the AuthenticationLevel named value is supported only on Windows NT 4.0 SP4 and Windows 2000 as well as dcom95 1.1 .
 DllSurrogate   String value
Names the surrogate process used to load DLLs remotely or locally. To use the system-supplied generic surrogate process, set surrogate_path to an empty string or NULL.
 LaunchPermission   Binary value
Sets the ACL that determines who can launch the application.
 LocalService   String value
Configures the component to run as a Win32 service.
The LocalService named-value is used in preference to the LocalServer32 key for local and remote activation requests – if LocalService exists and refers to a valid service, the LocalServer32 key is ignored.
 LocalService32   String value
Configures the component to run as a Win32 service.
 RemoteServerName   String value
Names of the remote Server.
 RunAs   String value
Sets an application to run only as given user. It must either of the form username, domain\username, or the string "Interactive User". To establish a password for a RunAs class, you must use the DCOMCNFG administrative tool installed in the system directory.
 ServiceParameters   String value
Sets parameters to be passed to LocalService on invocation.

The keys referring to ACL values (AccessPermission and LaunchPermission) have to be set using an appropriate tool such as DCOMCNFG.EXE .

Return to sub-sections list

The Interface registry key registers new interfaces by associating an interface name with an Interface ID or IID and it is localised in the registry like that:

AppID node

 {<IID_value>} The IID_value is a 128-bit Globally Unique Identifier (GUID) that identifies the Interface
 @   String value
Generally the human-readable name of the Interface.
 BaseInterface  Interface derived from
 @   String value
The IID (GUID) of the Interface derived from.
 NumMethods  Number of methods
 @   String value
The number of methods exposed by the Interface.
 ProsyStubCLSID  Maps IID to CLSID (16-bit DLLs)
 @   String value
Specifies the CLSID (GUID) to map the IID to.

If you add interfaces, you must use this entry to register them (16-bit systems) so that OLE can find the appropriate remoting code to establish interprocess communication.
 ProsyStubCLSID32  Maps IID to CLSID (32-bit DLLs)
 @   String value
Specifies the CLSID (GUID) to map the IID to.

This is a required entry since the IID-to-CLSID mapping may be different for 16- and 32-bit interfaces. The IID-to-CLSID mapping depends on the way the interface proxies are packaged into a set of proxy DLLs.

If you add interfaces, you must use this entry to register them (32-bit systems) so that OLE can find the appropriate remoting code to establish interprocess communication.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

GeneralHKEY_CLASSES_ROOT "merged view" - thanks Pin
pg--az18-Feb-07 11:54
memberpg--az18-Feb-07 11:54 
Your diagram of the registry concepts is excellent, and I did not know that HKEY_CLASSES_ROOT was a merged-view.
Thanks !


GeneralRe: HKEY_CLASSES_ROOT &quot;merged view&quot; - thanks Pin
Polity4h19-Feb-07 7:14
memberPolity4h19-Feb-07 7:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 25 Jul 2001
Article Copyright 2001 by Joao C. Morais
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid