COM IDs & Registry keys in a nutshell






4.87/5 (36 votes)
Jul 25, 2001
11 min read

234694
An article about COM IDs and the Registry
Some COM definitions 
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
or
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
or
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 
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:
{60B4140E-B0A7-4540-B744-7E1A944E8C78}
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.

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 
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.
- HKCU: the HKEY_CURRENT_USER 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.
HKEY_CLASSES_ROOT\CLSID\{GUID}
or
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{GUID} or (Windows 2000 only)
HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{GUID} 
A CLSID is a globally unique identifier that identifies a COM class object. AppID node | |
|
|
![]() |
|
|
|
![]() |
|
|
|
![]() |
The CLSID_value is a 128-bit Globally Unique Identifier (GUID) that identifies the CLSID key |
![]() |
String value The human-readable name. |
![]() |
String value It is a 128-bit Globally Unique Identifier (GUID) that identifies the AppID key. |
![]() |
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. |
![]() |
Assigns the TreatAs value |
![]() |
String value The CLSID that will automatically be assigned to the TreatAs entry. |
![]() |
Identifies object as a control |
![]() |
ShortDisplayName |
![]() |
String value Specifies an application's short display name, used in menus, including pop-ups (e.g. "Chart"). |
![]() |
ApplicationName |
![]() |
String value Specifies an application name, used in the Results field of the Paste Special dialog box (e.g. "Super Graph 2001 Chart"). |
![]() |
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 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). |
![]() |
Formats supported by applications |
![]() |
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"). |
![]() |
Registers a 16-bit handler DLL |
![]() |
String value Specifies the custom handler used by the application. |
![]() |
Registers a 32-bit handler DLL |
![]() |
String value Specifies the custom handler used by the application. |
![]() |
Registers a 16-bit in-process server DLL |
![]() |
String value Specifies the path to the in-process server DLL. |
![]() |
Registers a 32-bit in-process server DLL |
![]() |
String value Specifies the path to the 32-bit in-process server. |
![]() |
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). |
![]() |
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. |
![]() |
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. |
![]() |
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. |
![]() |
Specifies how to create and display an object |
![]() |
Programmatic identifier for a class |
![]() |
String value Associates a ProgID with a CLSID. Generally, the ProgID structure is like: <vendor>.<component>.<version> and must:
|
![]() |
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"). |
![]() |
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. |
![]() |
Verbs associated with an application |
![]() |
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. |
HKEY_CLASSES_ROOT\AppID\{GUID}
or
HKEY_LOCAL_MACHINE\Software\Classes\AppID\{GUID} 
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 | |
|
|
![]() |
|
|
|
![]() |
|
|
|
![]() |
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. |
![]() |
Binary value Sets an ACL that determines access. |
![]() |
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 |
![]() |
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 . |
![]() |
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. |
![]() |
Binary value Sets the ACL that determines who can launch the application. |
![]() |
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. |
![]() |
String value Configures the component to run as a Win32 service. |
![]() |
String value Names of the remote Server. |
![]() |
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. |
![]() |
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 .
HKEY_CLASSES_ROOT\Interface\{GUID}
or
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\{GUID} 
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 | |
|
|
![]() |
|
|
|
![]() |
|
|
|
![]() |
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. |
![]() |
Interface derived from |
![]() |
String value The IID (GUID) of the Interface derived from. |
![]() |
Number of methods |
![]() |
String value The number of methods exposed by the Interface. |
![]() |
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. |
![]() |
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. |