What is File Costing, and what are the CostInitialize and CostFinalize actions?
Costing is the process of determining the total disk space requirements for an installation. The elements calculated in the file costing process include the amount of disk space in which files are installed or removed, as well as the amount of disk space taken up by registry entries, shortcuts, and other miscellaneous files. Existing files scheduled to be overwritten are also calculated in the disk cost totals.
Total costs are accumulated on a per-component basis and consist of three separate parts: local costs, source costs, and removal costs. These parts correspond to the disk cost that is incurred if the component is installed locally, installed to run from the source media, or removed.
All calculations involving the cost of installing files depend upon the disk volume to which the file is to be installed or removed. Each time the directory associated with a component changes, the costs of the installation files controlled by that component must be recalculated. For example, because a directory change might also imply a volume change, the clustered file sizes must be recalculated. In addition, the new directory must be checked to determine whether any existing files that may be overwritten must be taken into account.
After the CostInitialize action is called, the FileCost action must be called. The CostInitialize action initializes the installer's internal routines that dynamically calculate the disk costs involved with the standard installation actions. No other dynamic cost calculations are done at this point.
Next, the CostFinalize action must be called. This action finalizes all cost calculations and makes the costing data available through the Component table.
After the CostFinalize action completes execution, the Component table is fully initialized and a user interface dialog box sequence containing a SelectionTree control can be initiated if needed. The user interface dialog boxes may offer the option to change the selection state or destination directory of any feature in the Feature table to the user. The process is similar when the selection state of a component changes; however, in this case, the dynamic cost of the changed component only is recalculated.
Once the user has completed selecting features in the user interface, the InstallValidate action should be called. This action verifies that all volumes to which cost has been attributed have sufficient space for the installation.
The CostInitialize action initiates the installation costing process.
Any standard or custom actions that affect costing should be sequenced before the CostInitialize action. Call the FileCost action immediately following the CostInitialize action. Then call the CostFinalize action following the CostInitialize action action to make all final cost calculations available to the installer through the Component table.
There are no ActionData messages.
The CostInitialize action loads the Component table and Feature table into memory.
The CostFinalize action ends the internal installation costing process begun by the CostInitialize action.
Any standard or custom actions that affect costing should be sequenced before the CostInitialize action. Call the FileCost action immediately following the CostInitialize action and then call the CostFinalize action to make all final cost calculations available to the installer through the Component table.
The CostFinalize action must be executed before starting any user interface sequence which allows the user to view or modify Feature table selections or directories.
There are no ActionData messages.
The CostFinalize action queries the Condition table to determine which features are scheduled to be installed. Costing is done for each component in the Component table.
The CostFinalize action also verifies that all the target directories are writable before allowing the installation to continue.
Note During an administrative installation, CostFinalize sets all features for installation.
For further information, please see the Windows Installer SDK.