📄 msiquery.h
字号:
// 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(
UINT 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,
UINT 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
UINT WINAPI MsiRecordDataSize(MSIHANDLE hRecord,
UINT iField);
// Set a record field to an integer value
// Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD
UINT WINAPI MsiRecordSetInteger(MSIHANDLE hRecord,
UINT 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,
UINT iField,
LPCSTR szValue);
UINT WINAPI MsiRecordSetStringW(MSIHANDLE hRecord,
UINT 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,
UINT 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,
UINT iField,
LPSTR szValueBuf, // buffer for returned value
DWORD *pcchValueBuf); // in/out buffer character count
UINT WINAPI MsiRecordGetStringW(MSIHANDLE hRecord,
UINT 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
UINT 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
// Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord,
UINT iField,
LPCSTR szFilePath); // path to file containing stream data
UINT WINAPI MsiRecordSetStreamW(MSIHANDLE hRecord,
UINT 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,
UINT 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
#ifdef UNICODE
#define MsiGetProperty MsiGetPropertyW
#else
#define MsiGetProperty MsiGetPropertyA
#endif // !UNICODE
// Return the numeric language for the currently running install
// Returns 0 if an install not running
LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall);
// Return one of the boolean internal installer states
// Returns FALSE if the handle is not active or if the mode is not implemented
BOOL WINAPI MsiGetMode(MSIHANDLE hInstall,
MSIRUNMODE eRunMode); // particular mode for which the state is returned
// Set an internal install session boolean mode - Note: most modes are read-only
// Returns ERROR_SUCCESS if the mode can be set to the desired state
// Returns ERROR_ACCESS_DENIED if the mode is not settable
// Returns ERROR_INVALID_HANDLE if the handle is not an active install session
UINT WINAPI MsiSetMode(MSIHANDLE hInstall,
MSIRUNMODE eRunMode, // particular mode for which state is to be set
BOOL fState); // new state for bit flag
// Format record data using a format string containing field markers and/or properties
// Record field 0 must contain the format string
// Other fields must contain data that may be referenced by the format string.
UINT WINAPI MsiFormatRecordA(MSIHANDLE hInstall, // non-zero for property expansion
MSIHANDLE hRecord, // handle to record, field 0 contains format string
LPSTR szResultBuf, // buffer to return formatted string
DWORD *pcchResultBuf); // in/out buffer character count
UINT WINAPI MsiFormatRecordW(MSIHANDLE hInstall, // non-zero for property expansion
MSIHANDLE hRecord, // handle to record, field 0 contains format string
LPWSTR szResultBuf, // buffer to return formatted string
DWORD *pcchResultBuf); // in/out buffer character count
#ifdef UNICODE
#define MsiFormatRecord MsiFormatRecordW
#else
#define MsiFormatRecord MsiFormatRecordA
#endif // !UNICODE
// Execute another action, either built-in, custom, or UI wizard
// Returns ERROR_FUNCTION_NOT_CALLED if action not found
// Returns ERROR_SUCCESS if action completed succesfully
// Returns ERROR_INSTALL_USEREXIT if user cancelled during action
// Returns ERROR_INSTALL_FAILURE if action failed
// Returns ERROR_INSTALL_SUSPEND if user suspended installation
// Returns ERROR_MORE_DATA if action wishes to skip remaining actions
// Returns ERROR_INVALID_HANDLE_STATE if install session not active
// Returns ERROR_INVALID_DATA if failure calling custom action
// Returns ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER if arguments invalid
UINT WINAPI MsiDoActionA(MSIHANDLE hInstall,
LPCSTR szAction); // name of action to call, case-sensitive
UINT WINAPI MsiDoActionW(MSIHANDLE hInstall,
LPCWSTR szAction); // name of action to call, case-sensitive
#ifdef UNICODE
#define MsiDoAction MsiDoActionW
#else
#define MsiDoAction MsiDoActionA
#endif // !UNICODE
// Execute another action sequence, as descibed in the specified table
// Returns the same error codes as MsiDoAction
UINT WINAPI MsiSequenceA(MSIHANDLE hInstall,
LPCSTR szTable, // name of table containing action sequence
INT iSequenceMode); // for future use, must be 0 in MSI 1.0
UINT WINAPI MsiSequenceW(MSIHANDLE hInstall,
LPCWSTR szTable, // name of table containing action sequence
INT iSequenceMode); // for future use, must be 0 in MSI 1.0
#ifdef UNICODE
#define MsiSequence MsiSequenceW
#else
#define MsiSequence MsiSequenceA
#endif // !UNICODE
// Send an error record to the installer for processing.
// If field 0 (template) is not set, field 1 must be set to the error code,
// corresponding the the error message in the Error database table,
// and the message will be formatted using the template from the Error table
// before passing it to the UI handler for display.
// Returns Win32 button codes: IDOK IDCANCEL IDABORT IDRETRY IDIGNORE IDYES IDNO
// or 0 if no action taken, or -1 if invalid argument or handle
int WINAPI MsiProcessMessage(MSIHANDLE hInstall,
INSTALLMESSAGE eMessageType, // type of message
MSIHANDLE hRecord); // record containing message format and data
// Evaluate a conditional expression containing property names and values
MSICONDITION WINAPI MsiEvaluateConditionA(MSIHANDLE hInstall,
LPCSTR szCondition);
MSICONDITION WINAPI MsiEvaluateConditionW(MSIHANDLE hInstall,
LPCWSTR szCondition);
#ifdef UNICODE
#define MsiEvaluateCondition MsiEvaluateConditionW
#else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -