[This is preliminary documentation and subject to change.]
Costing is the process of determining the total disk space requirements for the current installation, including costs for files to be installed and/or removed, registry entries, shortcuts, and so forth. Costing takes into account the size of existing files to be overwritten (which reduces the overall costs).
Total costs are accumulated on a per-component basis and consist of three separate parts: local costs, source costs, and removal cost—corresponding 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 in part on the 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 change in directory 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. This action initializes all internal routines that dynamically calculate the disk costs involved with all standard installation actions. No other dynamic cost calculations are done at this point.
Next, the CostFinalize action must be called. This action finalizes all the cost calculations and makes them available through the Component table.
After the CostFinalize action finishes, the Component table is fully initialized, and a user interface dialog box sequence containing a SelectionTree control (if needed) can be initiated. The user interface dialog boxes typically give the user the option to change the selection state and/or destination directory of any feature in the Feature table (which in turn is linked to one or more components). The process is similar when the selection state of a component changes, but, in this case, the dynamic cost of only the changed component is recalculated.
After the Selection user interface wizard sequence, the InstallValidate action should be called before any other installation action. This action verifies that all volumes to which cost has been attributed have sufficient space for the installation.