📄 msiquery.h
字号:
INT iValue, // integer value, used only if integer property
FILETIME *pftValue, // pointer to filetime value, used only if datetime property
LPCSTR szValue); // text value, used only if string property
UINT WINAPI MsiSummaryInfoSetPropertyW(MSIHANDLE hSummaryInfo,
UINT uiProperty, // property ID, one of allowed values for summary information
UINT uiDataType, // VT_I4, VT_LPSTR, VT_FILETIME, or VT_EMPTY
INT iValue, // integer value, used only if integer property
FILETIME *pftValue, // pointer to filetime value, used only if datetime property
LPCWSTR szValue); // text value, used only if string property
#ifdef UNICODE
#define MsiSummaryInfoSetProperty MsiSummaryInfoSetPropertyW
#else
#define MsiSummaryInfoSetProperty MsiSummaryInfoSetPropertyA
#endif // !UNICODE
// Get a single property from the summary information
// Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_UNKNOWN_PROPERTY
UINT WINAPI MsiSummaryInfoGetPropertyA(MSIHANDLE hSummaryInfo,
UINT uiProperty, // property ID, one of allowed values for summary information
UINT *puiDataType, // returned type: VT_I4, VT_LPSTR, VT_FILETIME, VT_EMPTY
INT *piValue, // returned integer property data
FILETIME *pftValue, // returned datetime property data
LPSTR szValueBuf, // buffer to return string property data
DWORD *pcchValueBuf); // in/out buffer character count
UINT WINAPI MsiSummaryInfoGetPropertyW(MSIHANDLE hSummaryInfo,
UINT uiProperty, // property ID, one of allowed values for summary information
UINT *puiDataType, // returned type: VT_I4, VT_LPSTR, VT_FILETIME, VT_EMPTY
INT *piValue, // returned integer property data
FILETIME *pftValue, // returned datetime property data
LPWSTR szValueBuf, // buffer to return string property data
DWORD *pcchValueBuf); // in/out buffer character count
#ifdef UNICODE
#define MsiSummaryInfoGetProperty MsiSummaryInfoGetPropertyW
#else
#define MsiSummaryInfoGetProperty MsiSummaryInfoGetPropertyA
#endif // !UNICODE
// Write back changed information to summary information stream
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE hSummaryInfo);
// --------------------------------------------------------------------------
// Installer database management functions - not used by custom actions
// --------------------------------------------------------------------------
// Open an installer database, specifying the persistance mode
UINT WINAPI MsiOpenDatabaseA(
LPCSTR szDatabasePath, // path to database, 0 to create temporary database
LPCSTR szPersist, // output database path or one of predefined values
MSIHANDLE* phDatabase); // location to return database handle
UINT WINAPI MsiOpenDatabaseW(
LPCWSTR szDatabasePath, // path to database, 0 to create temporary database
LPCWSTR szPersist, // output database path or one of predefined values
MSIHANDLE* phDatabase); // location to return database handle
#ifdef UNICODE
#define MsiOpenDatabase MsiOpenDatabaseW
#else
#define MsiOpenDatabase MsiOpenDatabaseA
#endif // !UNICODE
// Import an MSI text archive table into an open database
UINT WINAPI MsiDatabaseImportA(MSIHANDLE hDatabase,
LPCSTR szFolderPath, // folder containing archive files
LPCSTR szFileName); // table archive file to be imported
UINT WINAPI MsiDatabaseImportW(MSIHANDLE hDatabase,
LPCWSTR szFolderPath, // folder containing archive files
LPCWSTR szFileName); // table archive file to be imported
#ifdef UNICODE
#define MsiDatabaseImport MsiDatabaseImportW
#else
#define MsiDatabaseImport MsiDatabaseImportA
#endif // !UNICODE
// Export an MSI table from an open database to a text archive file
UINT WINAPI MsiDatabaseExportA(MSIHANDLE hDatabase,
LPCSTR szTableName, // name of table in database <case-sensitive>
LPCSTR szFolderPath, // folder containing archive files
LPCSTR szFileName); // name of exported table archive file
UINT WINAPI MsiDatabaseExportW(MSIHANDLE hDatabase,
LPCWSTR szTableName, // name of table in database <case-sensitive>
LPCWSTR szFolderPath, // folder containing archive files
LPCWSTR szFileName); // name of exported table archive file
#ifdef UNICODE
#define MsiDatabaseExport MsiDatabaseExportW
#else
#define MsiDatabaseExport MsiDatabaseExportA
#endif // !UNICODE
// Merge two database together, allowing duplicate rows
UINT WINAPI MsiDatabaseMergeA(MSIHANDLE hDatabase,
MSIHANDLE hDatabaseMerge, // database to be merged into hDatabase
LPCSTR szTableName); // name of non-persistent table to receive errors
UINT WINAPI MsiDatabaseMergeW(MSIHANDLE hDatabase,
MSIHANDLE hDatabaseMerge, // database to be merged into hDatabase
LPCWSTR szTableName); // name of non-persistent table to receive errors
#ifdef UNICODE
#define MsiDatabaseMerge MsiDatabaseMergeW
#else
#define MsiDatabaseMerge MsiDatabaseMergeA
#endif // !UNICODE
// Generate a transform file of differences between two databases
UINT WINAPI MsiDatabaseGenerateTransformA(MSIHANDLE hDatabase,
MSIHANDLE hDatabaseReference, // base database to reference changes
LPCSTR szTransformFile, // name of generated transform file
int iErrorConditions, // conditions treated as errors when transform applied
int iValidation); // properties to be validated when transform applied
UINT WINAPI MsiDatabaseGenerateTransformW(MSIHANDLE hDatabase,
MSIHANDLE hDatabaseReference, // base database to reference changes
LPCWSTR szTransformFile, // name of generated transform file
int iErrorConditions, // conditions treated as errors when transform applied
int iValidation); // properties to be validated when transform applied
#ifdef UNICODE
#define MsiDatabaseGenerateTransform MsiDatabaseGenerateTransformW
#else
#define MsiDatabaseGenerateTransform MsiDatabaseGenerateTransformA
#endif // !UNICODE
// Apply a transform file containing database difference
UINT WINAPI MsiDatabaseApplyTransformA(MSIHANDLE hDatabase,
LPCSTR szTransformFile, // name of transform file
int iErrorConditions); // existing row conditions treated as errors
UINT WINAPI MsiDatabaseApplyTransformW(MSIHANDLE hDatabase,
LPCWSTR szTransformFile, // name of transform file
int iErrorConditions); // existing row conditions treated as errors
#ifdef UNICODE
#define MsiDatabaseApplyTransform MsiDatabaseApplyTransformW
#else
#define MsiDatabaseApplyTransform MsiDatabaseApplyTransformA
#endif // !UNICODE
// Write out all persistent table data, ignored if database opened read-only
UINT WINAPI MsiDatabaseCommit(MSIHANDLE hDatabase);
// Return the update state of a database
MSIDBSTATE WINAPI MsiGetDatabaseState(MSIHANDLE hDatabase);
// --------------------------------------------------------------------------
// Record object functions
// --------------------------------------------------------------------------
// Create a new record object with the requested number of fields
// Field 0, not included in count, is used for format strings and op codes
// All fields are initialized to null
// Returns a handle to the created record, or 0 if memory could not be allocated
MSIHANDLE WINAPI MsiCreateRecord(
unsigned int cParams); // the number of data fields
// Report whether a record field is NULL
// Returns TRUE if the field is null or does not exist
// Returns FALSE if the field contains data, or the handle is invalid
BOOL WINAPI MsiRecordIsNull(MSIHANDLE hRecord,
unsigned int iField);
// Return the length of a record field
// Returns 0 if field is NULL or non-existent
// Returns sizeof(int) if integer data
// Returns character count if string data (not counting null terminator)
// Returns bytes count if stream data
unsigned int WINAPI MsiRecordDataSize(MSIHANDLE hRecord,
unsigned int iField);
// Set a record field to an integer value
// Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD
UINT WINAPI MsiRecordSetInteger(MSIHANDLE hRecord,
unsigned int iField,
int iValue);
// Copy a string into the designated field
// A null string pointer and an empty string both set the field to null
// Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD
UINT WINAPI MsiRecordSetStringA(MSIHANDLE hRecord,
unsigned int iField,
LPCSTR szValue);
UINT WINAPI MsiRecordSetStringW(MSIHANDLE hRecord,
unsigned int iField,
LPCWSTR szValue);
#ifdef UNICODE
#define MsiRecordSetString MsiRecordSetStringW
#else
#define MsiRecordSetString MsiRecordSetStringA
#endif // !UNICODE
// Return the integer value from a record field
// Returns the value MSI_NULL_INTEGER if the field is null
// or if the field is a string that cannot be converted to an integer
int WINAPI MsiRecordGetInteger(MSIHANDLE hRecord,
unsigned int iField);
// Return the string value of a record field
// Integer fields will be converted to a string
// Null and non-existent fields will report a value of 0
// Fields containing stream data will return ERROR_INVALID_DATATYPE
// Returns ERROR_SUCCESS, ERROR_MORE_DATA,
// ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD, ERROR_BAD_ARGUMENTS
UINT WINAPI MsiRecordGetStringA(MSIHANDLE hRecord,
unsigned int iField,
LPSTR szValueBuf, // buffer for returned value
DWORD *pcchValueBuf); // in/out buffer character count
UINT WINAPI MsiRecordGetStringW(MSIHANDLE hRecord,
unsigned int iField,
LPWSTR szValueBuf, // buffer for returned value
DWORD *pcchValueBuf); // in/out buffer character count
#ifdef UNICODE
#define MsiRecordGetString MsiRecordGetStringW
#else
#define MsiRecordGetString MsiRecordGetStringA
#endif // !UNICODE
// Returns the number of fields allocated in the record
// Does not count field 0, used for formatting and op codes
unsigned int WINAPI MsiRecordGetFieldCount(MSIHANDLE hRecord);
// Set a record stream field from a file
// The contents of the specified file will be read into a stream object
// The stream will be persisted if the record is inserted into the database
UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord,
unsigned int iField,
LPCSTR szFilePath); // path to file containing stream data
UINT WINAPI MsiRecordSetStreamW(MSIHANDLE hRecord,
unsigned int iField,
LPCWSTR szFilePath); // path to file containing stream data
#ifdef UNICODE
#define MsiRecordSetStream MsiRecordSetStreamW
#else
#define MsiRecordSetStream MsiRecordSetStreamA
#endif // !UNICODE
// Read bytes from a record stream field into a buffer
// Must set the in/out argument to the requested byte count to read
// The number of bytes transferred is returned through the argument
// If no more bytes are available, ERROR_SUCCESS is still returned
UINT WINAPI MsiRecordReadStream(MSIHANDLE hRecord,
unsigned int iField,
char *szDataBuf, // buffer to receive bytes from stream
DWORD *pcbDataBuf); // in/out buffer byte count
// Clears all data fields in a record to NULL
UINT WINAPI MsiRecordClearData(MSIHANDLE hRecord);
// --------------------------------------------------------------------------
// Functions to access a running installation, called from custom actions
// The install handle is the single argument passed to custom actions
// --------------------------------------------------------------------------
// Return a handle to the database currently in use by this installer instance
MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall); // returns handle to database, 0 if none active
// Set the value for an installer property
// If the property is not defined, it will be created
// If the value is null or an empty string, the property will be removed
// Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_BAD_ARGUMENTS
UINT WINAPI MsiSetPropertyA(MSIHANDLE hInstall,
LPCSTR szName, // property identifier, case-sensitive
LPCSTR szValue); // property value, null to undefine property
UINT WINAPI MsiSetPropertyW(MSIHANDLE hInstall,
LPCWSTR szName, // property identifier, case-sensitive
LPCWSTR szValue); // property value, null to undefine property
#ifdef UNICODE
#define MsiSetProperty MsiSetPropertyW
#else
#define MsiSetProperty MsiSetPropertyA
#endif // !UNICODE
// Get the value for an installer property
// If the property is not defined, it is equivalent to a 0-length value, not error
// Returns ERROR_SUCCESS, ERROR_MORE_DATA, ERROR_INVALID_HANDLE, ERROR_BAD_ARGUMENTS
UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall,
LPCSTR szName, // property identifier, case-sensitive
LPSTR szValueBuf, // buffer for returned property value
DWORD *pcchValueBuf); // in/out buffer character count
UINT WINAPI MsiGetPropertyW(MSIHANDLE hInstall,
LPCWSTR szName, // property identifier, case-sensitive
LPWSTR szValueBuf, // buffer for returned property value
DWORD *pcchValueBuf); // in/out buffer character count
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -