home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 June / Chip_2001-06_cd1.bin / zkuste / vbasic / Data / Utility / MSISDK15.msi / MsiQuery.h < prev    next >
C/C++ Source or Header  |  2000-10-30  |  50KB  |  1,030 lines

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