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