Active-Setup Mechanism

Self healing is one of the main features of Microsoft’s Windows Installer technology. Self healing leverages the Windows Installer database to allow for a full or partial reinstallation of a product if the installation gets broken or corrupt.

Windows Installer addresses this feature through Advertised shortcuts. When the application is installed, the self-healing feature is automatically activated if the application is launched through the advertised shortcuts. Since the shortcuts point to a file from a feature, only the components in this feature can be repaired. Therefore, if one of these components is missing, Windows Installer will trigger an auto-repair for the entire feature.

If no Advertised shortcuts (or no shortcuts at all) are present in the package, but user information and/or actions must be performed for each user, then you should use the Active-Setup mechanism.

An exception to this rule appears if your package contains File Type Associations (FTA). An FTA is basically a file extension you can associate with an application from your package so that the selected program can perform certain operations (verbs) on the files with the specified extension. First, a ProgID is defined, which can have any number of extensions associated and each extension can define any number of verbs.

When FTAs are present in an MSI package, it doesn’t matter if you have an advertised shortcut or not, the moment the user will do the action for which the FTA exists, the self-healing mechanism will start automatically.

Advanced Installer offers a quick and easy way to view, edit and create File Associations with a few clicks. Check out this tutorial.

Windows Active Setup is a mechanism for executing commands once per user during login. When using active setup, the following keys are compared:

HKLM\Software\Microsoft\Active Setup\Installed Components\[ProductCode]

and

HKCU\Software\Microsoft\Active Setup\Installed Components\[ProductCode]

If the HKCU registry entries don’t exist, or the version number of HKCU is less than the one from HKLM, then the specified application is executed for the current user. So, when each new user logs on, the operating system compares Active Setup registry keys between HKLM and HKCU, and runs the command line in StubPath if the HKCU entry is missing or if the version in HKCU is less than the one for HKLM.

To implement Active Setup, please create the following registry hive:

HKLM\Software\Microsoft\Active Setup\Installed Components\[ProductCode]

When a user logs on for the first time after an Active Setup has been configured in HKLM, the operating system compares Active Setup registry keys between HKLM and HKCU, and runs the executable if the HKCU entry is missing or the version in HKCU is lower than the one for HKLM. To update the ActiveSetup executable, just install a new version, and increment the Version registry key (second registry entry above). After performing these steps, the next time the user logs on, the active setup will run again for that user.

Active Setup is a solution for applications that require installation of components such as files or registry keys on a per-user basis, but don’t have any advertised entry points or other triggers to initiate the installation process.

Want to know how to implement the self-healing mechanism in your package? Check out this guide.