Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1029 lines
48 KiB

  1. /*****************************************************************************\
  2. * *
  3. * MsiQuery.h - Interface to running installer for custom actions and tools *
  4. * *
  5. * Version 2.0 *
  6. * *
  7. * NOTES: All buffers sizes are TCHAR count, null included only on input *
  8. * Return argument pointers may be null if not interested in value *
  9. * Returned handles of all types must be closed: MsiCloseHandle(h) *
  10. * Functions with UINT return type return a system error code *
  11. * Designated functions will set or clear the last error record, *
  12. * which is then accessible with MsiGetLastErrorRecord. However, *
  13. * the following argument errors do not register an error record: *
  14. * ERROR_INVALID_HANDLE, ERROR_INVALID_PARAMETER, ERROR_MORE_DATA. *
  15. * *
  16. * Copyright (c) Microsoft Corporation. All rights reserved. *
  17. * *
  18. \*****************************************************************************/
  19. #ifndef _MSIQUERY_H_
  20. #define _MSIQUERY_H_
  21. #include "msi.h" // INSTALLSTATE
  22. #define MSI_NULL_INTEGER 0x80000000 // integer value reserved for null
  23. // MsiOpenDatabase persist predefine values, otherwise output database path is used
  24. #define MSIDBOPEN_READONLY (LPCTSTR)0 // database open read-only, no persistent changes
  25. #define MSIDBOPEN_TRANSACT (LPCTSTR)1 // database read/write in transaction mode
  26. #define MSIDBOPEN_DIRECT (LPCTSTR)2 // database direct read/write without transaction
  27. #define MSIDBOPEN_CREATE (LPCTSTR)3 // create new database, transact mode read/write
  28. #define MSIDBOPEN_CREATEDIRECT (LPCTSTR)4 // create new database, direct mode read/write
  29. #define MSIDBOPEN_PATCHFILE 32/sizeof(*MSIDBOPEN_READONLY) // add flag to indicate patch file
  30. typedef enum tagMSIDBSTATE
  31. {
  32. MSIDBSTATE_ERROR =-1, // invalid database handle
  33. MSIDBSTATE_READ = 0, // database open read-only, no persistent changes
  34. MSIDBSTATE_WRITE = 1, // database readable and updatable
  35. } MSIDBSTATE;
  36. typedef enum tagMSIMODIFY
  37. {
  38. MSIMODIFY_SEEK =-1, // reposition to current record primary key
  39. MSIMODIFY_REFRESH = 0, // refetch current record data
  40. MSIMODIFY_INSERT = 1, // insert new record, fails if matching key exists
  41. MSIMODIFY_UPDATE = 2, // update existing non-key data of fetched record
  42. MSIMODIFY_ASSIGN = 3, // insert record, replacing any existing record
  43. MSIMODIFY_REPLACE = 4, // update record, delete old if primary key edit
  44. MSIMODIFY_MERGE = 5, // fails if record with duplicate key not identical
  45. MSIMODIFY_DELETE = 6, // remove row referenced by this record from table
  46. MSIMODIFY_INSERT_TEMPORARY = 7, // insert a temporary record
  47. MSIMODIFY_VALIDATE = 8, // validate a fetched record
  48. MSIMODIFY_VALIDATE_NEW = 9, // validate a new record
  49. MSIMODIFY_VALIDATE_FIELD = 10, // validate field(s) of an incomplete record
  50. MSIMODIFY_VALIDATE_DELETE = 11, // validate before deleting record
  51. } MSIMODIFY;
  52. typedef enum tagMSICOLINFO
  53. {
  54. MSICOLINFO_NAMES = 0, // return column names
  55. MSICOLINFO_TYPES = 1, // return column definitions, datatype code followed by width
  56. } MSICOLINFO;
  57. typedef enum tagMSICONDITION
  58. {
  59. MSICONDITION_FALSE = 0, // expression evaluates to False
  60. MSICONDITION_TRUE = 1, // expression evaluates to True
  61. MSICONDITION_NONE = 2, // no expression present
  62. MSICONDITION_ERROR = 3, // syntax error in expression
  63. } MSICONDITION;
  64. typedef enum tagMSICOSTTREE
  65. {
  66. MSICOSTTREE_SELFONLY = 0,
  67. MSICOSTTREE_CHILDREN = 1,
  68. MSICOSTTREE_PARENTS = 2,
  69. MSICOSTTREE_RESERVED = 3, // Reserved for future use
  70. } MSICOSTTREE;
  71. typedef enum tagMSIDBERROR
  72. {
  73. MSIDBERROR_INVALIDARG = -3, // invalid argument
  74. MSIDBERROR_MOREDATA = -2, // buffer too small
  75. MSIDBERROR_FUNCTIONERROR = -1, // function error
  76. MSIDBERROR_NOERROR = 0, // no error
  77. MSIDBERROR_DUPLICATEKEY = 1, // new record duplicates primary keys of existing record in table
  78. MSIDBERROR_REQUIRED = 2, // non-nullable column, no null values allowed
  79. MSIDBERROR_BADLINK = 3, // corresponding record in foreign table not found
  80. MSIDBERROR_OVERFLOW = 4, // data greater than maximum value allowed
  81. MSIDBERROR_UNDERFLOW = 5, // data less than minimum value allowed
  82. MSIDBERROR_NOTINSET = 6, // data not a member of the values permitted in the set
  83. MSIDBERROR_BADVERSION = 7, // invalid version string
  84. MSIDBERROR_BADCASE = 8, // invalid case, must be all upper-case or all lower-case
  85. MSIDBERROR_BADGUID = 9, // invalid GUID
  86. MSIDBERROR_BADWILDCARD = 10, // invalid wildcardfilename or use of wildcards
  87. MSIDBERROR_BADIDENTIFIER = 11, // bad identifier
  88. MSIDBERROR_BADLANGUAGE = 12, // bad language Id(s)
  89. MSIDBERROR_BADFILENAME = 13, // bad filename
  90. MSIDBERROR_BADPATH = 14, // bad path
  91. MSIDBERROR_BADCONDITION = 15, // bad conditional statement
  92. MSIDBERROR_BADFORMATTED = 16, // bad format string
  93. MSIDBERROR_BADTEMPLATE = 17, // bad template string
  94. MSIDBERROR_BADDEFAULTDIR = 18, // bad string in DefaultDir column of Directory table
  95. MSIDBERROR_BADREGPATH = 19, // bad registry path string
  96. MSIDBERROR_BADCUSTOMSOURCE = 20, // bad string in CustomSource column of CustomAction table
  97. MSIDBERROR_BADPROPERTY = 21, // bad property string
  98. MSIDBERROR_MISSINGDATA = 22, // _Validation table missing reference to column
  99. MSIDBERROR_BADCATEGORY = 23, // Category column of _Validation table for column is invalid
  100. MSIDBERROR_BADKEYTABLE = 24, // table in KeyTable column of _Validation table could not be found/loaded
  101. MSIDBERROR_BADMAXMINVALUES = 25, // value in MaxValue column of _Validation table is less than value in MinValue column
  102. MSIDBERROR_BADCABINET = 26, // bad cabinet name
  103. MSIDBERROR_BADSHORTCUT = 27, // bad shortcut target
  104. MSIDBERROR_STRINGOVERFLOW = 28, // string overflow (greater than length allowed in column def)
  105. MSIDBERROR_BADLOCALIZEATTRIB = 29 // invalid localization attribute (primary keys cannot be localized)
  106. } MSIDBERROR;
  107. typedef enum tagMSIRUNMODE
  108. {
  109. MSIRUNMODE_ADMIN = 0, // admin mode install, else product install
  110. MSIRUNMODE_ADVERTISE = 1, // installing advertisements, else installing or updating product
  111. MSIRUNMODE_MAINTENANCE = 2, // modifying an existing installation, else new installation
  112. MSIRUNMODE_ROLLBACKENABLED = 3, // rollback is enabled
  113. MSIRUNMODE_LOGENABLED = 4, // log file active, enabled prior to install session
  114. MSIRUNMODE_OPERATIONS = 5, // spooling execute operations, else in determination phase
  115. MSIRUNMODE_REBOOTATEND = 6, // reboot needed after successful installation (settable)
  116. MSIRUNMODE_REBOOTNOW = 7, // reboot needed to continue installation (settable)
  117. MSIRUNMODE_CABINET = 8, // installing files from cabinets and files using Media table
  118. MSIRUNMODE_SOURCESHORTNAMES= 9, // source LongFileNames suppressed via PID_MSISOURCE summary property
  119. MSIRUNMODE_TARGETSHORTNAMES= 10, // target LongFileNames suppressed via SHORTFILENAMES property
  120. MSIRUNMODE_RESERVED11 = 11, // future use
  121. MSIRUNMODE_WINDOWS9X = 12, // operating systems is Windows9?, else Windows NT
  122. MSIRUNMODE_ZAWENABLED = 13, // operating system supports demand installation
  123. MSIRUNMODE_RESERVED14 = 14, // future use
  124. MSIRUNMODE_RESERVED15 = 15, // future use
  125. MSIRUNMODE_SCHEDULED = 16, // custom action call from install script execution
  126. MSIRUNMODE_ROLLBACK = 17, // custom action call from rollback execution script
  127. MSIRUNMODE_COMMIT = 18, // custom action call from commit execution script
  128. } MSIRUNMODE;
  129. #define INSTALLMESSAGE_TYPEMASK = 0xFF000000L // mask for type code
  130. // Note: INSTALLMESSAGE_ERROR, INSTALLMESSAGE_WARNING, INSTALLMESSAGE_USER are to or'd
  131. // with a message box style to indicate the buttons to display and return:
  132. // MB_OK,MB_OKCANCEL,MB_ABORTRETRYIGNORE,MB_YESNOCANCEL,MB_YESNO,MB_RETRYCANCEL
  133. // the default button (MB_DEFBUTTON1 is normal default):
  134. // MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3
  135. // and optionally an icon style:
  136. // MB_ICONERROR, MB_ICONQUESTION, MB_ICONWARNING, MB_ICONINFORMATION
  137. typedef enum tagMSITRANSFORM_ERROR
  138. {
  139. MSITRANSFORM_ERROR_ADDEXISTINGROW = 0x00000001,
  140. MSITRANSFORM_ERROR_DELMISSINGROW = 0x00000002,
  141. MSITRANSFORM_ERROR_ADDEXISTINGTABLE = 0x00000004,
  142. MSITRANSFORM_ERROR_DELMISSINGTABLE = 0x00000008,
  143. MSITRANSFORM_ERROR_UPDATEMISSINGROW = 0x00000010,
  144. MSITRANSFORM_ERROR_CHANGECODEPAGE = 0x00000020,
  145. MSITRANSFORM_ERROR_VIEWTRANSFORM = 0x00000100,
  146. } MSITRANSFORM_ERROR;
  147. typedef enum tagMSITRANSFORM_VALIDATE
  148. {
  149. MSITRANSFORM_VALIDATE_LANGUAGE = 0x00000001,
  150. MSITRANSFORM_VALIDATE_PRODUCT = 0x00000002,
  151. MSITRANSFORM_VALIDATE_PLATFORM = 0x00000004,
  152. MSITRANSFORM_VALIDATE_MAJORVERSION = 0x00000008,
  153. MSITRANSFORM_VALIDATE_MINORVERSION = 0x00000010,
  154. MSITRANSFORM_VALIDATE_UPDATEVERSION = 0x00000020,
  155. MSITRANSFORM_VALIDATE_NEWLESSBASEVERSION = 0x00000040,
  156. MSITRANSFORM_VALIDATE_NEWLESSEQUALBASEVERSION = 0x00000080,
  157. MSITRANSFORM_VALIDATE_NEWEQUALBASEVERSION = 0x00000100,
  158. MSITRANSFORM_VALIDATE_NEWGREATEREQUALBASEVERSION = 0x00000200,
  159. MSITRANSFORM_VALIDATE_NEWGREATERBASEVERSION = 0x00000400,
  160. MSITRANSFORM_VALIDATE_UPGRADECODE = 0x00000800,
  161. } MSITRANSFORM_VALIDATE;
  162. #ifdef __cplusplus
  163. extern "C" {
  164. #endif
  165. // --------------------------------------------------------------------------
  166. // Installer database access functions
  167. // --------------------------------------------------------------------------
  168. // Prepare a database query, creating a view object
  169. // Returns ERROR_SUCCESS if successful, and the view handle is returned,
  170. // else ERROR_INVALID_HANDLE, ERROR_INVALID_HANDLE_STATE, ERROR_BAD_QUERY_SYNTAX, ERROR_GEN_FAILURE
  171. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  172. UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hDatabase,
  173. LPCSTR szQuery, // SQL query to be prepared
  174. MSIHANDLE* phView); // returned view if TRUE
  175. UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hDatabase,
  176. LPCWSTR szQuery, // SQL query to be prepared
  177. MSIHANDLE* phView); // returned view if TRUE
  178. #ifdef UNICODE
  179. #define MsiDatabaseOpenView MsiDatabaseOpenViewW
  180. #else
  181. #define MsiDatabaseOpenView MsiDatabaseOpenViewA
  182. #endif // !UNICODE
  183. // Returns the MSIDBERROR enum and name of the column corresponding to the error
  184. // Similar to a GetLastError function, but for the view. NOT the same as MsiGetLastErrorRecord
  185. // Returns errors of MsiViewModify.
  186. MSIDBERROR WINAPI MsiViewGetErrorA(MSIHANDLE hView,
  187. LPSTR szColumnNameBuffer, // buffer to hold column name
  188. DWORD* pcchBuf); // size of buffer
  189. MSIDBERROR WINAPI MsiViewGetErrorW(MSIHANDLE hView,
  190. LPWSTR szColumnNameBuffer, // buffer to hold column name
  191. DWORD* pcchBuf); // size of buffer
  192. #ifdef UNICODE
  193. #define MsiViewGetError MsiViewGetErrorW
  194. #else
  195. #define MsiViewGetError MsiViewGetErrorA
  196. #endif // !UNICODE
  197. // Exectute the view query, supplying parameters as required
  198. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_HANDLE_STATE, ERROR_GEN_FAILURE
  199. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  200. UINT WINAPI MsiViewExecute(MSIHANDLE hView,
  201. MSIHANDLE hRecord); // optional parameter record, or 0 if none
  202. // Fetch the next sequential record from the view
  203. // Result is ERROR_SUCCESS if a row is found, and its handle is returned
  204. // else ERROR_NO_MORE_ITEMS if no records remain, and a null handle is returned
  205. // else result is error: ERROR_INVALID_HANDLE_STATE, ERROR_INVALID_HANDLE, ERROR_GEN_FAILURE
  206. UINT WINAPI MsiViewFetch(MSIHANDLE hView,
  207. MSIHANDLE *phRecord); // returned data record if fetch succeeds
  208. // Modify a database record, parameters must match types in query columns
  209. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_HANDLE_STATE, ERROR_GEN_FAILURE, ERROR_ACCESS_DENIED
  210. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  211. UINT WINAPI MsiViewModify(MSIHANDLE hView,
  212. MSIMODIFY eModifyMode, // modify action to perform
  213. MSIHANDLE hRecord); // record obtained from fetch, or new record
  214. // Return the column names or specifications for the current view
  215. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_PARAMETER, or ERROR_INVALID_HANDLE_STATE
  216. UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView,
  217. MSICOLINFO eColumnInfo, // retrieve columns names or definitions
  218. MSIHANDLE *phRecord); // returned data record containing all names or definitions
  219. // Release the result set for an executed view, to allow re-execution
  220. // Only needs to be called if not all records have been fetched
  221. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_HANDLE_STATE
  222. UINT WINAPI MsiViewClose(MSIHANDLE hView);
  223. // Return a record containing the names of all primary key columns for a given table
  224. // Returns an MSIHANDLE for a record containing the name of each column.
  225. // The field count of the record corresponds to the number of primary key columns.
  226. // Field [0] of the record contains the table name.
  227. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_TABLE
  228. UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hDatabase,
  229. LPCSTR szTableName, // the name of a specific table <case-sensitive>
  230. MSIHANDLE *phRecord); // returned record if ERROR_SUCCESS
  231. UINT WINAPI MsiDatabaseGetPrimaryKeysW(MSIHANDLE hDatabase,
  232. LPCWSTR szTableName, // the name of a specific table <case-sensitive>
  233. MSIHANDLE *phRecord); // returned record if ERROR_SUCCESS
  234. #ifdef UNICODE
  235. #define MsiDatabaseGetPrimaryKeys MsiDatabaseGetPrimaryKeysW
  236. #else
  237. #define MsiDatabaseGetPrimaryKeys MsiDatabaseGetPrimaryKeysA
  238. #endif // !UNICODE
  239. // Return an enum defining the state of the table (temporary, unknown, or persistent).
  240. // Returns MSICONDITION_ERROR, MSICONDITION_FALSE, MSICONDITION_TRUE, MSICONDITION_NONE
  241. MSICONDITION WINAPI MsiDatabaseIsTablePersistentA(MSIHANDLE hDatabase,
  242. LPCSTR szTableName); // the name of a specific table
  243. MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(MSIHANDLE hDatabase,
  244. LPCWSTR szTableName); // the name of a specific table
  245. #ifdef UNICODE
  246. #define MsiDatabaseIsTablePersistent MsiDatabaseIsTablePersistentW
  247. #else
  248. #define MsiDatabaseIsTablePersistent MsiDatabaseIsTablePersistentA
  249. #endif // !UNICODE
  250. // --------------------------------------------------------------------------
  251. // Summary information stream management functions
  252. // --------------------------------------------------------------------------
  253. // Integer Property IDs: 1, 14, 15, 16, 19
  254. // DateTime Property IDs: 10, 11, 12, 13
  255. // Text Property IDs: 2, 3, 4, 5, 6, 7, 8, 9, 18
  256. // Unsupported Propery IDs: 0 (PID_DICTIONARY), 17 (PID_THUMBNAIL)
  257. // Obtain a handle for the _SummaryInformation stream for an MSI database
  258. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  259. UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase, // 0 if not open
  260. LPCSTR szDatabasePath, // path to database, 0 if database handle supplied
  261. UINT uiUpdateCount, // maximium number of updated values, 0 to open read-only
  262. MSIHANDLE *phSummaryInfo); // returned handle to summary information data
  263. UINT WINAPI MsiGetSummaryInformationW(MSIHANDLE hDatabase, // 0 if not open
  264. LPCWSTR szDatabasePath, // path to database, 0 if database handle supplied
  265. UINT uiUpdateCount, // maximium number of updated values, 0 to open read-only
  266. MSIHANDLE *phSummaryInfo); // returned handle to summary information data
  267. #ifdef UNICODE
  268. #define MsiGetSummaryInformation MsiGetSummaryInformationW
  269. #else
  270. #define MsiGetSummaryInformation MsiGetSummaryInformationA
  271. #endif // !UNICODE
  272. // Obtain the number of existing properties in the SummaryInformation stream
  273. UINT WINAPI MsiSummaryInfoGetPropertyCount(MSIHANDLE hSummaryInfo,
  274. UINT *puiPropertyCount); // pointer to location to return total property count
  275. // Set a single summary information property
  276. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_UNKNOWN_PROPERTY
  277. UINT WINAPI MsiSummaryInfoSetPropertyA(MSIHANDLE hSummaryInfo,
  278. UINT uiProperty, // property ID, one of allowed values for summary information
  279. UINT uiDataType, // VT_I4, VT_LPSTR, VT_FILETIME, or VT_EMPTY
  280. INT iValue, // integer value, used only if integer property
  281. FILETIME *pftValue, // pointer to filetime value, used only if datetime property
  282. LPCSTR szValue); // text value, used only if string property
  283. UINT WINAPI MsiSummaryInfoSetPropertyW(MSIHANDLE hSummaryInfo,
  284. UINT uiProperty, // property ID, one of allowed values for summary information
  285. UINT uiDataType, // VT_I4, VT_LPSTR, VT_FILETIME, or VT_EMPTY
  286. INT iValue, // integer value, used only if integer property
  287. FILETIME *pftValue, // pointer to filetime value, used only if datetime property
  288. LPCWSTR szValue); // text value, used only if string property
  289. #ifdef UNICODE
  290. #define MsiSummaryInfoSetProperty MsiSummaryInfoSetPropertyW
  291. #else
  292. #define MsiSummaryInfoSetProperty MsiSummaryInfoSetPropertyA
  293. #endif // !UNICODE
  294. // Get a single property from the summary information
  295. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_UNKNOWN_PROPERTY
  296. UINT WINAPI MsiSummaryInfoGetPropertyA(MSIHANDLE hSummaryInfo,
  297. UINT uiProperty, // property ID, one of allowed values for summary information
  298. UINT *puiDataType, // returned type: VT_I4, VT_LPSTR, VT_FILETIME, VT_EMPTY
  299. INT *piValue, // returned integer property data
  300. FILETIME *pftValue, // returned datetime property data
  301. LPSTR szValueBuf, // buffer to return string property data
  302. DWORD *pcchValueBuf); // in/out buffer character count
  303. UINT WINAPI MsiSummaryInfoGetPropertyW(MSIHANDLE hSummaryInfo,
  304. UINT uiProperty, // property ID, one of allowed values for summary information
  305. UINT *puiDataType, // returned type: VT_I4, VT_LPSTR, VT_FILETIME, VT_EMPTY
  306. INT *piValue, // returned integer property data
  307. FILETIME *pftValue, // returned datetime property data
  308. LPWSTR szValueBuf, // buffer to return string property data
  309. DWORD *pcchValueBuf); // in/out buffer character count
  310. #ifdef UNICODE
  311. #define MsiSummaryInfoGetProperty MsiSummaryInfoGetPropertyW
  312. #else
  313. #define MsiSummaryInfoGetProperty MsiSummaryInfoGetPropertyA
  314. #endif // !UNICODE
  315. // Write back changed information to summary information stream
  316. UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE hSummaryInfo);
  317. // --------------------------------------------------------------------------
  318. // Installer database management functions - not used by custom actions
  319. // --------------------------------------------------------------------------
  320. // Open an installer database, specifying the persistance mode, which is a pointer.
  321. // Predefined persist values are reserved pointer values, requiring pointer arithmetic.
  322. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  323. UINT WINAPI MsiOpenDatabaseA(
  324. LPCSTR szDatabasePath, // path to database, 0 to create temporary database
  325. LPCSTR szPersist, // output database path or one of predefined values
  326. MSIHANDLE* phDatabase); // location to return database handle
  327. UINT WINAPI MsiOpenDatabaseW(
  328. LPCWSTR szDatabasePath, // path to database, 0 to create temporary database
  329. LPCWSTR szPersist, // output database path or one of predefined values
  330. MSIHANDLE* phDatabase); // location to return database handle
  331. #ifdef UNICODE
  332. #define MsiOpenDatabase MsiOpenDatabaseW
  333. #else
  334. #define MsiOpenDatabase MsiOpenDatabaseA
  335. #endif // !UNICODE
  336. // Import an MSI text archive table into an open database
  337. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  338. UINT WINAPI MsiDatabaseImportA(MSIHANDLE hDatabase,
  339. LPCSTR szFolderPath, // folder containing archive files
  340. LPCSTR szFileName); // table archive file to be imported
  341. UINT WINAPI MsiDatabaseImportW(MSIHANDLE hDatabase,
  342. LPCWSTR szFolderPath, // folder containing archive files
  343. LPCWSTR szFileName); // table archive file to be imported
  344. #ifdef UNICODE
  345. #define MsiDatabaseImport MsiDatabaseImportW
  346. #else
  347. #define MsiDatabaseImport MsiDatabaseImportA
  348. #endif // !UNICODE
  349. // Export an MSI table from an open database to a text archive file
  350. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  351. UINT WINAPI MsiDatabaseExportA(MSIHANDLE hDatabase,
  352. LPCSTR szTableName, // name of table in database <case-sensitive>
  353. LPCSTR szFolderPath, // folder containing archive files
  354. LPCSTR szFileName); // name of exported table archive file
  355. UINT WINAPI MsiDatabaseExportW(MSIHANDLE hDatabase,
  356. LPCWSTR szTableName, // name of table in database <case-sensitive>
  357. LPCWSTR szFolderPath, // folder containing archive files
  358. LPCWSTR szFileName); // name of exported table archive file
  359. #ifdef UNICODE
  360. #define MsiDatabaseExport MsiDatabaseExportW
  361. #else
  362. #define MsiDatabaseExport MsiDatabaseExportA
  363. #endif // !UNICODE
  364. // Merge two database together, allowing duplicate rows
  365. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  366. UINT WINAPI MsiDatabaseMergeA(MSIHANDLE hDatabase,
  367. MSIHANDLE hDatabaseMerge, // database to be merged into hDatabase
  368. LPCSTR szTableName); // name of non-persistent table to receive errors
  369. UINT WINAPI MsiDatabaseMergeW(MSIHANDLE hDatabase,
  370. MSIHANDLE hDatabaseMerge, // database to be merged into hDatabase
  371. LPCWSTR szTableName); // name of non-persistent table to receive errors
  372. #ifdef UNICODE
  373. #define MsiDatabaseMerge MsiDatabaseMergeW
  374. #else
  375. #define MsiDatabaseMerge MsiDatabaseMergeA
  376. #endif // !UNICODE
  377. // Generate a transform file of differences between two databases
  378. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  379. UINT WINAPI MsiDatabaseGenerateTransformA(MSIHANDLE hDatabase,
  380. MSIHANDLE hDatabaseReference, // base database to reference changes
  381. LPCSTR szTransformFile, // name of generated transform file
  382. int iReserved1, // reserved argument, not used
  383. int iReserved2); // reserved argument, not used
  384. UINT WINAPI MsiDatabaseGenerateTransformW(MSIHANDLE hDatabase,
  385. MSIHANDLE hDatabaseReference, // base database to reference changes
  386. LPCWSTR szTransformFile, // name of generated transform file
  387. int iReserved1, // reserved argument, not used
  388. int iReserved2); // reserved argument, not used
  389. #ifdef UNICODE
  390. #define MsiDatabaseGenerateTransform MsiDatabaseGenerateTransformW
  391. #else
  392. #define MsiDatabaseGenerateTransform MsiDatabaseGenerateTransformA
  393. #endif // !UNICODE
  394. // Apply a transform file containing database difference
  395. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  396. UINT WINAPI MsiDatabaseApplyTransformA(MSIHANDLE hDatabase,
  397. LPCSTR szTransformFile, // name of transform file
  398. int iErrorConditions); // errors to suppress, bits from MSITRANSFORM_ERROR
  399. UINT WINAPI MsiDatabaseApplyTransformW(MSIHANDLE hDatabase,
  400. LPCWSTR szTransformFile, // name of transform file
  401. int iErrorConditions); // errors to suppress, bits from MSITRANSFORM_ERROR
  402. #ifdef UNICODE
  403. #define MsiDatabaseApplyTransform MsiDatabaseApplyTransformW
  404. #else
  405. #define MsiDatabaseApplyTransform MsiDatabaseApplyTransformA
  406. #endif // !UNICODE
  407. // Create summary information of existing transform to include validation and error conditions
  408. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  409. UINT WINAPI MsiCreateTransformSummaryInfoA(MSIHANDLE hDatabase,
  410. MSIHANDLE hDatabaseReference, // base database to reference changes
  411. LPCSTR szTransformFile, // name of generated transform file
  412. int iErrorConditions, // errors to suppress when applied, from MSITRANSFORM_ERROR
  413. int iValidation); // properties validated when applied, MSITRANSFORM_VALIDATE
  414. UINT WINAPI MsiCreateTransformSummaryInfoW(MSIHANDLE hDatabase,
  415. MSIHANDLE hDatabaseReference, // base database to reference changes
  416. LPCWSTR szTransformFile, // name of generated transform file
  417. int iErrorConditions, // errors to suppress when applied, from MSITRANSFORM_ERROR
  418. int iValidation); // properties validated when applied, MSITRANSFORM_VALIDATE
  419. #ifdef UNICODE
  420. #define MsiCreateTransformSummaryInfo MsiCreateTransformSummaryInfoW
  421. #else
  422. #define MsiCreateTransformSummaryInfo MsiCreateTransformSummaryInfoA
  423. #endif // !UNICODE
  424. // Write out all persistent table data, ignored if database opened read-only
  425. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  426. UINT WINAPI MsiDatabaseCommit(MSIHANDLE hDatabase);
  427. // Return the update state of a database
  428. MSIDBSTATE WINAPI MsiGetDatabaseState(MSIHANDLE hDatabase);
  429. // --------------------------------------------------------------------------
  430. // Record object functions
  431. // --------------------------------------------------------------------------
  432. // Create a new record object with the requested number of fields
  433. // Field 0, not included in count, is used for format strings and op codes
  434. // All fields are initialized to null
  435. // Returns a handle to the created record, or 0 if memory could not be allocated
  436. MSIHANDLE WINAPI MsiCreateRecord(
  437. UINT cParams); // the number of data fields
  438. // Report whether a record field is NULL
  439. // Returns TRUE if the field is null or does not exist
  440. // Returns FALSE if the field contains data, or the handle is invalid
  441. BOOL WINAPI MsiRecordIsNull(MSIHANDLE hRecord,
  442. UINT iField);
  443. // Return the length of a record field
  444. // Returns 0 if field is NULL or non-existent
  445. // Returns sizeof(int) if integer data
  446. // Returns character count if string data (not counting null terminator)
  447. // Returns bytes count if stream data
  448. UINT WINAPI MsiRecordDataSize(MSIHANDLE hRecord,
  449. UINT iField);
  450. // Set a record field to an integer value
  451. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD
  452. UINT WINAPI MsiRecordSetInteger(MSIHANDLE hRecord,
  453. UINT iField,
  454. int iValue);
  455. // Copy a string into the designated field
  456. // A null string pointer and an empty string both set the field to null
  457. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD
  458. UINT WINAPI MsiRecordSetStringA(MSIHANDLE hRecord,
  459. UINT iField,
  460. LPCSTR szValue);
  461. UINT WINAPI MsiRecordSetStringW(MSIHANDLE hRecord,
  462. UINT iField,
  463. LPCWSTR szValue);
  464. #ifdef UNICODE
  465. #define MsiRecordSetString MsiRecordSetStringW
  466. #else
  467. #define MsiRecordSetString MsiRecordSetStringA
  468. #endif // !UNICODE
  469. // Return the integer value from a record field
  470. // Returns the value MSI_NULL_INTEGER if the field is null
  471. // or if the field is a string that cannot be converted to an integer
  472. int WINAPI MsiRecordGetInteger(MSIHANDLE hRecord,
  473. UINT iField);
  474. // Return the string value of a record field
  475. // Integer fields will be converted to a string
  476. // Null and non-existent fields will report a value of 0
  477. // Fields containing stream data will return ERROR_INVALID_DATATYPE
  478. // Returns ERROR_SUCCESS, ERROR_MORE_DATA,
  479. // ERROR_INVALID_HANDLE, ERROR_INVALID_FIELD, ERROR_BAD_ARGUMENTS
  480. UINT WINAPI MsiRecordGetStringA(MSIHANDLE hRecord,
  481. UINT iField,
  482. LPSTR szValueBuf, // buffer for returned value
  483. DWORD *pcchValueBuf); // in/out buffer character count
  484. UINT WINAPI MsiRecordGetStringW(MSIHANDLE hRecord,
  485. UINT iField,
  486. LPWSTR szValueBuf, // buffer for returned value
  487. DWORD *pcchValueBuf); // in/out buffer character count
  488. #ifdef UNICODE
  489. #define MsiRecordGetString MsiRecordGetStringW
  490. #else
  491. #define MsiRecordGetString MsiRecordGetStringA
  492. #endif // !UNICODE
  493. // Returns the number of fields allocated in the record
  494. // Does not count field 0, used for formatting and op codes
  495. UINT WINAPI MsiRecordGetFieldCount(MSIHANDLE hRecord);
  496. // Set a record stream field from a file
  497. // The contents of the specified file will be read into a stream object
  498. // The stream will be persisted if the record is inserted into the database
  499. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  500. UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord,
  501. UINT iField,
  502. LPCSTR szFilePath); // path to file containing stream data
  503. UINT WINAPI MsiRecordSetStreamW(MSIHANDLE hRecord,
  504. UINT iField,
  505. LPCWSTR szFilePath); // path to file containing stream data
  506. #ifdef UNICODE
  507. #define MsiRecordSetStream MsiRecordSetStreamW
  508. #else
  509. #define MsiRecordSetStream MsiRecordSetStreamA
  510. #endif // !UNICODE
  511. // Read bytes from a record stream field into a buffer
  512. // Must set the in/out argument to the requested byte count to read
  513. // The number of bytes transferred is returned through the argument
  514. // If no more bytes are available, ERROR_SUCCESS is still returned
  515. UINT WINAPI MsiRecordReadStream(MSIHANDLE hRecord,
  516. UINT iField,
  517. char *szDataBuf, // buffer to receive bytes from stream
  518. DWORD *pcbDataBuf); // in/out buffer byte count
  519. // Clears all data fields in a record to NULL
  520. UINT WINAPI MsiRecordClearData(MSIHANDLE hRecord);
  521. // --------------------------------------------------------------------------
  522. // Functions to access a running installation, called from custom actions
  523. // The install handle is the single argument passed to custom actions
  524. // --------------------------------------------------------------------------
  525. // Return a handle to the database currently in use by this installer instance
  526. MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall); // returns handle to database, 0 if none active
  527. // Set the value for an installer property
  528. // If the property is not defined, it will be created
  529. // If the value is null or an empty string, the property will be removed
  530. // Returns ERROR_SUCCESS, ERROR_INVALID_HANDLE, ERROR_BAD_ARGUMENTS
  531. UINT WINAPI MsiSetPropertyA(MSIHANDLE hInstall,
  532. LPCSTR szName, // property identifier, case-sensitive
  533. LPCSTR szValue); // property value, null to undefine property
  534. UINT WINAPI MsiSetPropertyW(MSIHANDLE hInstall,
  535. LPCWSTR szName, // property identifier, case-sensitive
  536. LPCWSTR szValue); // property value, null to undefine property
  537. #ifdef UNICODE
  538. #define MsiSetProperty MsiSetPropertyW
  539. #else
  540. #define MsiSetProperty MsiSetPropertyA
  541. #endif // !UNICODE
  542. // Get the value for an installer property
  543. // If the property is not defined, it is equivalent to a 0-length value, not error
  544. // Returns ERROR_SUCCESS, ERROR_MORE_DATA, ERROR_INVALID_HANDLE, ERROR_BAD_ARGUMENTS
  545. UINT WINAPI MsiGetPropertyA(MSIHANDLE hInstall,
  546. LPCSTR szName, // property identifier, case-sensitive
  547. LPSTR szValueBuf, // buffer for returned property value
  548. DWORD *pcchValueBuf); // in/out buffer character count
  549. UINT WINAPI MsiGetPropertyW(MSIHANDLE hInstall,
  550. LPCWSTR szName, // property identifier, case-sensitive
  551. LPWSTR szValueBuf, // buffer for returned property value
  552. DWORD *pcchValueBuf); // in/out buffer character count
  553. #ifdef UNICODE
  554. #define MsiGetProperty MsiGetPropertyW
  555. #else
  556. #define MsiGetProperty MsiGetPropertyA
  557. #endif // !UNICODE
  558. // Return the numeric language for the currently running install
  559. // Returns 0 if an install not running
  560. LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall);
  561. // Return one of the boolean internal installer states
  562. // Returns FALSE if the handle is not active or if the mode is not implemented
  563. BOOL WINAPI MsiGetMode(MSIHANDLE hInstall,
  564. MSIRUNMODE eRunMode); // particular mode for which the state is returned
  565. // Set an internal install session boolean mode - Note: most modes are read-only
  566. // Returns ERROR_SUCCESS if the mode can be set to the desired state
  567. // Returns ERROR_ACCESS_DENIED if the mode is not settable
  568. // Returns ERROR_INVALID_HANDLE if the handle is not an active install session
  569. UINT WINAPI MsiSetMode(MSIHANDLE hInstall,
  570. MSIRUNMODE eRunMode, // particular mode for which state is to be set
  571. BOOL fState); // new state for bit flag
  572. // Format record data using a format string containing field markers and/or properties
  573. // Record field 0 must contain the format string
  574. // Other fields must contain data that may be referenced by the format string.
  575. UINT WINAPI MsiFormatRecordA(MSIHANDLE hInstall, // non-zero for property expansion
  576. MSIHANDLE hRecord, // handle to record, field 0 contains format string
  577. LPSTR szResultBuf, // buffer to return formatted string
  578. DWORD *pcchResultBuf); // in/out buffer character count
  579. UINT WINAPI MsiFormatRecordW(MSIHANDLE hInstall, // non-zero for property expansion
  580. MSIHANDLE hRecord, // handle to record, field 0 contains format string
  581. LPWSTR szResultBuf, // buffer to return formatted string
  582. DWORD *pcchResultBuf); // in/out buffer character count
  583. #ifdef UNICODE
  584. #define MsiFormatRecord MsiFormatRecordW
  585. #else
  586. #define MsiFormatRecord MsiFormatRecordA
  587. #endif // !UNICODE
  588. // Execute another action, either built-in, custom, or UI wizard
  589. // Returns ERROR_FUNCTION_NOT_CALLED if action not found
  590. // Returns ERROR_SUCCESS if action completed succesfully
  591. // Returns ERROR_INSTALL_USEREXIT if user cancelled during action
  592. // Returns ERROR_INSTALL_FAILURE if action failed
  593. // Returns ERROR_INSTALL_SUSPEND if user suspended installation
  594. // Returns ERROR_MORE_DATA if action wishes to skip remaining actions
  595. // Returns ERROR_INVALID_HANDLE_STATE if install session not active
  596. // Returns ERROR_INVALID_DATA if failure calling custom action
  597. // Returns ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER if arguments invalid
  598. UINT WINAPI MsiDoActionA(MSIHANDLE hInstall,
  599. LPCSTR szAction); // name of action to call, case-sensitive
  600. UINT WINAPI MsiDoActionW(MSIHANDLE hInstall,
  601. LPCWSTR szAction); // name of action to call, case-sensitive
  602. #ifdef UNICODE
  603. #define MsiDoAction MsiDoActionW
  604. #else
  605. #define MsiDoAction MsiDoActionA
  606. #endif // !UNICODE
  607. // Execute another action sequence, as descibed in the specified table
  608. // Returns the same error codes as MsiDoAction
  609. UINT WINAPI MsiSequenceA(MSIHANDLE hInstall,
  610. LPCSTR szTable, // name of table containing action sequence
  611. INT iSequenceMode); // for future use, must be 0 in MSI 1.0
  612. UINT WINAPI MsiSequenceW(MSIHANDLE hInstall,
  613. LPCWSTR szTable, // name of table containing action sequence
  614. INT iSequenceMode); // for future use, must be 0 in MSI 1.0
  615. #ifdef UNICODE
  616. #define MsiSequence MsiSequenceW
  617. #else
  618. #define MsiSequence MsiSequenceA
  619. #endif // !UNICODE
  620. // Send an error record to the installer for processing.
  621. // If field 0 (template) is not set, field 1 must be set to the error code,
  622. // corresponding the the error message in the Error database table,
  623. // and the message will be formatted using the template from the Error table
  624. // before passing it to the UI handler for display.
  625. // Returns Win32 button codes: IDOK IDCANCEL IDABORT IDRETRY IDIGNORE IDYES IDNO
  626. // or 0 if no action taken, or -1 if invalid argument or handle
  627. int WINAPI MsiProcessMessage(MSIHANDLE hInstall,
  628. INSTALLMESSAGE eMessageType, // type of message
  629. MSIHANDLE hRecord); // record containing message format and data
  630. // Evaluate a conditional expression containing property names and values
  631. MSICONDITION WINAPI MsiEvaluateConditionA(MSIHANDLE hInstall,
  632. LPCSTR szCondition);
  633. MSICONDITION WINAPI MsiEvaluateConditionW(MSIHANDLE hInstall,
  634. LPCWSTR szCondition);
  635. #ifdef UNICODE
  636. #define MsiEvaluateCondition MsiEvaluateConditionW
  637. #else
  638. #define MsiEvaluateCondition MsiEvaluateConditionA
  639. #endif // !UNICODE
  640. // Get the installed state and requested action state of a feature
  641. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  642. UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall,
  643. LPCSTR szFeature, // feature name within product
  644. INSTALLSTATE *piInstalled, // returned current install state
  645. INSTALLSTATE *piAction); // action taken during install session
  646. UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall,
  647. LPCWSTR szFeature, // feature name within product
  648. INSTALLSTATE *piInstalled, // returned current install state
  649. INSTALLSTATE *piAction); // action taken during install session
  650. #ifdef UNICODE
  651. #define MsiGetFeatureState MsiGetFeatureStateW
  652. #else
  653. #define MsiGetFeatureState MsiGetFeatureStateA
  654. #endif // !UNICODE
  655. // Request a feature to be set to a specified state
  656. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  657. UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall,
  658. LPCSTR szFeature, // feature name within product
  659. INSTALLSTATE iState); // requested state for feature
  660. UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall,
  661. LPCWSTR szFeature, // feature name within product
  662. INSTALLSTATE iState); // requested state for feature
  663. #ifdef UNICODE
  664. #define MsiSetFeatureState MsiSetFeatureStateW
  665. #else
  666. #define MsiSetFeatureState MsiSetFeatureStateA
  667. #endif // !UNICODE
  668. #if (_WIN32_MSI >= 110)
  669. // Set the attribute bits of a specified feature at runtime.
  670. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  671. UINT WINAPI MsiSetFeatureAttributesA(MSIHANDLE hInstall,
  672. LPCSTR szFeature, // feature name within product
  673. DWORD dwAttributes); // attributes bits to set for this feature
  674. UINT WINAPI MsiSetFeatureAttributesW(MSIHANDLE hInstall,
  675. LPCWSTR szFeature, // feature name within product
  676. DWORD dwAttributes); // attributes bits to set for this feature
  677. #ifdef UNICODE
  678. #define MsiSetFeatureAttributes MsiSetFeatureAttributesW
  679. #else
  680. #define MsiSetFeatureAttributes MsiSetFeatureAttributesA
  681. #endif // !UNICODE
  682. #endif //(_WIN32_MSI >= 110)
  683. // Get the installed state and requested action state of a component
  684. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  685. UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall,
  686. LPCSTR szComponent, // component name within product
  687. INSTALLSTATE *piInstalled, // returned current install state
  688. INSTALLSTATE *piAction); // action taken during install session
  689. UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall,
  690. LPCWSTR szComponent, // component name within product
  691. INSTALLSTATE *piInstalled, // returned current install state
  692. INSTALLSTATE *piAction); // action taken during install session
  693. #ifdef UNICODE
  694. #define MsiGetComponentState MsiGetComponentStateW
  695. #else
  696. #define MsiGetComponentState MsiGetComponentStateA
  697. #endif // !UNICODE
  698. // Request a component to be set to a specified state
  699. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  700. UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall,
  701. LPCSTR szComponent, // component name within product
  702. INSTALLSTATE iState); // requested state for component
  703. UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall,
  704. LPCWSTR szComponent, // component name within product
  705. INSTALLSTATE iState); // requested state for component
  706. #ifdef UNICODE
  707. #define MsiSetComponentState MsiSetComponentStateW
  708. #else
  709. #define MsiSetComponentState MsiSetComponentStateA
  710. #endif // !UNICODE
  711. // Return the disk cost for a feature and related features
  712. // Can specify either current feature state or proposed state
  713. // Can specify extent of related features to cost
  714. // Note that adding costs for several features may produce an
  715. // excessively large cost due to shared components and parents.
  716. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  717. UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall,
  718. LPCSTR szFeature, // name of feature
  719. MSICOSTTREE iCostTree, // portion of tree to cost
  720. INSTALLSTATE iState, // requested state, or INSTALLSTATE_UNKNOWN
  721. INT *piCost); // returned cost, in units of 512 bytes
  722. UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall,
  723. LPCWSTR szFeature, // name of feature
  724. MSICOSTTREE iCostTree, // portion of tree to cost
  725. INSTALLSTATE iState, // requested state, or INSTALLSTATE_UNKNOWN
  726. INT *piCost); // returned cost, in units of 512 bytes
  727. #ifdef UNICODE
  728. #define MsiGetFeatureCost MsiGetFeatureCostW
  729. #else
  730. #define MsiGetFeatureCost MsiGetFeatureCostA
  731. #endif // !UNICODE
  732. #if (_WIN32_MSI >= 150)
  733. // Enumerates the costs and temporary costs per drives for
  734. // szComponent. If szComponent is set to NULL, it enumerates
  735. // the above costs for the engine, per drives.
  736. //
  737. // The enumeration is 0-based, i.e. it returns the data for
  738. // the first drive when called w/ dwIndex set to 0.
  739. //
  740. // Can specify either current feature state or proposed state.
  741. //
  742. // Execution of this function sets the error record, accessible
  743. // via MsiGetLastErrorRecord.
  744. UINT WINAPI MsiEnumComponentCostsA(MSIHANDLE hInstall,
  745. LPCSTR szComponent, // name of component
  746. DWORD dwIndex, // 0-based index into the list of drives
  747. INSTALLSTATE iState, // requested state, or INSTALLSTATE_UNKNOWN
  748. LPSTR szDriveBuf, // buffer for returned value
  749. DWORD *pcchDriveBuf, // in/out buffer character count
  750. INT *piCost, // returned cost, in units of 512 bytes
  751. INT *piTempCost); // returned temporary cost, in units of 512 bytes
  752. UINT WINAPI MsiEnumComponentCostsW(MSIHANDLE hInstall,
  753. LPCWSTR szComponent, // name of component
  754. DWORD dwIndex, // 0-based index into the list of drives
  755. INSTALLSTATE iState, // requested state, or INSTALLSTATE_UNKNOWN
  756. LPWSTR szDriveBuf, // buffer for returned value
  757. DWORD *pcchDriveBuf, // in/out buffer character count
  758. INT *piCost, // returned cost, in units of 512 bytes
  759. INT *piTempCost); // returned temporary cost, in units of 512 bytes
  760. #ifdef UNICODE
  761. #define MsiEnumComponentCosts MsiEnumComponentCostsW
  762. #else
  763. #define MsiEnumComponentCosts MsiEnumComponentCostsA
  764. #endif // !UNICODE
  765. #endif // (_WIN32_MSI >= 150)
  766. // Set the install level for a full product installation (not a feature request)
  767. // Setting the value to 0 initialized components and features to the default level
  768. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  769. UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall,
  770. int iInstallLevel);
  771. // Get the valid install states for a feature, represented by bit flags
  772. // For each valid install state, a bit is set of value: (1 << INSTALLSTATE)
  773. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  774. UINT WINAPI MsiGetFeatureValidStatesA(MSIHANDLE hInstall,
  775. LPCSTR szFeature,
  776. DWORD *dwInstallStates);
  777. UINT WINAPI MsiGetFeatureValidStatesW(MSIHANDLE hInstall,
  778. LPCWSTR szFeature,
  779. DWORD *dwInstallStates);
  780. #ifdef UNICODE
  781. #define MsiGetFeatureValidStates MsiGetFeatureValidStatesW
  782. #else
  783. #define MsiGetFeatureValidStates MsiGetFeatureValidStatesA
  784. #endif // !UNICODE
  785. // Return the full source path for a folder in the Directory table
  786. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  787. UINT WINAPI MsiGetSourcePathA(MSIHANDLE hInstall,
  788. LPCSTR szFolder, // folder identifier, primary key into Directory table
  789. LPSTR szPathBuf, // buffer to return full path
  790. DWORD *pcchPathBuf); // in/out buffer character count
  791. UINT WINAPI MsiGetSourcePathW(MSIHANDLE hInstall,
  792. LPCWSTR szFolder, // folder identifier, primary key into Directory table
  793. LPWSTR szPathBuf, // buffer to return full path
  794. DWORD *pcchPathBuf); // in/out buffer character count
  795. #ifdef UNICODE
  796. #define MsiGetSourcePath MsiGetSourcePathW
  797. #else
  798. #define MsiGetSourcePath MsiGetSourcePathA
  799. #endif // !UNICODE
  800. // Return the full target path for a folder in the Directory table
  801. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  802. UINT WINAPI MsiGetTargetPathA(MSIHANDLE hInstall,
  803. LPCSTR szFolder, // folder identifier, primary key into Directory table
  804. LPSTR szPathBuf, // buffer to return full path
  805. DWORD *pcchPathBuf); // in/out buffer character count
  806. UINT WINAPI MsiGetTargetPathW(MSIHANDLE hInstall,
  807. LPCWSTR szFolder, // folder identifier, primary key into Directory table
  808. LPWSTR szPathBuf, // buffer to return full path
  809. DWORD *pcchPathBuf); // in/out buffer character count
  810. #ifdef UNICODE
  811. #define MsiGetTargetPath MsiGetTargetPathW
  812. #else
  813. #define MsiGetTargetPath MsiGetTargetPathA
  814. #endif // !UNICODE
  815. // Set the full target path for a folder in the Directory table
  816. // Execution of this function sets the error record, accessible via MsiGetLastErrorRecord
  817. UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall,
  818. LPCSTR szFolder, // folder identifier, primary key into Directory table
  819. LPCSTR szFolderPath); // full path for folder, ending in directory separator
  820. UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall,
  821. LPCWSTR szFolder, // folder identifier, primary key into Directory table
  822. LPCWSTR szFolderPath); // full path for folder, ending in directory separator
  823. #ifdef UNICODE
  824. #define MsiSetTargetPath MsiSetTargetPathW
  825. #else
  826. #define MsiSetTargetPath MsiSetTargetPathA
  827. #endif // !UNICODE
  828. // Check to see if sufficent disk space is present for the current installation
  829. // Returns ERROR_SUCCESS, ERROR_DISK_FULL, ERROR_INVALID_HANDLE_STATE, or ERROR_INVALID_HANDLE
  830. UINT WINAPI MsiVerifyDiskSpace(MSIHANDLE hInstall);
  831. // --------------------------------------------------------------------------
  832. // Functions for rendering UI dialogs from the database representations.
  833. // Purpose is for product development, not for use during installation.
  834. // --------------------------------------------------------------------------
  835. // Enable UI in preview mode to facilitate authoring of UI dialogs.
  836. // The preview mode will end when the handle is closed.
  837. UINT WINAPI MsiEnableUIPreview(MSIHANDLE hDatabase,
  838. MSIHANDLE* phPreview); // returned handle for UI preview capability
  839. // Display any UI dialog as modeless and inactive.
  840. // Supplying a null name will remove any current dialog.
  841. UINT WINAPI MsiPreviewDialogA(MSIHANDLE hPreview,
  842. LPCSTR szDialogName); // dialog to display, Dialog table key
  843. UINT WINAPI MsiPreviewDialogW(MSIHANDLE hPreview,
  844. LPCWSTR szDialogName); // dialog to display, Dialog table key
  845. #ifdef UNICODE
  846. #define MsiPreviewDialog MsiPreviewDialogW
  847. #else
  848. #define MsiPreviewDialog MsiPreviewDialogA
  849. #endif // !UNICODE
  850. // Display a billboard within a host control in the displayed dialog.
  851. // Supplying a null billboard name will remove any billboard displayed.
  852. UINT WINAPI MsiPreviewBillboardA(MSIHANDLE hPreview,
  853. LPCSTR szControlName, // name of control that accepts billboards
  854. LPCSTR szBillboard); // name of billboard to display
  855. UINT WINAPI MsiPreviewBillboardW(MSIHANDLE hPreview,
  856. LPCWSTR szControlName, // name of control that accepts billboards
  857. LPCWSTR szBillboard); // name of billboard to display
  858. #ifdef UNICODE
  859. #define MsiPreviewBillboard MsiPreviewBillboardW
  860. #else
  861. #define MsiPreviewBillboard MsiPreviewBillboardA
  862. #endif // !UNICODE
  863. // --------------------------------------------------------------------------
  864. // Error handling not associated with any particular object
  865. // --------------------------------------------------------------------------
  866. // Return a record handle to the last function that generated an error record
  867. // Only specified functions will set the error record, or clear it if success
  868. // Field 1 of the record will contain the internal MSI error code
  869. // Other fields will contain data specific to the particular error
  870. // The error record is released internally after this function is executed
  871. MSIHANDLE WINAPI MsiGetLastErrorRecord(); // returns 0 if no cached record
  872. #ifdef __cplusplus
  873. }
  874. #endif
  875. #endif // _MSIQUERY_H_