DLL/OCX Registration
Previous Top Next


Click here for more details about the Virtual Registry

Click here for information on how to determine which DLLs are required by your program

When you add a DLL or OCX file to your project which supports COM or ActiveX,
(i.e. exports the function DllRegisterServer) Thinstall presents the following right-click menu:


clip0116


By recording a registry script, Thinstall permits "virtual registration". That is, the OCX/DLL appears to already be registered on the user's computer without needing any system registry changes.

Differences between Virtual Registration and System Registration



Virtual Registry
(Recorded script)
System Extract +
System Register
Requires Installer to be used?
No
Yes
Changes System Registry?
No
Yes
Registry Keys are left in system registry on uninstall?
No
Yes
Install mail fail if registry access restricted?
No
Yes
Extracts file to system directory?
No
Yes
May cause other applications to fail?
(if they try to use the registered component)
No
Maybe
Other applications can use component)
No
Yes
Other applications can cause your application to fail? (if incompatible components/versions installed)
No
Yes
DLL file is left behind on uninstall?
No
Yes
DLL Contents protected against reverse engineering & modifications?
Yes
No





No Extract / No Registration

This option can be used if :

1. You intend to register the DLL yourself
2. You have already recorded a registry script and added it to the project. Once a registry script has been recorded for the DLL and added to your project, your program can use the component without any registration.

Record Registry Script Now (best practice)

This option will record a registry script for the selected DLL. If you have multiple DLLs selected, Thinstall will record a registry script for each of the DLLs. After the registry script has been recorded, it will automatically be added to your project . Click here for more details about recording registry scripts.

For most developers, this is the best option to use
. Once you've recorded a .threg (registry script file), you can add it to your project and never worry about the process again. You only need to rerecord the registry script if:

A. The DLL/OCX has changed - for example you have a new version.
B. You've modified the Virtual Path for the DLL/OCX. For example, if you record a registry script point for a DLL having the virtual path of "%InstallPath%\mydll.dll", and later change the virtual path to "%InstallPath%\some_subdirectory\mydll.dll", then you need to rerecord the registry script to reflect this change.

You do not need to rerecord the registry script if:
A. You are building on a new machine or different operating system
B. The local path of the DLL/OCX has changed. For example, if you move your project file and OCX/DLL files to another directory or drive, you do not need to rerecord the registry script.

Registry scripts virtualize registry keys needed to allow COM and ActiveX components to work without installation, system registry changes, or the replacement of DLLs in the system directory. Registry scripts also prevent future application failures that can result from incorrect installation of components by the user.

· The DLL/OCX file does not need to be extracted to disk so it is more secure against reverse engineering and tampering.
· System DLL files do not require updates, meaning your application will never cause other applications to fail.
· A system reboot is never required even if older versions of the component are in use by other applications.
· Smaller install foot-print because DLL remains compressed in the EXE


Record Registry Script during build
This option records a registry script for the DLL/OCX every time you build your project. This option should be used when the DLL in question is in the process of development, and its registry script file may change from one release to the next. This will slow down the build process and automatically overwrite any changes you may have made to the registry script file.

Virtual Pre-register - The DLL/OCX registry changes are recorded on your (the developer) computer to form a virtual registry at build-time.

At build time, Thinstall will :

1. Invoke the DLL's DllUnregisterServer method to clear it from the system registry.
2. Invoke the DLL's DllRegisterServer so the DLL will add entries back to the system registry. During this process, Thinstall records any registry keys created. These keys form the virtual registry which will be available to the application when it runs.
3. The registry keys are recorded such that absolute file paths pointing to the DLL in question are modified to point to the virtual location of the DLL. For example, c:\windows\system32\mydll.dll is modified to become %InstallPath%\mydll.dll (assuming the DLL's virtual path is %InstallPath%)
4. The virtual registry keys are automatically included in the resulting built EXE.

During program execution, Thinstall will:

1. Load the Virtual Registry keys from its archive. Virtual registry keys are superimposed over the real system registry without modifying.
2. Virtual Registry Keys containing Thinstall macros are expanded at load-time (for example %Installpath% becomes the directory where the EXE is running).
3. Thinstall intercepts all of the application's registry, COM, and ActiveX activity so that it will access the virtual registry first. If a virtual registry key is not found, then the system registry is consulted.


System Extract / System Register

Before using this method of DLL installation,
read this article describing some of the problems that can occur with system installation of COM OCX or DLL files.

This option should be used with any control that needs to be shared with other applications, it causes the following other settings to be set during build:

· Virtual Path is changed to %SystemSystem% (expands to c:\windows\system32 or equivelant - about macros)
· Extract on Install is enabled ( Extraction / Caching Submenu)
· Overwrite disk version if newer internal is enabled ( Extraction / Caching Submenu)
Note: If the DLL contains version information, Thinstall will check the DLLs version against the disk version first. If no DLL version is present then Thinstall checks the two file's creation dates. Thinstall will not overwrite a newer version that resides on disk.
· Don't delete extraction / Cache during Install is enabled. Because other applications may need to use the DLL or OCX after your program has been uninstalled, Thinstall will leave the file behind.


During installation, the process looks like this:

1. Check the %systemsystem% directory to see if the DLL/OCX file already exists. If it does, make sure it is an older version. If the same version or a newer version already exists, then skip to step 3.
2. Extract the internal DLL/OCX to the system directory.
3. Load the DLL and call its DllRegisterServer function. This causes the DLL to add registry entries for itself so that applications can use the COM/ActiveX controls it provides.
4. Unload DLL



Record registry script

When "No Extract / Virtual Pre-Register" is used, the DLL's registry keys are recorded at build-time, each time the project is built. If the DLL is not expected to change, then you may want to record a registry script yourself and use the option "No Extract / No Registration"


Click here for more details about the Virtual Registry



Bug Note: Sometimes you need to use "Record registry script" twice for it to work.

Warning: When you record a registry script for a DLL/OCX, it will be become registered on your local system at that location. If you later delete or remove the DLL/OCX you registered on your system, other programs could fail to load because the system will be unable to load the OCX you've deleted or moved. To prevent this from being a problem, you should use a "local path" to the original DLL/OCX location (e.g. c:\windows\system32).