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

FunctionDescription
MsiDatabaseCommitCommits changes to a database.
MsiDatabaseGetPrimaryKeysReturns the names of all the primary key columns.
MsiDatabaseIsTablePersistentReturns an enumeration describing the state of a table.
MsiDatabaseOpenViewPrepares a database query and creates a view object.
MsiGetActiveDatabaseReturns the active database for the installation.
MsiViewGetColumnInfoReturns column names or definitions.
MsiOpenDatabaseOpens a database file for data access.
MsiViewCloseReleases the result set for an executed view.
MsiViewExecuteExecutes the view query and supplies required parameters.
MsiViewFetchFetches the next sequential record from the view.
MsiViewGetErrorReturns the error that occurred in the MsiViewModify function.
MsiViewModifyUpdates a fetched record.

 

Database Management Functions

FunctionDescription
MsiCreateTransformSummaryInfoCreates summary information for an existing transform.
MsiDatabaseApplyTransformApplies a transform to a database.
MsiDatabaseExportExports a table from an open database to a text archive file.
MsiDatabaseGenerateTransformGenerates a transform file of differences between two databases.
MsiDatabaseImportImports an installer text archive table into an open database.
MsiDatabaseMergeMerges two databases together.
MsiGetDatabaseStateReturns the state of the database.

 

Record Processing Functions

FunctionDescription
MsiCreateRecordCreates new record object with specified number of fields.
MsiFormatRecordFormats record field data and properties using a format string.
MsiRecordClearDataSets all fields in a record to null.
MsiRecordDataSizeReturns the length of a record field.
MsiRecordGetFieldCountReturns the number of fields in a record.
MsiRecordGetIntegerReturns the integer value from a record field.
MsiRecordGetStringReturns the string value of a record field.
MsiRecordIsNullReports whether a record field is null.
MsiRecordReadStreamReads bytes from a record stream field into a buffer.
MsiRecordSetIntegerSets a record field to an integer field.
MsiRecordSetStreamSets a record stream field from a file.
MsiRecordSetStringCopies a string into the designated field.

 

Summary Information Property Functions

FunctionDescription
MsiGetSummaryInformationObtains handle to summary information stream of installer database.
MsiSummaryInfoGetPropertyGets a single property from the summary information.
MsiSummaryInfoGetPropertyCountReturns number of properties in the summary information stream.
MsiSummaryInfoPersistWrites changed summary information back to summary information stream.
MsiSummaryInfoSetPropertySets a single summary information property.

 

Installer State Access Functions

FunctionDescription
MsiGetLanguageReturns the numeric language of the current installation.
MsiGetLastErrorRecordReturns error record last returned for the calling process.
MsiGetModeReturns one of the Boolean internal installation states.
MsiGetPropertyGets the value of an installer property.
MsiSetPropertySets the value of an installation property.
MsiSetModeSets an internal engine Boolean state.

 

Installer Action Functions

FunctionDescription
MsiDoActionExecutes built-in action, custom action, or user-interface wizard action.
MsiEvaluateConditionEvaluates a conditional expression containing property names and values.
MsiProcessMessageSends an error record to the installer for processing.
MsiSequenceExecutes an action sequence.

 

Installer Location Functions

FunctionDescription
MsiGetSourcePathReturns the full source path for a folder in the Directory table.
MsiGetTargetPathReturns the full target path for a folder in the Directory table.
MsiSetTargetPathSets the full target path for a folder in the Directory table.

 

Installer Selection Functions

FunctionDescription
MsiEnumComponentCostsEnumerates the disk-space per drive required to install a component.
MsiGetComponentStateObtains the state of a component.
MsiGetFeatureCostReturns the disk space required by a feature.
MsiGetFeatureStateGets the state of a feature.
MsiGetFeatureValidStatesReturns a valid installation state.
MsiSetComponentStateSets a component to the specified state.
MsiSetFeatureAttributesModifies the default attributes of a feature at run time.
MsiSetFeatureStateSets a feature to a specified state.
MsiSetInstallLevelSets the installation level of a full product installation.
MsiVerifyDiskSpaceChecks for sufficient disk space.

 

User Interface Functions

FunctionDescription
MsiEnableUIPreviewEnables preview mode of the user interface.
MsiPreviewBillboardDisplays a billboard with the host control in the displayed dialog box.
MsiPreviewDialogDisplays 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.

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags :


Page view tracker