Pages

Friday, 22 June 2012

What is Deferred Custom Action





The purpose of a deferred execution custom action is to delay the execution of a system change to the time when the installation script is executed.



This differs from a regular custom action, or a standard action, in which the installer executes the action immediately upon encountering it in a sequence table or in a call to MsiDoAction.


A deferred execution custom action enables a package author to specify system operations at a particular point within the execution of the installation script.


The installer does not execute a deferred execution custom action at the time the installation sequence is processed. Instead the installer writes the custom action into the installation script.


1. Should be placed between install initialize and install finalize.
2. Does not have access to MSIDATABASE in deferred execution.




MSI Upgrade Table



The Upgrade table contains information that’s used when an Installer database is used to make a major upgrade to an existing product. This table contains following columns:



UpgradeCode:
The UpgradeCode property in this column specifies the upgrade code of all products that are to be detected by the FindRelatedProducts action. Unlike the ProductCode, different products may share the same UpgradeCode.

VersionMin:
This column specifies the minimum version to be upgraded. Lower boundary of the range of product versions detected by FindRelatedProducts. A null value means there is no lower bound on the version to be upgraded.

VersionMax:
This column specifies the maximum version to be upgraded. Upper boundary of the range of product versions detected by the FindRelatedProducts action. A null value means there is no upper bound on the version to be upgraded.

Language:
This column contains the set of languages detected by FindRelatedProducts that are to be upgraded and are separated by semicolons. A null value means that any language can be upgraded.

Attributes:
This column can contain any combination of the bit flags as shown in below tables:
Bit flag ( decimal) 
Attribute
1
To enable the MigrateFeatureStates action
2
To detect but not change previous versions
4
To install the new version even if the old version can’t be removed
256
To include VersionMin in the versions upgraded
512
To include VersionMax in the version to be upgraded
1024
To upgrade all languages except those listed in the Language column

Remove:
This column contains a comma-delimited set of names of existing features to be removed.

ActionProperty:
When the FindRelatedProducts action detects a related product installed on the system, it appends the product code to the property specified in this field. The property specified in this column must be a public property and the package author must add the property to the SecureCustomProperties property. Each row in the Upgrade table must have a unique ActionProperty value. After FindRelatedProducts, the value of this property is a list product codes, separated by semicolons (;), detected on the system. 


MSI Registry Table



This table holds all the miscellaneous (that is, not directly related to COM or COM+) information that the Installer needs to write to the Registry to install the application. The Registry table is used by the WriteRegistryValues action. This table contains the following columns:



Registry:
This column is an arbitrary key for the table which is used to identify a registry record.

Root:
This column indicates the Registry hive to be written to. It must have one of the values shown in below table.

Constant

Value

Explanation

None (Empty)

-1
i) For a per-user installation, writes to HKEY_CURRENT_USER.
ii) For a per-machine installation, Writes to HKEY_LOCAL_MACHINE.

msidbRegistryRootClassesRoot

0

HKEY_CLASSES_ROOT

msidbRegistryRootCurrentUser

1
HKEY_CURRENT_USER

msidbRegistryRootLocalMachine

2
HKEY_LOCAL_MACHINE

msidbRegistryRootUsers

3
HKEY_USERS


Key:
The Registry key to be written.

Name:
This column contains the name of the Registry value being written. If the column is null, then the value is written to the default for the Registry key. If the Value column is null, then this column should contain one of the special characters
Special Character
Corresponding Action
+
To create the key when the component is
Installed.

-
To delete the key when the component is uninstalled

*
To create the key on installation and delete it on uninstallation


Value:
This is the actual data to write to the Registry value.
Special Character.
Meaning
If the value starts with #x

Stored as a hexadecimal value.

If the value starts with #%

Stored as an expandable string.

If the value starts with #

Stored as an integer.

The special string [~] is stored as a null.

If this string occurs, the value is stored as a list of strings.

If the string starts with [~]
The value is appended to any existing value.

If the string ends with [~]
The value is prepended to any existing value.

If the value starts with ##
Stored as a string starting with a single # sign.


Component:
This is a foreign key to the Component table that identifies the component controlling this Registry operation.


MSI Shortcut Table



Shortcut table holds the information the application needs, to create shortcuts on the user's computer. Shortcut table has the following columns:





Shortcut:
This column contains the name of the shortcut.

Directory:
This column specifies the directory in which the Shortcut file is created.

Name:
The localizable name of the shortcut to be created

Component:
 This column references to the name of the component that contains the shortcut.

Target:
The value in this column varies for advertised and non-advertised shortcuts. For advertised shortcuts the value in this column references to the Feature which contains the component that owns the shortcut. And in the case of non-advertised shortcuts the value in this column will be formatted string, and this particular formatted string will a folder or file containing the shortcut. To convert the non-advertised shortcuts into advertised shortcut resolve the formatted string to its full path.

 Arguments:
This particular column references to the command-line arguments for the shortcut.

Description:
This column refers to the description of the shortcut.

Hotkey:
Authors of installation packages are generally recommended not to set this option, because the setting of this option can add duplicate hotkeys to a user's desktop.

Icon:
This is a foreign key to the Icon table. If this is null, the icon in the target file is used.

IconIndex:
This must be a non negative integer.

ShowCmd:
The Show command for the application window.

Value
Style
1
SW_SHOWNORMAL
3
SW_SHOWMAXIMIZED
7
SW_SHOWMINNOACTIVE

WKDir: This column contains the working directory of the shortcut.




Directory table contains all the directories in an msi file. A directory can have a parent and child directories. If the parent or child directory of any directory is to be modified it can be done through this table. This table also lists all the parent directories of each directory. The Directory table has the following columns:




Directory:
Directory column contains a unique identifier for a directory.

Directory_Parent:
Directory_Parent column is a reference to the directory's parent directory. Directory that has a Directory_Parent column equal to null or equal to the Directory column represents a root directory.

DefaultDir:
This column references to the name of both the target and source directories.


MSI FeatureComponents Table



FeatureComponents table defines the relationship between all the features and components of an msi file. If we have to change the feature of any component it can also be done through this table. For each feature, this table lists all the components that make up that feature. The following are the columns of FeatureComponents table:



 Feature_:
An external key into the first column of the Feature table.

Component_:
An external key into the first column of the Component table


MSI Feature Table



Feature table explains the logical tree structure of features. There should be atleast one feature in every MSI file. And a feature can have a parent and child features also. Feature table contains the list of features that are present in a specific MSI file. The following are the columns of Feature table:

For example suppose there are two features Feature 1 and Feature 2 in a specific msi file.  Suppose ‘Feature 1’ feature is child feature of ‘Feature 2’ feature.

Let us discuss about the feature ‘Feature 1’.
Feature Column:
 It is a Primary key used to identify a particular feature record. Feature column shows Feature 1 as primary key for feature Feature1.

Feature_Parent:
Feature 2 will be its parent feature, since Feature 1 feature is a child feature of Feature 2.

Title:
Title will be the Short string of text identifying the feature. So in this case it will be Feature 1.

Description:
Longer string of text describing the feature. It can be NULL

Display:
     
Value
Appearance in UserInterface
NULL
Feature not displayed
ODD NUMBER
Displayed as expanded
EVEN NUMBER
Displayed as collapsed


Level:
The initial installation level of this feature. An install level of zero disables the item and prevents it from being displayed.

Directory:
Directory_ column specifies the name of a directory that can be configured. In this particular example the Directory is INSTALLDIR.
Directory
Full path
1) INSTALLDIR
C:\ProgramFiles\{Application Name}.
Ex: “C:\Program Files\Adobe”. Where Adobe is application name.
2) TargetDir
Ex: “C:\”


Attributes:
This field specifies the remote execution option for features that have not yet been installed and for which no feature state request has been made using any of the properties. If this field is blank, the value defaults to 0.