Installing and Registering COM Servers and Type Libraries
Windows uses various kinds of COM servers and type libraries. Tarma Installer
has built-in support for all of them as far as installation and registration
is concerned (this includes unregistration and safe removal). In particular,
it knows about:
- In-process COM servers, essentially dynamic link libraries (DLLs) with
.dll or .ocx file name extensions and special COM-defined entry points.
(The actual file name extension is immaterial; Tarma Installer analyzes
each installation file to determine its type and further characteristics.)
- Out-of-process COM servers, which are stand-alone executable programs
that adhere to certain COM conventions.
- Type libraries, whether embedded in DLL or EXE files, or as stand-alone
TLB files. (Again, Tarma Installer does not rely upon the file name extension,
but inspects each installation file to see if it contains a type library.)
Here is how Tarma Installer deals with each kind of file.
- In-process COM servers
- In-process COM servers have DllRegisterServer() and DllUnregisterServer()
entry points that perform registration and unregistration upon request.
Tarma Installer's Setup program calls these entry points as appropriate
during installation and uninstallation of the server.
- Out-of-process COM servers
- Out-of-process COM servers adhere to the COM convention of using /RegServer
and /UnregServer command line options to perform their registration and
unregistration actions. When started with one of these options, the server
is supposed to run invisibly and to terminate immediately after completing
the (un-)registration. Tarma Installer's Setup program uses these command
line options as appropriate during installation and uninstallation of
the server. However, there are no hard and fast rules to recognize an
out-of-process COM server, so you must judge for yourself whether or not
registration is required.
- Type libraries
-
Type libraries are sometimes contained in DLL files (often as part
of an in-process COM server), sometimes in EXE files (presumably as
part of an out-of-process COM server), and sometimes in a special
type library file, usually with a .tlb file name extension. Tarma
Installer's treatment of a type library depends on the situation,
as follows:
- If the type library is contained in a DLL file and that DLL file
is an in-process COM server (i.e., has a DllRegisterServer() entry
point), Tarma Installer assumes that the server will register
the type library as part of its overall registration process (as
it should).
- If the type library is contained in a DLL file and that DLL file
is not an in-process COM server, Tarma Installer will register
it with the Windows function RegisterTypeLib().
- If the type library is contained in an EXE file, Tarma Installer
assumes that the file is an out-of-process COM server and will
suggest that it be registered as such. However, there are no hard
and fast rules to recognize an out-of-process COM server, so you
must judge for yourself whether or not registration is required.
- If the type library is contained in a stand-alone TLB file, Tarma
Installer will register it with the Windows function RegisterTypeLib().
Once again, the actual file name extensions are immaterial; Tarma Installer
analyzes each installation file to determine its type and other characteristics.
COM servers and type libraries are typically installed as shared files in the
Windows System folder. Within Tarma Installer, this folder is represented
by the <WinSysDir> variable. Unless you know what you are doing and
have a very good reason to do otherwise, we recommend that you follow this
convention.
How to add a COM server or Type Library to your project
To add a COM server or type library to your Tarma Installer project, act as
follows.
- Select the Project - Files page by clicking on its bullet in the
Navigation area.
-
On the Project - Files page, create the <WinSysDir> installation
folder if it isn't already present in the Installation Folders
Tree. The easiest method is as follows:
- Right-click on Installation Files to open the installation
folders context menu;
- Choose Insert Special Folder to open its submenu;
- Choose System Folder from the submenu.
- Add the COM server's or type library's file as an installation file to
the <WinSysDir> folder. If necessary, refer to Installing
Files for information about adding installation files to folders.
-
Select the newly added server or type library file in the Installation
Files List to display its settings in the Installation File
Settings pane, then check that the following options are set:
If you followed the procedure above, Tarma Installer will have set
these options for you and you don't have to change anything, with
the exception of out-of-process COM servers (EXE files), which cannot
be recognized automatically.
- Repeat steps 3-4 for other COM servers or type libraries.
The net result is that the server or type library will be installed and registered
when your application is installed, and unregistered and removed when your
application is uninstalled. All this is subject to the usual rules for file
installation; in particular, Tarma Installer will correctly handle updates
of existing copies of the file (based on a version check) and will only remove
the file if no other applications use it. This remains true even if the SharedDlls
reference count of the file is unreliable (as is often the case with third-party
servers).