Edit

Share via


Database Functions

This material is intended for developers who are writing their own setup programs and developers who want to learn more about the installer database tables. For general information on the installer, see About Windows Installer.

You can use the installer access functions to access the database and the installation process. These functions should only be used by custom installation actions and authoring tools. Some of the installer access functions require SQL query strings for querying the database. Queries must adhere to the installer SQL syntax.

This topic lists the installer database access functions by category.

General Database Access Functions

Function Description
MsiDatabaseCommit Commits changes to a database.
MsiDatabaseGetPrimaryKeys Returns the names of all the primary key columns.
MsiDatabaseIsTablePersistent Returns an enumeration describing the state of a table.
MsiDatabaseOpenView Prepares a database query and creates a view object.
MsiGetActiveDatabase Returns the active database for the installation.
MsiViewGetColumnInfo Returns column names or definitions.
MsiOpenDatabase Opens a database file for data access.
MsiViewClose Releases the result set for an executed view.
MsiViewExecute Executes the view query and supplies required parameters.
MsiViewFetch Fetches the next sequential record from the view.
MsiViewGetError Returns the error that occurred in the MsiViewModify function.
MsiViewModify Updates a fetched record.

 

Database Management Functions

Function Description
MsiCreateTransformSummaryInfo Creates summary information for an existing transform.
MsiDatabaseApplyTransform Applies a transform to a database.
MsiDatabaseExport Exports a table from an open database to a text archive file.
MsiDatabaseGenerateTransform Generates a transform file of differences between two databases.
MsiDatabaseImport Imports an installer text archive table into an open database.
MsiDatabaseMerge Merges two databases together.
MsiGetDatabaseState Returns the state of the database.

 

Record Processing Functions

Function Description
MsiCreateRecord Creates new record object with specified number of fields.
MsiFormatRecord Formats record field data and properties using a format string.
MsiRecordClearData Sets all fields in a record to null.
MsiRecordDataSize Returns the length of a record field.
MsiRecordGetFieldCount Returns the number of fields in a record.
MsiRecordGetInteger Returns the integer value from a record field.
MsiRecordGetString Returns the string value of a record field.
MsiRecordIsNull Reports whether a record field is null.
MsiRecordReadStream Reads bytes from a record stream field into a buffer.
MsiRecordSetInteger Sets a record field to an integer field.
MsiRecordSetStream Sets a record stream field from a file.
MsiRecordSetString Copies a string into the designated field.

 

Summary Information Property Functions

Function Description
MsiGetSummaryInformation Obtains handle to summary information stream of installer database.
MsiSummaryInfoGetProperty Gets a single property from the summary information.
MsiSummaryInfoGetPropertyCount Returns number of properties in the summary information stream.
MsiSummaryInfoPersist Writes changed summary information back to summary information stream.
MsiSummaryInfoSetProperty Sets a single summary information property.

 

Installer State Access Functions

Function Description
MsiGetLanguage Returns the numeric language of the current installation.
MsiGetLastErrorRecord Returns error record last returned for the calling process.
MsiGetMode Returns one of the Boolean internal installation states.
MsiGetProperty Gets the value of an installer property.
MsiSetProperty Sets the value of an installation property.
MsiSetMode Sets an internal engine Boolean state.

 

Installer Action Functions

Function Description
MsiDoAction Executes built-in action, custom action, or user-interface wizard action.
MsiEvaluateCondition Evaluates a conditional expression containing property names and values.
MsiProcessMessage Sends an error record to the installer for processing.
MsiSequence Executes an action sequence.

 

Installer Location Functions

Function Description
MsiGetSourcePath Returns the full source path for a folder in the Directory table.
MsiGetTargetPath Returns the full target path for a folder in the Directory table.
MsiSetTargetPath Sets the full target path for a folder in the Directory table.

 

Installer Selection Functions

Function Description
MsiEnumComponentCosts Enumerates the disk-space per drive required to install a component.
MsiGetComponentState Obtains the state of a component.
MsiGetFeatureCost Returns the disk space required by a feature.
MsiGetFeatureState Gets the state of a feature.
MsiGetFeatureValidStates Returns a valid installation state.
MsiSetComponentState Sets a component to the specified state.
MsiSetFeatureAttributes Modifies the default attributes of a feature at run time.
MsiSetFeatureState Sets a feature to a specified state.
MsiSetInstallLevel Sets the installation level of a full product installation.
MsiVerifyDiskSpace Checks for sufficient disk space.

 

User Interface Functions

Function Description
MsiEnableUIPreview Enables preview mode of the user interface.
MsiPreviewBillboard Displays a billboard with the host control in the displayed dialog box.
MsiPreviewDialog Displays a dialog box as modeless and inactive.

 

All functions support both ANSI and Unicode calls. To use these functions, include MsiQuery.h and link with Msi.lib.

Installation Functions

In addition to the database access functions listed above, you create an installation package for an application by using the installer functions listed in the Installer Function Reference section.