A Registry Key object represents a registry key for installation or removal. You can add or remove keys, and you can optionally remove all their subkeys and values as well.
Installation or removal of a registry key is controlled by its component. If the component is installed, the registry key's Install action is executed (which may actually remove the key); if the component is removed, the Remove action is executed. If a registry key is not linked to a component, its Install action is executed during installation of your product, and its Remove action when the product is removed.
In addition to the explicit installation and removal actions, registry keys are automatically created if a subkey or value is installed under the key, and removed if they become empty (unless Remove action is set to Do not remove).
Removing a non-empty registry key is potentially a dangerous operation, even more so if its subkeys are also removed. During the removal process, all values under the key (and potentially under its subkeys) are removed regardless of their installation status. This may cause serious problems on the target system. If at all possible, you should selectively remove registry values by using registry value installation and removal actions (see Registry Value).
This pane contains the following attributes and options.
| Attribute | Description |
|---|---|
| Key name | Enter the name of the registry key. You may use symbolic references in the name; they will be resolved when the registry key is installed. |
| Alias | Enter the alias for the registry key. This alias must be unique in the project. Tarma Installer uses the alias as if it were a symbolic variable; for example, you can use expressions like <@regkey_alias\value> to retrieve registry value data during installation. |
| Install action | Select the desired installation action from the drop-down list. The installation action is executed when the registry key's component is installed. If the registry key is not linked to a component, the action is executed when the product as a whole is installed. See Installation actions below for the full list of actions. |
| Remove action | Select the desired removal action from the drop-down list. The removal action is executed when the registry key's component is removed. If the registry key is not linked to a component, the action is executed when the product as a whole is removed. See Removal actions below for the full list of actions. |
| Registry view | Select the desired registry view from the drop-down list. See Registry views below for an explanation of registry views. |
The installer can create or remove the registry key and its values during product installation.
Note: As a side effect, removal of a key may lead to removal of its parent key if the key is empty after the key is removed. This in turn may lead to removal of the grandparent key, etc.
| Install action | Description |
|---|---|
|
Create on demand |
The registry key is created, if it does not already exist, when its first value or subkey is installed. |
| Create always | The registry key is created if it does not already exist, regardless of any values or subkeys under it. |
| Remove if empty | If the registry key exists but has no values or subkeys, it is removed. If it contains one or more values or subkeys, it is left as-is. |
| Remove key and values | If the registry key exists, its values (but not subkeys) are removed. If it contains no subkeys, the key itself is then removed. If it does contain one or more subkeys, the registry key is retained (but its values are gone). |
| Remove key and subkeys | If the registry key exists, its values and all of its subkeys are removed recursively, then the key itself is removed. |
The installer can remove or retain the registry key during product removal.
Note: As a side effect, removal of a key may lead to removal of its parent key if the key is empty after the key is removed. This in turn may lead to removal of the grandparent key, etc.
| Remove action | Description |
|---|---|
| Do not remove | The registry key is left as-is. |
| Remove if empty | If the registry key exists but has no values or subkeys, it is removed. If it contains one or more values or subkeys, it is left as-is. |
| Remove key and values | If the registry key exists, its values (but not subkeys) are removed. If it contains no subkeys, the key itself is then removed. If it does contain one or more subkeys, the registry key is retained (but its values are gone). |
| Remove key and subkeys | If the registry key exists, its values and all of its subkeys are removed recursively, then the key itself is removed. |
On 64-bit Windows systems, the registry is internally subdivided into 32-bit and 64-bit "views". 64-bit programs see the 64-bit version of the registry, while 32-bit programs see the 32-bit version. To a large extent these views are identical and correspond to the same underlying registry keys and values, but they may differ in the following ways:
Microsoft introduced these different views to accommodate 64-bit and 32-bit software side-by-side on a single system, for example 32-bit and 64-bit versions of in-process COM servers such as ActiveX controls. In many cases the 64/32 registry distinction is either immaterial to an application, or the default registry view (64-64 or 32-32) achieves the desired result.
Tip: The different views apply at the registry key level; any registry values that you create use the same view as their parent key. It is not possible to change the registry view on a per-value basis; this must be done at the registry key level.
Note: These remarks and the following only apply to 64-bit Windows versions. On 32-bit Windows versions, there is only one registry view and all registry actions operate on that single view.
During installation of software on a 64-bit Windows system you may need to take the required registry view into account, in particular if you are installing a 32-bit application on a 64-bit system. Pay extra attention if all of the following are true:
To find out if condition #3 is true, start the Windows Registry Editor on a 64-bit system that has your application installed, and look for the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node registry key branch. If your registry keys and values appear under this branch, then they were created under the 32-bit view of the registry and you must take special action to install them correctly.
The default Tarma Installer 64/32-bit registry actions on 64-bit Windows systems differed in previous versions, as follows:
| Tarma Installer version | Registry behavior on 64-bit Windows systems |
|---|---|
| QuickInstall 2.x | Always uses the 32-bit view. |
| ExpertInstall 3.x | Always uses the 32-bit view, except for some uninstaller information. |
| Installer 5.0, Installer 5.1 | 32-bit Setup stubs use the 32-bit view, except for some uninstaller information; 64-bit Setup stubs use the 64-bit view. See Setup stubs for details about the different Setup.exe versions provided with Tarma Installer. |
| Installer 5.2 and later | By default, uses either the existing key (64-bit or 32-bit, in that order), or the native view (64-bit on a 64-bit Windows system). However, you can specify any view; see Available registry view options below. |
As of Tarma Installer 5.2, you can specify the registry key behavior on 64-bit Windows versions (and to some extent on Windows 32-bit versions). The following registry view options are available in the Registry view attribute associated with each registry key.
Note: This behavior is independent of the Setup stub that your installer uses; it only depends on the target system: 32-bit Windows or 64-bit Windows.
| Registry view option | 32-bit Windows | 64-bit Windows |
|---|---|---|
| Existing key, else Native | Always uses 32-bit registry | Checks 64-bit and 32-bit views (in that order) and uses the first that already contains the key. If neither does, uses the 64-bit registry. |
| Native only | Always uses 32-bit registry | Always uses 64-bit registry |
| 64-bit, then 32-bit | Always uses 32-bit registry | Tries to use the 64-bit view first, followed by the 32-bit one if the 64-bit failed. Note: This option differs from Existing key, else Native in that it will not try the 32-bit registry view if the registry action succeeds in the 64-bit view, even if the key already exists in the 32-bit view. |
| 64-bit only | Always fails | Always uses 64-bit registry |
| 32-bit only | Always uses 32-bit registry | Always uses 32-bit registry |
As an alternative to the registry views offered by Tarma Installer 5.2 and later, you may consider installing your 32-bit registry keys and values directly under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node on a 64-bit Windows system. However, we advise against this for the following reasons:
If you need to install both 64-bit and 32-bit versions of the same registry keys or values (but perhaps with different data) on 64-bit Windows systems, then you must create two versions of the same named registry keys and values, and control them by separate components, as follows:
With this configuration, both sets of registry keys and values will be installed (separately) on 64-bit Windows systems, but only the 32-bit set on 32-bit Windows systems.