home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / devtools / files / borland_ccompiler55.exe / Include / msi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-27  |  52.9 KB  |  1,158 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * msi.h - - Interface for external access to Installer Service                *
  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. *                                                                             *
  10. * Copyright (c) 1999, Microsoft Corp.      All rights reserved.               *
  11. *                                                                             *
  12. \*****************************************************************************/
  13.  
  14. #ifndef _MSI_H_
  15. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  16. #define _MSI_H_
  17.  
  18. #ifndef _WIN32_MSI
  19. #if (_WIN32_WINNT >= 0x0500)
  20. #define _WIN32_MSI   110
  21. #else
  22. #define _WIN32_MSI   100
  23. #endif //(_WIN32_WINNT >= 0x0500)
  24. #endif // !_WIN32_MSI
  25.  
  26. // --------------------------------------------------------------------------
  27. // Installer generic handle definitions
  28. // --------------------------------------------------------------------------
  29.  
  30. typedef unsigned long MSIHANDLE;     // abstract generic handle, 0 == no handle
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. // Close a open handle of any type
  37. // All handles obtained from API calls must be closed when no longer needed
  38. // Normally succeeds, returning TRUE. 
  39.  
  40. UINT WINAPI MsiCloseHandle(MSIHANDLE hAny);
  41.  
  42. // Close all handles open in the process, a diagnostic call
  43. // This should NOT be used as a cleanup mechanism -- use PMSIHANDLE class
  44. // Can be called at termination to assure that all handles have been closed
  45. // Returns 0 if all handles have been close, else number of open handles
  46.  
  47. UINT WINAPI MsiCloseAllHandles();
  48.  
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52.  
  53. #ifdef __cplusplus
  54.  
  55. // C++ wrapper object to automatically free handle when going out of scope
  56.  
  57. class PMSIHANDLE
  58. {
  59.     MSIHANDLE m_h;
  60.  public:
  61.     PMSIHANDLE():m_h(0){}
  62.     PMSIHANDLE(MSIHANDLE h):m_h(h){}
  63.   ~PMSIHANDLE(){if (m_h!=0) MsiCloseHandle(m_h);}
  64.     void operator =(MSIHANDLE h) {if (m_h) MsiCloseHandle(m_h); m_h=h;}
  65.     operator MSIHANDLE() {return m_h;}
  66.     MSIHANDLE* operator &() {if (m_h) MsiCloseHandle(m_h); m_h = 0; return &m_h;}
  67. };
  68. #endif  //__cplusplus
  69.  
  70. // Install message type for callback is a combination of the following:
  71. //  A message box style:      MB_*, where MB_OK is the default
  72. //  A message box icon type:  MB_ICON*, where no icon is the default
  73. //  A default button:         MB_DEFBUTTON?, where MB_DEFBUTTON1 is the default
  74. //  One of the following install message types, no default
  75. typedef enum tagINSTALLMESSAGE
  76. {
  77.     INSTALLMESSAGE_FATALEXIT      = 0x00000000L, // premature termination, possibly fatal OOM
  78.     INSTALLMESSAGE_ERROR          = 0x01000000L, // formatted error message
  79.     INSTALLMESSAGE_WARNING        = 0x02000000L, // formatted warning message
  80.     INSTALLMESSAGE_USER           = 0x03000000L, // user request message
  81.     INSTALLMESSAGE_INFO           = 0x04000000L, // informative message for log
  82.     INSTALLMESSAGE_FILESINUSE     = 0x05000000L, // list of files in use that need to be replaced
  83.     INSTALLMESSAGE_RESOLVESOURCE  = 0x06000000L, // request to determine a valid source location
  84.     INSTALLMESSAGE_OUTOFDISKSPACE = 0x07000000L, // insufficient disk space message
  85.     INSTALLMESSAGE_ACTIONSTART    = 0x08000000L, // start of action: action name & description
  86.     INSTALLMESSAGE_ACTIONDATA     = 0x09000000L, // formatted data associated with individual action item
  87.     INSTALLMESSAGE_PROGRESS       = 0x0A000000L, // progress gauge info: units so far, total
  88.     INSTALLMESSAGE_COMMONDATA     = 0x0B000000L, // product info for dialog: language Id, dialog caption
  89.     INSTALLMESSAGE_INITIALIZE     = 0x0C000000L, // sent prior to UI initialization, no string data
  90.     INSTALLMESSAGE_TERMINATE      = 0x0D000000L, // sent after UI termination, no string data
  91.     INSTALLMESSAGE_SHOWDIALOG     = 0x0E000000L, // sent prior to display or authored dialog or wizard
  92. } INSTALLMESSAGE;
  93.  
  94. // external error handler supplied to installation API functions
  95. typedef int (WINAPI *INSTALLUI_HANDLERA)(LPVOID pvContext, UINT iMessageType, LPCSTR szMessage);
  96. // external error handler supplied to installation API functions
  97. typedef int (WINAPI *INSTALLUI_HANDLERW)(LPVOID pvContext, UINT iMessageType, LPCWSTR szMessage);
  98. #ifdef UNICODE
  99. #define INSTALLUI_HANDLER  INSTALLUI_HANDLERW
  100. #else
  101. #define INSTALLUI_HANDLER  INSTALLUI_HANDLERA
  102. #endif // !UNICODE
  103.  
  104. typedef enum tagINSTALLUILEVEL
  105. {
  106.     INSTALLUILEVEL_NOCHANGE = 0,    // UI level is unchanged
  107.     INSTALLUILEVEL_DEFAULT  = 1,    // default UI is used
  108.     INSTALLUILEVEL_NONE     = 2,    // completely silent installation
  109.     INSTALLUILEVEL_BASIC    = 3,    // simple progress and error handling
  110.     INSTALLUILEVEL_REDUCED  = 4,    // authored UI, wizard dialogs suppressed
  111.     INSTALLUILEVEL_FULL     = 5,    // authored UI with wizards, progress, errors
  112.     INSTALLUILEVEL_ENDDIALOG    = 0x80, // display success/failure dialog at end of install
  113.     INSTALLUILEVEL_PROGRESSONLY = 0x40, // display only progress dialog
  114. } INSTALLUILEVEL;
  115.  
  116. typedef enum tagINSTALLSTATE
  117. {
  118.     INSTALLSTATE_NOTUSED      = -7,  // component disabled
  119.     INSTALLSTATE_BADCONFIG    = -6,  // configuration data corrupt
  120.     INSTALLSTATE_INCOMPLETE   = -5,  // installation suspended or in progress
  121.     INSTALLSTATE_SOURCEABSENT = -4,  // run from source, source is unavailable
  122.     INSTALLSTATE_MOREDATA     = -3,  // return buffer overflow
  123.     INSTALLSTATE_INVALIDARG   = -2,  // invalid function argument
  124.     INSTALLSTATE_UNKNOWN      = -1,  // unrecognized product or feature
  125.     INSTALLSTATE_BROKEN       =  0,  // broken
  126.     INSTALLSTATE_ADVERTISED   =  1,  // advertised feature
  127.     INSTALLSTATE_REMOVED      =  1,  // component being removed (action state, not settable)
  128.     INSTALLSTATE_ABSENT       =  2,  // uninstalled (or action state absent but clients remain)
  129.     INSTALLSTATE_LOCAL        =  3,  // installed on local drive
  130.     INSTALLSTATE_SOURCE       =  4,  // run from source, CD or net
  131.     INSTALLSTATE_DEFAULT      =  5,  // use default, local or source
  132. } INSTALLSTATE;
  133.  
  134. typedef enum tagUSERINFOSTATE
  135. {
  136.     USERINFOSTATE_MOREDATA   = -3,  // return buffer overflow
  137.     USERINFOSTATE_INVALIDARG = -2,  // invalid function argument
  138.     USERINFOSTATE_UNKNOWN    = -1,  // unrecognized product
  139.     USERINFOSTATE_ABSENT     =  0,  // user info and PID not initialized
  140.     USERINFOSTATE_PRESENT    =  1,  // user info and PID initialized
  141. } USERINFOSTATE;
  142.  
  143. typedef enum tagINSTALLLEVEL
  144. {
  145.     INSTALLLEVEL_DEFAULT = 0,      // install authored default
  146.     INSTALLLEVEL_MINIMUM = 1,      // install only required features
  147.     INSTALLLEVEL_MAXIMUM = 0xFFFF, // install all features
  148. } INSTALLLEVEL;                   // intermediate levels dependent on authoring
  149.  
  150. typedef enum tagREINSTALLMODE  // bit flags
  151. {
  152.     REINSTALLMODE_REPAIR           = 0x00000001,  // Reserved bit - currently ignored
  153.     REINSTALLMODE_FILEMISSING      = 0x00000002,  // Reinstall only if file is missing
  154.     REINSTALLMODE_FILEOLDERVERSION = 0x00000004,  // Reinstall if file is missing, or older version
  155.     REINSTALLMODE_FILEEQUALVERSION = 0x00000008,  // Reinstall if file is missing, or equal or older version
  156.     REINSTALLMODE_FILEEXACT        = 0x00000010,  // Reinstall if file is missing, or not exact version
  157.     REINSTALLMODE_FILEVERIFY       = 0x00000020,  // checksum executables, reinstall if missing or corrupt
  158.     REINSTALLMODE_FILEREPLACE      = 0x00000040,  // Reinstall all files, regardless of version
  159.     REINSTALLMODE_MACHINEDATA      = 0x00000080,  // insure required machine reg entries
  160.     REINSTALLMODE_USERDATA         = 0x00000100,  // insure required user reg entries
  161.     REINSTALLMODE_SHORTCUT         = 0x00000200,  // validate shortcuts items
  162.     REINSTALLMODE_PACKAGE          = 0x00000400,  // use re-cache source install package
  163. } REINSTALLMODE;
  164.  
  165. typedef enum tagINSTALLOGMODE  // bit flags for use with MsiEnableLog and MsiSetExternalUI
  166. {
  167.     INSTALLLOGMODE_FATALEXIT      = (1 << (INSTALLMESSAGE_FATALEXIT      >> 24)),
  168.     INSTALLLOGMODE_ERROR          = (1 << (INSTALLMESSAGE_ERROR          >> 24)),
  169.     INSTALLLOGMODE_WARNING        = (1 << (INSTALLMESSAGE_WARNING        >> 24)),
  170.     INSTALLLOGMODE_USER           = (1 << (INSTALLMESSAGE_USER           >> 24)),
  171.     INSTALLLOGMODE_INFO           = (1 << (INSTALLMESSAGE_INFO           >> 24)),
  172.     INSTALLLOGMODE_RESOLVESOURCE  = (1 << (INSTALLMESSAGE_RESOLVESOURCE  >> 24)),
  173.     INSTALLLOGMODE_OUTOFDISKSPACE = (1 << (INSTALLMESSAGE_OUTOFDISKSPACE >> 24)),
  174.     INSTALLLOGMODE_ACTIONSTART    = (1 << (INSTALLMESSAGE_ACTIONSTART    >> 24)),
  175.     INSTALLLOGMODE_ACTIONDATA     = (1 << (INSTALLMESSAGE_ACTIONDATA     >> 24)),
  176.     INSTALLLOGMODE_COMMONDATA     = (1 << (INSTALLMESSAGE_COMMONDATA     >> 24)),
  177.     INSTALLLOGMODE_PROPERTYDUMP   = (1 << (INSTALLMESSAGE_PROGRESS       >> 24)), // log only
  178.     INSTALLLOGMODE_VERBOSE        = (1 << (INSTALLMESSAGE_INITIALIZE     >> 24)), // log only
  179.     INSTALLLOGMODE_PROGRESS       = (1 << (INSTALLMESSAGE_PROGRESS       >> 24)), // external handler only
  180.     INSTALLLOGMODE_INITIALIZE     = (1 << (INSTALLMESSAGE_INITIALIZE     >> 24)), // external handler only
  181.     INSTALLLOGMODE_TERMINATE      = (1 << (INSTALLMESSAGE_TERMINATE      >> 24)), // external handler only
  182.     INSTALLLOGMODE_SHOWDIALOG     = (1 << (INSTALLMESSAGE_SHOWDIALOG     >> 24)), // external handler only
  183. } INSTALLLOGMODE;
  184.  
  185. typedef enum tagINSTALLLOGATTRIBUTES // flag attributes for MsiEnableLog
  186. {
  187.     INSTALLLOGATTRIBUTES_APPEND            = (1 << 0),
  188.     INSTALLLOGATTRIBUTES_FLUSHEACHLINE     = (1 << 1),
  189. } INSTALLLOGATTRIBUTES;
  190.  
  191. typedef enum tagINSTALLFEATUREATTRIBUTE // bit flags
  192. {
  193.     INSTALLFEATUREATTRIBUTE_FAVORLOCAL             = 1 << 0,
  194.     INSTALLFEATUREATTRIBUTE_FAVORSOURCE            = 1 << 1,
  195.     INSTALLFEATUREATTRIBUTE_FOLLOWPARENT           = 1 << 2,
  196.     INSTALLFEATUREATTRIBUTE_FAVORADVERTISE         = 1 << 3,
  197.     INSTALLFEATUREATTRIBUTE_DISALLOWADVERTISE      = 1 << 4,
  198.     INSTALLFEATUREATTRIBUTE_NOUNSUPPORTEDADVERTISE = 1 << 5,
  199. } INSTALLFEATUREATTRIBUTE;
  200.  
  201. typedef enum tagINSTALLMODE
  202. {
  203.     INSTALLMODE_NOSOURCERESOLUTION   = -3,  // skip source resolution
  204.     INSTALLMODE_NODETECTION          = -2,  // skip detection
  205.     INSTALLMODE_EXISTING             = -1,  // provide, if available
  206.     INSTALLMODE_DEFAULT              =  0,  // install, if absent
  207. } INSTALLMODE;
  208.  
  209. #define MAX_FEATURE_CHARS  38   // maximum chars in feature name (same as string GUID)
  210.  
  211.  
  212. // Product info attributes: advertised information
  213.  
  214. #define INSTALLPROPERTY_TRANSFORMS            __TEXT("Transforms")
  215. #define INSTALLPROPERTY_LANGUAGE              __TEXT("Language")
  216. #define INSTALLPROPERTY_PRODUCTNAME           __TEXT("ProductName")
  217. #define INSTALLPROPERTY_ASSIGNMENTTYPE        __TEXT("AssignmentType")
  218. #define INSTALLPROPERTY_PACKAGECODE           __TEXT("PackageCode")
  219. #define INSTALLPROPERTY_VERSION               __TEXT("Version")
  220. #if (_WIN32_MSI >=  110)
  221. #define INSTALLPROPERTY_PRODUCTICON           __TEXT("ProductIcon")
  222. #endif //(_WIN32_MSI >=  110)
  223.  
  224. // Product info attributes: installed information
  225.  
  226. #define INSTALLPROPERTY_INSTALLEDPRODUCTNAME  __TEXT("InstalledProductName")
  227. #define INSTALLPROPERTY_VERSIONSTRING         __TEXT("VersionString")
  228. #define INSTALLPROPERTY_HELPLINK              __TEXT("HelpLink")
  229. #define INSTALLPROPERTY_HELPTELEPHONE         __TEXT("HelpTelephone")
  230. #define INSTALLPROPERTY_INSTALLLOCATION       __TEXT("InstallLocation")
  231. #define INSTALLPROPERTY_INSTALLSOURCE         __TEXT("InstallSource")
  232. #define INSTALLPROPERTY_INSTALLDATE           __TEXT("InstallDate")
  233. #define INSTALLPROPERTY_PUBLISHER             __TEXT("Publisher")
  234. #define INSTALLPROPERTY_LOCALPACKAGE          __TEXT("LocalPackage")
  235. #define INSTALLPROPERTY_URLINFOABOUT          __TEXT("URLInfoAbout")
  236. #define INSTALLPROPERTY_URLUPDATEINFO         __TEXT("URLUpdateInfo")
  237. #define INSTALLPROPERTY_VERSIONMINOR          __TEXT("VersionMinor")
  238. #define INSTALLPROPERTY_VERSIONMAJOR          __TEXT("VersionMajor")
  239.  
  240.  
  241. typedef enum tagINSTALLTYPE
  242. {
  243.     INSTALLTYPE_DEFAULT            =    0,   // set to indicate default behavior
  244.     INSTALLTYPE_NETWORK_IMAGE      =    1,   // set to indicate network install
  245. }INSTALLTYPE;
  246.  
  247. #ifdef __cplusplus
  248. extern "C" {
  249. #endif
  250.  
  251. // --------------------------------------------------------------------------
  252. // Functions to set the UI handling and logging. The UI will be used for error,
  253. // progress, and log messages for all subsequent calls to Installer Service
  254. // API functions that require UI.
  255. // --------------------------------------------------------------------------
  256.  
  257. // Enable internal UI
  258.  
  259. INSTALLUILEVEL WINAPI MsiSetInternalUI(
  260.     INSTALLUILEVEL  dwUILevel,     // UI level
  261.     HWND  *phWnd);                   // handle of owner window
  262.  
  263. // Enable external UI handling, returns any previous handler or NULL if none.
  264. // Messages are designated with a combination of bits from INSTALLLOGMODE enum.
  265.  
  266. INSTALLUI_HANDLERA WINAPI MsiSetExternalUIA(
  267.     INSTALLUI_HANDLERA puiHandler,   // for progress and error handling 
  268.     DWORD              dwMessageFilter, // bit flags designating messages to handle
  269.     LPVOID             pvContext);   // application context
  270. INSTALLUI_HANDLERW WINAPI MsiSetExternalUIW(
  271.     INSTALLUI_HANDLERW puiHandler,   // for progress and error handling 
  272.     DWORD              dwMessageFilter, // bit flags designating messages to handle
  273.     LPVOID             pvContext);   // application context
  274. #ifdef UNICODE
  275. #define MsiSetExternalUI  MsiSetExternalUIW
  276. #else
  277. #define MsiSetExternalUI  MsiSetExternalUIA
  278. #endif // !UNICODE
  279.  
  280.  
  281. // Enable logging to a file for all install sessions for the client process,
  282. // with control over which log messages are passed to the specified log file.
  283. // Messages are designated with a combination of bits from INSTALLLOGMODE enum.
  284.  
  285. UINT WINAPI MsiEnableLogA(
  286.     DWORD     dwLogMode,           // bit flags designating operations to report
  287.     LPCSTR  szLogFile,           // log file, or NULL to disable logging
  288.     DWORD     dwLogAttributes);    // INSTALLLOGATTRIBUTES flags
  289. UINT WINAPI MsiEnableLogW(
  290.     DWORD     dwLogMode,           // bit flags designating operations to report
  291.     LPCWSTR  szLogFile,           // log file, or NULL to disable logging
  292.     DWORD     dwLogAttributes);    // INSTALLLOGATTRIBUTES flags
  293. #ifdef UNICODE
  294. #define MsiEnableLog  MsiEnableLogW
  295. #else
  296. #define MsiEnableLog  MsiEnableLogA
  297. #endif // !UNICODE
  298.  
  299. // --------------------------------------------------------------------------
  300. // Functions to query and configure a product as a whole.
  301. // A component descriptor string may be used instead of the product code.
  302. // --------------------------------------------------------------------------
  303.  
  304. // Return the installed state for a product
  305.  
  306. INSTALLSTATE WINAPI MsiQueryProductStateA(
  307.     LPCSTR  szProduct);
  308. INSTALLSTATE WINAPI MsiQueryProductStateW(
  309.     LPCWSTR  szProduct);
  310. #ifdef UNICODE
  311. #define MsiQueryProductState  MsiQueryProductStateW
  312. #else
  313. #define MsiQueryProductState  MsiQueryProductStateA
  314. #endif // !UNICODE
  315.  
  316. // Return product info
  317.  
  318. UINT WINAPI MsiGetProductInfoA(
  319.     LPCSTR   szProduct,      // product code, string GUID, or descriptor
  320.     LPCSTR   szAttribute,    // attribute name, case-sensitive
  321.     LPSTR    lpValueBuf,     // returned value, NULL if not desired
  322.     DWORD      *pcchValueBuf); // in/out buffer character count
  323. UINT WINAPI MsiGetProductInfoW(
  324.     LPCWSTR   szProduct,      // product code, string GUID, or descriptor
  325.     LPCWSTR   szAttribute,    // attribute name, case-sensitive
  326.     LPWSTR    lpValueBuf,     // returned value, NULL if not desired
  327.     DWORD      *pcchValueBuf); // in/out buffer character count
  328. #ifdef UNICODE
  329. #define MsiGetProductInfo  MsiGetProductInfoW
  330. #else
  331. #define MsiGetProductInfo  MsiGetProductInfoA
  332. #endif // !UNICODE
  333.  
  334. // Install a new product.
  335. // Either may be NULL, but the DATABASE property must be specfied
  336.  
  337. UINT WINAPI MsiInstallProductA(
  338.     LPCSTR      szPackagePath,    // location of package to install
  339.     LPCSTR      szCommandLine);   // command line <property settings>
  340. UINT WINAPI MsiInstallProductW(
  341.     LPCWSTR      szPackagePath,    // location of package to install
  342.     LPCWSTR      szCommandLine);   // command line <property settings>
  343. #ifdef UNICODE
  344. #define MsiInstallProduct  MsiInstallProductW
  345. #else
  346. #define MsiInstallProduct  MsiInstallProductA
  347. #endif // !UNICODE
  348.  
  349. // Install/uninstall an advertised or installed product
  350. // No action if installed and INSTALLSTATE_DEFAULT specified
  351.  
  352. UINT WINAPI MsiConfigureProductA(
  353.     LPCSTR      szProduct,        // product code OR descriptor
  354.     int          iInstallLevel,    // how much of the product to install
  355.     INSTALLSTATE eInstallState);   // local/source/default/absent/lock/uncache
  356. UINT WINAPI MsiConfigureProductW(
  357.     LPCWSTR      szProduct,        // product code OR descriptor
  358.     int          iInstallLevel,    // how much of the product to install
  359.     INSTALLSTATE eInstallState);   // local/source/default/absent/lock/uncache
  360. #ifdef UNICODE
  361. #define MsiConfigureProduct  MsiConfigureProductW
  362. #else
  363. #define MsiConfigureProduct  MsiConfigureProductA
  364. #endif // !UNICODE
  365.  
  366. // Install/uninstall an advertised or installed product
  367. // No action if installed and INSTALLSTATE_DEFAULT specified
  368.  
  369. UINT WINAPI MsiConfigureProductExA(
  370.     LPCSTR      szProduct,        // product code OR descriptor
  371.     int          iInstallLevel,    // how much of the product to install
  372.     INSTALLSTATE eInstallState,    // local/source/default/absent/lock/uncache
  373.     LPCSTR      szCommandLine);   // command line <property settings>
  374. UINT WINAPI MsiConfigureProductExW(
  375.     LPCWSTR      szProduct,        // product code OR descriptor
  376.     int          iInstallLevel,    // how much of the product to install
  377.     INSTALLSTATE eInstallState,    // local/source/default/absent/lock/uncache
  378.     LPCWSTR      szCommandLine);   // command line <property settings>
  379. #ifdef UNICODE
  380. #define MsiConfigureProductEx  MsiConfigureProductExW
  381. #else
  382. #define MsiConfigureProductEx  MsiConfigureProductExA
  383. #endif // !UNICODE
  384.  
  385. // Reinstall product, used to validate or correct problems
  386.  
  387. UINT WINAPI MsiReinstallProductA(
  388.     LPCSTR      szProduct,        // product code OR descriptor
  389.     DWORD         szReinstallMode); // one or more REINSTALLMODE modes
  390. UINT WINAPI MsiReinstallProductW(
  391.     LPCWSTR      szProduct,        // product code OR descriptor
  392.     DWORD         szReinstallMode); // one or more REINSTALLMODE modes
  393. #ifdef UNICODE
  394. #define MsiReinstallProduct  MsiReinstallProductW
  395. #else
  396. #define MsiReinstallProduct  MsiReinstallProductA
  397. #endif // !UNICODE
  398.  
  399.  
  400. // Return the product code for a registered component, called once by apps
  401.  
  402. UINT WINAPI MsiGetProductCodeA(
  403.     LPCSTR   szComponent,   // component Id registered for this product
  404.     LPSTR    lpBuf39);      // returned string GUID, sized for 39 characters
  405. UINT WINAPI MsiGetProductCodeW(
  406.     LPCWSTR   szComponent,   // component Id registered for this product
  407.     LPWSTR    lpBuf39);      // returned string GUID, sized for 39 characters
  408. #ifdef UNICODE
  409. #define MsiGetProductCode  MsiGetProductCodeW
  410. #else
  411. #define MsiGetProductCode  MsiGetProductCodeA
  412. #endif // !UNICODE
  413.  
  414. // Return the registered user information for an installed product
  415.  
  416. USERINFOSTATE WINAPI MsiGetUserInfoA(
  417.     LPCSTR  szProduct,        // product code, string GUID
  418.     LPSTR   lpUserNameBuf,    // return user name           
  419.     DWORD    *pcchUserNameBuf, // in/out buffer character count
  420.     LPSTR   lpOrgNameBuf,     // return company name           
  421.     DWORD    *pcchOrgNameBuf,  // in/out buffer character count
  422.     LPSTR   lpSerialBuf,      // return product serial number
  423.     DWORD    *pcchSerialBuf);  // in/out buffer character count
  424. USERINFOSTATE WINAPI MsiGetUserInfoW(
  425.     LPCWSTR  szProduct,        // product code, string GUID
  426.     LPWSTR   lpUserNameBuf,    // return user name           
  427.     DWORD    *pcchUserNameBuf, // in/out buffer character count
  428.     LPWSTR   lpOrgNameBuf,     // return company name           
  429.     DWORD    *pcchOrgNameBuf,  // in/out buffer character count
  430.     LPWSTR   lpSerialBuf,      // return product serial number
  431.     DWORD    *pcchSerialBuf);  // in/out buffer character count
  432. #ifdef UNICODE
  433. #define MsiGetUserInfo  MsiGetUserInfoW
  434. #else
  435. #define MsiGetUserInfo  MsiGetUserInfoA
  436. #endif // !UNICODE
  437.  
  438. // Obtain and store user info and PID from installation wizard (first run)
  439.  
  440. UINT WINAPI MsiCollectUserInfoA(
  441.     LPCSTR  szProduct);     // product code, string GUID
  442. UINT WINAPI MsiCollectUserInfoW(
  443.     LPCWSTR  szProduct);     // product code, string GUID
  444. #ifdef UNICODE
  445. #define MsiCollectUserInfo  MsiCollectUserInfoW
  446. #else
  447. #define MsiCollectUserInfo  MsiCollectUserInfoA
  448. #endif // !UNICODE
  449.  
  450. // --------------------------------------------------------------------------
  451. // Functions to patch existing products
  452. // --------------------------------------------------------------------------
  453.  
  454. // Patch all possible installed products.
  455.  
  456. UINT WINAPI MsiApplyPatchA(
  457.     LPCSTR      szPatchPackage,   // location of patch package
  458.     LPCSTR      szInstallPackage, // location of package for install to patch <optional>
  459.     INSTALLTYPE   eInstallType,     // type of install to patch
  460.     LPCSTR      szCommandLine);   // command line <property settings>
  461. UINT WINAPI MsiApplyPatchW(
  462.     LPCWSTR      szPatchPackage,   // location of patch package
  463.     LPCWSTR      szInstallPackage, // location of package for install to patch <optional>
  464.     INSTALLTYPE   eInstallType,     // type of install to patch
  465.     LPCWSTR      szCommandLine);   // command line <property settings>
  466. #ifdef UNICODE
  467. #define MsiApplyPatch  MsiApplyPatchW
  468. #else
  469. #define MsiApplyPatch  MsiApplyPatchA
  470. #endif // !UNICODE
  471.  
  472. // Return patch info
  473.  
  474. UINT WINAPI MsiGetPatchInfoA(
  475.     LPCSTR   szPatch,        // patch code
  476.     LPCSTR   szAttribute,    // attribute name, case-sensitive
  477.     LPSTR    lpValueBuf,     // returned value, NULL if not desired
  478.     DWORD      *pcchValueBuf); // in/out buffer character count
  479. UINT WINAPI MsiGetPatchInfoW(
  480.     LPCWSTR   szPatch,        // patch code
  481.     LPCWSTR   szAttribute,    // attribute name, case-sensitive
  482.     LPWSTR    lpValueBuf,     // returned value, NULL if not desired
  483.     DWORD      *pcchValueBuf); // in/out buffer character count
  484. #ifdef UNICODE
  485. #define MsiGetPatchInfo  MsiGetPatchInfoW
  486. #else
  487. #define MsiGetPatchInfo  MsiGetPatchInfoA
  488. #endif // !UNICODE
  489.  
  490. // Enumerate all patches for a product
  491.  
  492. UINT WINAPI MsiEnumPatchesA(
  493.     LPCSTR szProduct,
  494.     DWORD    iPatchIndex,
  495.     LPSTR  lpPatchBuf,
  496.     LPSTR  lpTransformsBuf,
  497.     DWORD    *pcchTransformsBuf);
  498. UINT WINAPI MsiEnumPatchesW(
  499.     LPCWSTR szProduct,
  500.     DWORD    iPatchIndex,
  501.     LPWSTR  lpPatchBuf,
  502.     LPWSTR  lpTransformsBuf,
  503.     DWORD    *pcchTransformsBuf);
  504. #ifdef UNICODE
  505. #define MsiEnumPatches  MsiEnumPatchesW
  506. #else
  507. #define MsiEnumPatches  MsiEnumPatchesA
  508. #endif // !UNICODE
  509.  
  510. // --------------------------------------------------------------------------
  511. // Functions to query and configure a feature within a product.
  512. // Separate wrapper functions are provided that accept a descriptor string.
  513. // --------------------------------------------------------------------------
  514.  
  515. // Return the installed state for a product feature
  516.  
  517. INSTALLSTATE WINAPI MsiQueryFeatureStateA(
  518.     LPCSTR  szProduct,
  519.     LPCSTR  szFeature);
  520. INSTALLSTATE WINAPI MsiQueryFeatureStateW(
  521.     LPCWSTR  szProduct,
  522.     LPCWSTR  szFeature);
  523. #ifdef UNICODE
  524. #define MsiQueryFeatureState  MsiQueryFeatureStateW
  525. #else
  526. #define MsiQueryFeatureState  MsiQueryFeatureStateA
  527. #endif // !UNICODE
  528.  
  529. // Indicate intent to use a product feature, increments usage count
  530. // Prompts for CD if not loaded, does not install feature
  531.  
  532. INSTALLSTATE WINAPI MsiUseFeatureA(
  533.     LPCSTR  szProduct,
  534.     LPCSTR  szFeature);
  535. INSTALLSTATE WINAPI MsiUseFeatureW(
  536.     LPCWSTR  szProduct,
  537.     LPCWSTR  szFeature);
  538. #ifdef UNICODE
  539. #define MsiUseFeature  MsiUseFeatureW
  540. #else
  541. #define MsiUseFeature  MsiUseFeatureA
  542. #endif // !UNICODE
  543.  
  544. // Indicate intent to use a product feature, increments usage count
  545. // Prompts for CD if not loaded, does not install feature
  546. // Allows for bypassing component detection where performance is critical
  547.  
  548. INSTALLSTATE WINAPI MsiUseFeatureExA(
  549.     LPCSTR  szProduct,          // product code
  550.     LPCSTR  szFeature,          // feature ID
  551.     DWORD     dwInstallMode,      // INSTALLMODE_NODETECTION, else 0
  552.     DWORD     dwReserved);        // reserved, must be 0
  553. INSTALLSTATE WINAPI MsiUseFeatureExW(
  554.     LPCWSTR  szProduct,          // product code
  555.     LPCWSTR  szFeature,          // feature ID
  556.     DWORD     dwInstallMode,      // INSTALLMODE_NODETECTION, else 0
  557.     DWORD     dwReserved);        // reserved, must be 0
  558. #ifdef UNICODE
  559. #define MsiUseFeatureEx  MsiUseFeatureExW
  560. #else
  561. #define MsiUseFeatureEx  MsiUseFeatureExA
  562. #endif // !UNICODE
  563.  
  564. // Return the usage metrics for a product feature
  565.  
  566. UINT WINAPI MsiGetFeatureUsageA(
  567.     LPCSTR      szProduct,        // product code
  568.     LPCSTR      szFeature,        // feature ID
  569.     DWORD        *pdwUseCount,     // returned use count
  570.     WORD         *pwDateUsed);     // last date used (DOS date format)
  571. UINT WINAPI MsiGetFeatureUsageW(
  572.     LPCWSTR      szProduct,        // product code
  573.     LPCWSTR      szFeature,        // feature ID
  574.     DWORD        *pdwUseCount,     // returned use count
  575.     WORD         *pwDateUsed);     // last date used (DOS date format)
  576. #ifdef UNICODE
  577. #define MsiGetFeatureUsage  MsiGetFeatureUsageW
  578. #else
  579. #define MsiGetFeatureUsage  MsiGetFeatureUsageA
  580. #endif // !UNICODE
  581.  
  582. // Force the installed state for a product feature
  583.  
  584. UINT WINAPI MsiConfigureFeatureA(
  585.     LPCSTR  szProduct,
  586.     LPCSTR  szFeature,
  587.     INSTALLSTATE eInstallState);   // local/source/default/absent/lock/uncache
  588. UINT WINAPI MsiConfigureFeatureW(
  589.     LPCWSTR  szProduct,
  590.     LPCWSTR  szFeature,
  591.     INSTALLSTATE eInstallState);   // local/source/default/absent/lock/uncache
  592. #ifdef UNICODE
  593. #define MsiConfigureFeature  MsiConfigureFeatureW
  594. #else
  595. #define MsiConfigureFeature  MsiConfigureFeatureA
  596. #endif // !UNICODE
  597.  
  598.  
  599. // Reinstall feature, used to validate or correct problems
  600.  
  601. UINT WINAPI MsiReinstallFeatureA(
  602.     LPCSTR      szProduct,        // product code
  603.     LPCSTR      szFeature,        // feature ID, NULL for entire product
  604.     DWORD         dwReinstallMode); // one or more REINSTALLMODE modes
  605. UINT WINAPI MsiReinstallFeatureW(
  606.     LPCWSTR      szProduct,        // product code
  607.     LPCWSTR      szFeature,        // feature ID, NULL for entire product
  608.     DWORD         dwReinstallMode); // one or more REINSTALLMODE modes
  609. #ifdef UNICODE
  610. #define MsiReinstallFeature  MsiReinstallFeatureW
  611. #else
  612. #define MsiReinstallFeature  MsiReinstallFeatureA
  613. #endif // !UNICODE
  614.  
  615. // --------------------------------------------------------------------------
  616. // Functions to return a path to a particular component.
  617. // The state of the feature being used should have been checked previously.
  618. // --------------------------------------------------------------------------
  619.  
  620. // Return full component path, performing any necessary installation
  621. // calls MsiQueryFeatureState to detect that all components are installed
  622. // then calls MsiConfigureFeature if any of its components are uninstalled
  623. // then calls MsiLocateComponent to obtain the path the its key file
  624.  
  625. UINT WINAPI MsiProvideComponentA(
  626.     LPCSTR     szProduct,    // product code in case install required
  627.     LPCSTR     szFeature,    // feature ID in case install required
  628.     LPCSTR     szComponent,  // component ID
  629.     DWORD        dwInstallMode,// either of type INSTALLMODE or a combination of the REINSTALLMODE flags
  630.     LPSTR      lpPathBuf,    // returned path, NULL if not desired
  631.     DWORD       *pcchPathBuf);// in/out buffer character count
  632. UINT WINAPI MsiProvideComponentW(
  633.     LPCWSTR     szProduct,    // product code in case install required
  634.     LPCWSTR     szFeature,    // feature ID in case install required
  635.     LPCWSTR     szComponent,  // component ID
  636.     DWORD        dwInstallMode,// either of type INSTALLMODE or a combination of the REINSTALLMODE flags
  637.     LPWSTR      lpPathBuf,    // returned path, NULL if not desired
  638.     DWORD       *pcchPathBuf);// in/out buffer character count
  639. #ifdef UNICODE
  640. #define MsiProvideComponent  MsiProvideComponentW
  641. #else
  642. #define MsiProvideComponent  MsiProvideComponentA
  643. #endif // !UNICODE
  644.  
  645. // For an advertised component that registers descriptor strings,
  646. // return full component path, performing any necessary installation.
  647. // Calls MsiProvideComponent to install and return the path.
  648.  
  649. UINT WINAPI MsiProvideQualifiedComponentA(
  650.     LPCSTR     szCategory,   // component category ID
  651.     LPCSTR     szQualifier,  // specifies which component to access
  652.     DWORD        dwInstallMode,// either of type INSTALLMODE or a combination of the REINSTALLMODE flags
  653.     LPSTR      lpPathBuf,    // returned path, NULL if not desired
  654.     DWORD       *pcchPathBuf); // in/out buffer character count
  655. UINT WINAPI MsiProvideQualifiedComponentW(
  656.     LPCWSTR     szCategory,   // component category ID
  657.     LPCWSTR     szQualifier,  // specifies which component to access
  658.     DWORD        dwInstallMode,// either of type INSTALLMODE or a combination of the REINSTALLMODE flags
  659.     LPWSTR      lpPathBuf,    // returned path, NULL if not desired
  660.     DWORD       *pcchPathBuf); // in/out buffer character count
  661. #ifdef UNICODE
  662. #define MsiProvideQualifiedComponent  MsiProvideQualifiedComponentW
  663. #else
  664. #define MsiProvideQualifiedComponent  MsiProvideQualifiedComponentA
  665. #endif // !UNICODE
  666.  
  667. // For an advertised component that registers descriptor strings,
  668. // return full component path, performing any necessary installation.
  669. // If the szProduct is NULL the works same as MsiProvideQualifiedComponent, 
  670. // else will look for the descriptor advertised by the particular product ONLY.
  671. // Calls MsiProvideComponent to install and return the path.
  672.  
  673. UINT WINAPI MsiProvideQualifiedComponentExA(
  674.     LPCSTR     szCategory,   // component category ID
  675.     LPCSTR     szQualifier,  // specifies which component to access
  676.     DWORD        dwInstallMode,// either of type INSTALLMODE or a combination of the REINSTALLMODE flags
  677.     LPCSTR     szProduct,    // the product code 
  678.     DWORD        dwUnused1,    // not used, must be zero
  679.     DWORD        dwUnused2,    // not used, must be zero
  680.     LPSTR      lpPathBuf,    // returned path, NULL if not desired
  681.     DWORD       *pcchPathBuf); // in/out buffer character count
  682. UINT WINAPI MsiProvideQualifiedComponentExW(
  683.     LPCWSTR     szCategory,   // component category ID
  684.     LPCWSTR     szQualifier,  // specifies which component to access
  685.     DWORD        dwInstallMode,// either of type INSTALLMODE or a combination of the REINSTALLMODE flags
  686.     LPCWSTR     szProduct,    // the product code 
  687.     DWORD        dwUnused1,    // not used, must be zero
  688.     DWORD        dwUnused2,    // not used, must be zero
  689.     LPWSTR      lpPathBuf,    // returned path, NULL if not desired
  690.     DWORD       *pcchPathBuf); // in/out buffer character count
  691. #ifdef UNICODE
  692. #define MsiProvideQualifiedComponentEx  MsiProvideQualifiedComponentExW
  693. #else
  694. #define MsiProvideQualifiedComponentEx  MsiProvideQualifiedComponentExA
  695. #endif // !UNICODE
  696.  
  697. // Return full path to an installed component
  698.  
  699. INSTALLSTATE WINAPI MsiGetComponentPathA(
  700.     LPCSTR   szProduct,   // product code for client product
  701.     LPCSTR   szComponent, // component Id, string GUID
  702.     LPSTR    lpPathBuf,   // returned path
  703.     DWORD     *pcchBuf);    // in/out buffer character count
  704. INSTALLSTATE WINAPI MsiGetComponentPathW(
  705.     LPCWSTR   szProduct,   // product code for client product
  706.     LPCWSTR   szComponent, // component Id, string GUID
  707.     LPWSTR    lpPathBuf,   // returned path
  708.     DWORD     *pcchBuf);    // in/out buffer character count
  709. #ifdef UNICODE
  710. #define MsiGetComponentPath  MsiGetComponentPathW
  711. #else
  712. #define MsiGetComponentPath  MsiGetComponentPathA
  713. #endif // !UNICODE
  714.  
  715.  
  716. // --------------------------------------------------------------------------
  717. // Functions to iterate registered products, features, and components.
  718. // As with reg keys, they accept a 0-based index into the enumeration.
  719. // --------------------------------------------------------------------------
  720.  
  721. // Enumerate the registered products, either installed or advertised
  722.  
  723. UINT WINAPI MsiEnumProductsA(
  724.     DWORD     iProductIndex,    // 0-based index into registered products
  725.     LPSTR   lpProductBuf);    // buffer of char count: 39 (size of string GUID)
  726. UINT WINAPI MsiEnumProductsW(
  727.     DWORD     iProductIndex,    // 0-based index into registered products
  728.     LPWSTR   lpProductBuf);    // buffer of char count: 39 (size of string GUID)
  729. #ifdef UNICODE
  730. #define MsiEnumProducts  MsiEnumProductsW
  731. #else
  732. #define MsiEnumProducts  MsiEnumProductsA
  733. #endif // !UNICODE
  734.  
  735. #if (_WIN32_MSI >=  110)
  736.  
  737. // Enumerate products with given upgrade code
  738.  
  739. UINT WINAPI MsiEnumRelatedProductsA(
  740.     LPCSTR  lpUpgradeCode,    // upgrade code of products to enumerate
  741.     DWORD     dwReserved,       // reserved, must be 0
  742.     DWORD     iProductIndex,    // 0-based index into registered products
  743.     LPSTR   lpProductBuf);    // buffer of char count: 39 (size of string GUID)
  744. UINT WINAPI MsiEnumRelatedProductsW(
  745.     LPCWSTR  lpUpgradeCode,    // upgrade code of products to enumerate
  746.     DWORD     dwReserved,       // reserved, must be 0
  747.     DWORD     iProductIndex,    // 0-based index into registered products
  748.     LPWSTR   lpProductBuf);    // buffer of char count: 39 (size of string GUID)
  749. #ifdef UNICODE
  750. #define MsiEnumRelatedProducts  MsiEnumRelatedProductsW
  751. #else
  752. #define MsiEnumRelatedProducts  MsiEnumRelatedProductsA
  753. #endif // !UNICODE
  754.  
  755. #endif //(_WIN32_MSI >=  110)
  756.  
  757. // Enumerate the advertised features for a given product.
  758. // If parent is not required, supplying NULL will improve performance.
  759.  
  760. UINT WINAPI MsiEnumFeaturesA(
  761.     LPCSTR  szProduct,
  762.     DWORD     iFeatureIndex,  // 0-based index into published features
  763.     LPSTR   lpFeatureBuf,   // feature name buffer,   size=MAX_FEATURE_CHARS+1
  764.     LPSTR   lpParentBuf);   // parent feature buffer, size=MAX_FEATURE_CHARS+1
  765. UINT WINAPI MsiEnumFeaturesW(
  766.     LPCWSTR  szProduct,
  767.     DWORD     iFeatureIndex,  // 0-based index into published features
  768.     LPWSTR   lpFeatureBuf,   // feature name buffer,   size=MAX_FEATURE_CHARS+1
  769.     LPWSTR   lpParentBuf);   // parent feature buffer, size=MAX_FEATURE_CHARS+1
  770. #ifdef UNICODE
  771. #define MsiEnumFeatures  MsiEnumFeaturesW
  772. #else
  773. #define MsiEnumFeatures  MsiEnumFeaturesA
  774. #endif // !UNICODE
  775.  
  776. // Enumerate the installed components for all products
  777.  
  778. UINT WINAPI MsiEnumComponentsA(
  779.     DWORD    iComponentIndex,  // 0-based index into installed components
  780.     LPSTR   lpComponentBuf);  // buffer of char count: 39 (size of string GUID)
  781. UINT WINAPI MsiEnumComponentsW(
  782.     DWORD    iComponentIndex,  // 0-based index into installed components
  783.     LPWSTR   lpComponentBuf);  // buffer of char count: 39 (size of string GUID)
  784. #ifdef UNICODE
  785. #define MsiEnumComponents  MsiEnumComponentsW
  786. #else
  787. #define MsiEnumComponents  MsiEnumComponentsA
  788. #endif // !UNICODE
  789.  
  790. // Enumerate the client products for a component
  791.  
  792. UINT WINAPI MsiEnumClientsA(
  793.     LPCSTR  szComponent,
  794.     DWORD     iProductIndex,    // 0-based index into client products
  795.     LPSTR   lpProductBuf);    // buffer of char count: 39 (size of string GUID)
  796. UINT WINAPI MsiEnumClientsW(
  797.     LPCWSTR  szComponent,
  798.     DWORD     iProductIndex,    // 0-based index into client products
  799.     LPWSTR   lpProductBuf);    // buffer of char count: 39 (size of string GUID)
  800. #ifdef UNICODE
  801. #define MsiEnumClients  MsiEnumClientsW
  802. #else
  803. #define MsiEnumClients  MsiEnumClientsA
  804. #endif // !UNICODE
  805.  
  806. // Enumerate the qualifiers for an advertised component.
  807.  
  808. UINT WINAPI MsiEnumComponentQualifiersA(
  809.     LPCSTR   szComponent,         // generic component ID that is qualified
  810.     DWORD     iIndex,               // 0-based index into qualifiers
  811.     LPSTR    lpQualifierBuf,      // qualifier buffer
  812.     DWORD     *pcchQualifierBuf,   // in/out qualifier buffer character count
  813.     LPSTR    lpApplicationDataBuf,    // description buffer
  814.     DWORD     *pcchApplicationDataBuf); // in/out description buffer character count
  815. UINT WINAPI MsiEnumComponentQualifiersW(
  816.     LPCWSTR   szComponent,         // generic component ID that is qualified
  817.     DWORD     iIndex,               // 0-based index into qualifiers
  818.     LPWSTR    lpQualifierBuf,      // qualifier buffer
  819.     DWORD     *pcchQualifierBuf,   // in/out qualifier buffer character count
  820.     LPWSTR    lpApplicationDataBuf,    // description buffer
  821.     DWORD     *pcchApplicationDataBuf); // in/out description buffer character count
  822. #ifdef UNICODE
  823. #define MsiEnumComponentQualifiers  MsiEnumComponentQualifiersW
  824. #else
  825. #define MsiEnumComponentQualifiers  MsiEnumComponentQualifiersA
  826. #endif // !UNICODE
  827.  
  828. // --------------------------------------------------------------------------
  829. // Functions to obtain product or package information.
  830. // --------------------------------------------------------------------------
  831.  
  832. // Open the installation for a product to obtain detailed information
  833.  
  834. UINT WINAPI MsiOpenProductA(
  835.     LPCSTR   szProduct,    // product code OR descriptor
  836.     MSIHANDLE  *hProduct);   // returned product handle, must be closed
  837. UINT WINAPI MsiOpenProductW(
  838.     LPCWSTR   szProduct,    // product code OR descriptor
  839.     MSIHANDLE  *hProduct);   // returned product handle, must be closed
  840. #ifdef UNICODE
  841. #define MsiOpenProduct  MsiOpenProductW
  842. #else
  843. #define MsiOpenProduct  MsiOpenProductA
  844. #endif // !UNICODE
  845.  
  846. // Open a product package in order to access product properties
  847.  
  848. UINT WINAPI MsiOpenPackageA(
  849.     LPCSTR    szPackagePath,     // path to package, or database handle: #nnnn
  850.     MSIHANDLE  *hProduct);         // returned product handle, must be closed
  851. UINT WINAPI MsiOpenPackageW(
  852.     LPCWSTR    szPackagePath,     // path to package, or database handle: #nnnn
  853.     MSIHANDLE  *hProduct);         // returned product handle, must be closed
  854. #ifdef UNICODE
  855. #define MsiOpenPackage  MsiOpenPackageW
  856. #else
  857. #define MsiOpenPackage  MsiOpenPackageA
  858. #endif // !UNICODE
  859.  
  860. // Provide the value for an installation property.
  861.  
  862. UINT WINAPI MsiGetProductPropertyA(
  863.     MSIHANDLE   hProduct,       // product handle obtained from MsiOpenProduct
  864.     LPCSTR    szProperty,     // property name, case-sensitive
  865.     LPSTR     lpValueBuf,     // returned value, NULL if not desired
  866.     DWORD      *pcchValueBuf); // in/out buffer character count
  867. UINT WINAPI MsiGetProductPropertyW(
  868.     MSIHANDLE   hProduct,       // product handle obtained from MsiOpenProduct
  869.     LPCWSTR    szProperty,     // property name, case-sensitive
  870.     LPWSTR     lpValueBuf,     // returned value, NULL if not desired
  871.     DWORD      *pcchValueBuf); // in/out buffer character count
  872. #ifdef UNICODE
  873. #define MsiGetProductProperty  MsiGetProductPropertyW
  874. #else
  875. #define MsiGetProductProperty  MsiGetProductPropertyA
  876. #endif // !UNICODE
  877.  
  878.  
  879. // Determine whether a file is a package
  880. // Returns ERROR_SUCCESS if file is a package.
  881.  
  882. UINT WINAPI MsiVerifyPackageA(
  883.     LPCSTR      szPackagePath);   // location of package
  884. UINT WINAPI MsiVerifyPackageW(
  885.     LPCWSTR      szPackagePath);   // location of package
  886. #ifdef UNICODE
  887. #define MsiVerifyPackage  MsiVerifyPackageW
  888. #else
  889. #define MsiVerifyPackage  MsiVerifyPackageA
  890. #endif // !UNICODE
  891.  
  892.  
  893. // Provide descriptive information for product feature: title and description.
  894. // Returns the install level for the feature, or -1 if feature is unknown.
  895. //   0 = feature is not available on this machine
  896. //   1 = highest priority, feature installed if parent is installed
  897. //  >1 = decreasing priority, feature installation based on InstallLevel property
  898.  
  899. UINT WINAPI MsiGetFeatureInfoA(
  900.     MSIHANDLE   hProduct,       // product handle obtained from MsiOpenProduct
  901.     LPCSTR    szFeature,      // feature name
  902.     DWORD      *lpAttributes,  // attribute flags for the feature, using INSTALLFEATUREATTRIBUTE
  903.     LPSTR     lpTitleBuf,     // returned localized name, NULL if not desired
  904.     DWORD      *pcchTitleBuf,  // in/out buffer character count
  905.     LPSTR     lpHelpBuf,      // returned description, NULL if not desired
  906.     DWORD      *pcchHelpBuf);  // in/out buffer character count
  907. UINT WINAPI MsiGetFeatureInfoW(
  908.     MSIHANDLE   hProduct,       // product handle obtained from MsiOpenProduct
  909.     LPCWSTR    szFeature,      // feature name
  910.     DWORD      *lpAttributes,  // attribute flags for the feature, using INSTALLFEATUREATTRIBUTE
  911.     LPWSTR     lpTitleBuf,     // returned localized name, NULL if not desired
  912.     DWORD      *pcchTitleBuf,  // in/out buffer character count
  913.     LPWSTR     lpHelpBuf,      // returned description, NULL if not desired
  914.     DWORD      *pcchHelpBuf);  // in/out buffer character count
  915. #ifdef UNICODE
  916. #define MsiGetFeatureInfo  MsiGetFeatureInfoW
  917. #else
  918. #define MsiGetFeatureInfo  MsiGetFeatureInfoA
  919. #endif // !UNICODE
  920.  
  921. // --------------------------------------------------------------------------
  922. // Functions to access or install missing components and files.
  923. // These should be used as a last resort.
  924. // --------------------------------------------------------------------------
  925.  
  926. // Install a component unexpectedly missing, provided only for error recovery
  927. // This would typically occur due to failue to establish feature availability
  928. // The product feature having the smallest incremental cost is installed
  929.  
  930. UINT WINAPI MsiInstallMissingComponentA(
  931.     LPCSTR      szProduct,        // product code
  932.     LPCSTR      szComponent,      // component Id, string GUID
  933.     INSTALLSTATE eInstallState);  // local/source/default, absent invalid
  934. UINT WINAPI MsiInstallMissingComponentW(
  935.     LPCWSTR      szProduct,        // product code
  936.     LPCWSTR      szComponent,      // component Id, string GUID
  937.     INSTALLSTATE eInstallState);  // local/source/default, absent invalid
  938. #ifdef UNICODE
  939. #define MsiInstallMissingComponent  MsiInstallMissingComponentW
  940. #else
  941. #define MsiInstallMissingComponent  MsiInstallMissingComponentA
  942. #endif // !UNICODE
  943.  
  944. // Install a file unexpectedly missing, provided only for error recovery
  945. // This would typically occur due to failue to establish feature availability
  946. // The missing component is determined from the product's File table, then
  947. // the product feature having the smallest incremental cost is installed
  948.  
  949. UINT WINAPI MsiInstallMissingFileA(
  950.     LPCSTR      szProduct,        // product code
  951.     LPCSTR      szFile);          // file name, without path
  952. UINT WINAPI MsiInstallMissingFileW(
  953.     LPCWSTR      szProduct,        // product code
  954.     LPCWSTR      szFile);          // file name, without path
  955. #ifdef UNICODE
  956. #define MsiInstallMissingFile  MsiInstallMissingFileW
  957. #else
  958. #define MsiInstallMissingFile  MsiInstallMissingFileA
  959. #endif // !UNICODE
  960.  
  961. // Return full path to an installed component without a product code
  962. // This function attempts to determine the product using MsiGetProductCode
  963. // but is not guaranteed to find the correct product for the caller.
  964. // MsiGetComponentPath should always be called when possible.
  965.  
  966. INSTALLSTATE WINAPI MsiLocateComponentA(
  967.     LPCSTR szComponent,  // component Id, string GUID
  968.     LPSTR  lpPathBuf,    // returned path
  969.     DWORD   *pcchBuf);    // in/out buffer character count
  970. INSTALLSTATE WINAPI MsiLocateComponentW(
  971.     LPCWSTR szComponent,  // component Id, string GUID
  972.     LPWSTR  lpPathBuf,    // returned path
  973.     DWORD   *pcchBuf);    // in/out buffer character count
  974. #ifdef UNICODE
  975. #define MsiLocateComponent  MsiLocateComponentW
  976. #else
  977. #define MsiLocateComponent  MsiLocateComponentA
  978. #endif // !UNICODE
  979.  
  980. #if (_WIN32_MSI >=  110)
  981.  
  982. // --------------------------------------------------------------------------
  983. // Functions used to manage the list of valid sources.
  984. // --------------------------------------------------------------------------
  985.  
  986. // Opens the list of sources for the specified user's install of the product
  987. // and removes all network sources from the list. A NULL or empty value for
  988. // the user name indicates the per-machine install.
  989.  
  990. UINT WINAPI MsiSourceListClearAllA(
  991.     LPCSTR szProduct,          // product code
  992.     LPCSTR szUserName,         // user name or NULL/empty for per-machine
  993.     DWORD    dwReserved);        // reserved - must be 0
  994. UINT WINAPI MsiSourceListClearAllW(
  995.     LPCWSTR szProduct,          // product code
  996.     LPCWSTR szUserName,         // user name or NULL/empty for per-machine
  997.     DWORD    dwReserved);        // reserved - must be 0
  998. #ifdef UNICODE
  999. #define MsiSourceListClearAll  MsiSourceListClearAllW
  1000. #else
  1001. #define MsiSourceListClearAll  MsiSourceListClearAllA
  1002. #endif // !UNICODE
  1003.  
  1004. // Opens the list of sources for the specified user's install of the product
  1005. // and adds the provided source as a new network source. A NULL or empty 
  1006. // value for the user name indicates the per-machine install.
  1007.  
  1008. UINT WINAPI MsiSourceListAddSourceA(
  1009.     LPCSTR szProduct,          // product code
  1010.     LPCSTR szUserName,         // user name or NULL/empty for per-machine
  1011.     DWORD    dwReserved,         // reserved - must be 0
  1012.     LPCSTR szSource);          // new source
  1013. UINT WINAPI MsiSourceListAddSourceW(
  1014.     LPCWSTR szProduct,          // product code
  1015.     LPCWSTR szUserName,         // user name or NULL/empty for per-machine
  1016.     DWORD    dwReserved,         // reserved - must be 0
  1017.     LPCWSTR szSource);          // new source
  1018. #ifdef UNICODE
  1019. #define MsiSourceListAddSource  MsiSourceListAddSourceW
  1020. #else
  1021. #define MsiSourceListAddSource  MsiSourceListAddSourceA
  1022. #endif // !UNICODE
  1023.  
  1024. // Forces the installer to reevaluate the list of sources the next time that
  1025. // the specified product needs a source.
  1026.  
  1027. UINT WINAPI MsiSourceListForceResolutionA(
  1028.     LPCSTR szProduct,          // product code
  1029.     LPCSTR szUserName,         // user name or NULL/empty for per-machine
  1030.     DWORD    dwReserved);        // reserved - must be 0
  1031. UINT WINAPI MsiSourceListForceResolutionW(
  1032.     LPCWSTR szProduct,          // product code
  1033.     LPCWSTR szUserName,         // user name or NULL/empty for per-machine
  1034.     DWORD    dwReserved);        // reserved - must be 0
  1035. #ifdef UNICODE
  1036. #define MsiSourceListForceResolution  MsiSourceListForceResolutionW
  1037. #else
  1038. #define MsiSourceListForceResolution  MsiSourceListForceResolutionA
  1039. #endif // !UNICODE
  1040.     
  1041. #endif //(_WIN32_MSI >=  110)
  1042.  
  1043. // --------------------------------------------------------------------------
  1044. // Utility functions
  1045. // --------------------------------------------------------------------------
  1046.  
  1047. // Give the version string and language for a specified file
  1048.  
  1049. UINT WINAPI MsiGetFileVersionA(
  1050.     LPCSTR    szFilePath,       // path to the file
  1051.     LPSTR     lpVersionBuf,     // returned version string
  1052.     DWORD      *pcchVersionBuf,   // in/out buffer byte count
  1053.     LPSTR     lpLangBuf,        // returned language string
  1054.     DWORD       *pcchLangBuf);    // in/out buffer byte count
  1055. UINT WINAPI MsiGetFileVersionW(
  1056.     LPCWSTR    szFilePath,       // path to the file
  1057.     LPWSTR     lpVersionBuf,     // returned version string
  1058.     DWORD      *pcchVersionBuf,   // in/out buffer byte count
  1059.     LPWSTR     lpLangBuf,        // returned language string
  1060.     DWORD       *pcchLangBuf);    // in/out buffer byte count
  1061. #ifdef UNICODE
  1062. #define MsiGetFileVersion  MsiGetFileVersionW
  1063. #else
  1064. #define MsiGetFileVersion  MsiGetFileVersionA
  1065. #endif // !UNICODE
  1066.  
  1067. #ifdef __cplusplus
  1068. }
  1069. #endif
  1070.  
  1071. // --------------------------------------------------------------------------
  1072. // Error codes for installer access functions - until merged to winerr.h
  1073. // --------------------------------------------------------------------------
  1074.  
  1075. #ifndef ERROR_INSTALL_FAILURE
  1076. #define ERROR_INSTALL_USEREXIT      1602L  // User cancel installation.
  1077. #define ERROR_INSTALL_FAILURE       1603L  // Fatal error during installation.
  1078. #define ERROR_INSTALL_SUSPEND       1604L  // Installation suspended, incomplete.
  1079. #define ERROR_UNKNOWN_PRODUCT       1605L  // This action is only valid for products that are currently installed.
  1080. #define ERROR_UNKNOWN_FEATURE       1606L  // Feature ID not registered.
  1081. #define ERROR_UNKNOWN_COMPONENT     1607L  // Component ID not registered.
  1082. #define ERROR_UNKNOWN_PROPERTY      1608L  // Unknown property.
  1083. #define ERROR_INVALID_HANDLE_STATE  1609L  // Handle is in an invalid state.
  1084. #define ERROR_BAD_CONFIGURATION     1610L  // The configuration data for this product is corrupt.  Contact your support personnel.
  1085. #define ERROR_INDEX_ABSENT          1611L  // Component qualifier not present.
  1086. #define ERROR_INSTALL_SOURCE_ABSENT 1612L  // The installation source for this product is not available.  Verify that the source exists and that you can access it.
  1087. #define ERROR_PRODUCT_UNINSTALLED   1614L  // Product is uninstalled.
  1088. #define ERROR_BAD_QUERY_SYNTAX      1615L  // SQL query syntax invalid or unsupported.
  1089. #define ERROR_INVALID_FIELD         1616L  // Record field does not exist.
  1090. #endif
  1091.  
  1092. #ifndef ERROR_INSTALL_SERVICE_FAILURE
  1093. #define ERROR_INSTALL_SERVICE_FAILURE      1601L // The Windows Installer service could not be accessed.  Contact your support personnel to verify that the Windows Installer service is properly registered.
  1094. #define ERROR_INSTALL_PACKAGE_VERSION      1613L // This installation package cannot be installed by the Windows Installer service.  You must install a Windows service pack that contains a newer version of the Windows Installer service.
  1095. #define ERROR_INSTALL_ALREADY_RUNNING      1618L // Another installation is already in progress.  Complete that installation before proceeding with this install.
  1096. #define ERROR_INSTALL_PACKAGE_OPEN_FAILED  1619L // This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
  1097. #define ERROR_INSTALL_PACKAGE_INVALID      1620L // This installation package could not be opened.  Contact the application vendor to verify that this is a valid Windows Installer package.
  1098. #define ERROR_INSTALL_UI_FAILURE           1621L // There was an error starting the Windows Installer service user interface.  Contact your support personnel.
  1099. #define ERROR_INSTALL_LOG_FAILURE          1622L // Error opening installation log file.  Verify that the specified log file location exists and is writable.
  1100. #define ERROR_INSTALL_LANGUAGE_UNSUPPORTED 1623L // This language of this installation package is not supported by your system.
  1101. #define ERROR_INSTALL_PACKAGE_REJECTED     1625L // The system administrator has set policies to prevent this installation.
  1102.  
  1103. #define ERROR_FUNCTION_NOT_CALLED          1626L // Function could not be executed.
  1104. #define ERROR_FUNCTION_FAILED              1627L // Function failed during execution.
  1105. #define ERROR_INVALID_TABLE                1628L // Invalid or unknown table specified.
  1106. #define ERROR_DATATYPE_MISMATCH            1629L // Data supplied is of wrong type.
  1107. #define ERROR_UNSUPPORTED_TYPE             1630L // Data of this type is not supported.
  1108. #define ERROR_CREATE_FAILED                1631L // The Windows Installer service failed to start.  Contact your support personnel.
  1109. #endif
  1110.  
  1111. #ifndef ERROR_INSTALL_TEMP_UNWRITABLE      
  1112. #define ERROR_INSTALL_TEMP_UNWRITABLE      1632L // The Temp folder is on a drive that is full or is inaccessible. Free up space on the drive or verify that you have write permission on the Temp folder.
  1113. #endif
  1114.  
  1115. #ifndef ERROR_INSTALL_PLATFORM_UNSUPPORTED
  1116. #define ERROR_INSTALL_PLATFORM_UNSUPPORTED 1633L // This installation package is not supported by this processor type. Contact your product vendor.
  1117. #endif
  1118.  
  1119. #ifndef ERROR_INSTALL_NOTUSED
  1120. #define ERROR_INSTALL_NOTUSED              1634L // Component not used on this machine
  1121. #endif
  1122.  
  1123. #ifndef ERROR_INSTALL_TRANSFORM_FAILURE
  1124. #define ERROR_INSTALL_TRANSFORM_FAILURE     1624L // Error applying transforms.  Verify that the specified transform paths are valid.
  1125. #endif
  1126.  
  1127. #ifndef ERROR_PATCH_PACKAGE_OPEN_FAILED
  1128. #define ERROR_PATCH_PACKAGE_OPEN_FAILED    1635L // This patch package could not be opened.  Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package.
  1129. #define ERROR_PATCH_PACKAGE_INVALID        1636L // This patch package could not be opened.  Contact the application vendor to verify that this is a valid Windows Installer patch package.
  1130. #define ERROR_PATCH_PACKAGE_UNSUPPORTED    1637L // This patch package cannot be processed by the Windows Installer service.  You must install a Windows service pack that contains a newer version of the Windows Installer service.
  1131. #endif
  1132.  
  1133. #ifndef ERROR_PRODUCT_VERSION
  1134. #define ERROR_PRODUCT_VERSION              1638L // Another version of this product is already installed.  Installation of this version cannot continue.  To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
  1135. #endif
  1136.  
  1137. #ifndef ERROR_INVALID_COMMAND_LINE
  1138. #define ERROR_INVALID_COMMAND_LINE         1639L // Invalid command line argument.  Consult the Windows Installer SDK for detailed command line help.
  1139. #endif
  1140.  
  1141. // The following three error codes are not returned from MSI version 1.0
  1142.  
  1143. #ifndef ERROR_INSTALL_REMOTE_DISALLOWED
  1144. #define ERROR_INSTALL_REMOTE_DISALLOWED    1640L // Configuration of this product is not permitted from remote sessions. Contact your administrator.
  1145. #endif
  1146.  
  1147.  
  1148. #ifndef ERROR_SUCCESS_REBOOT_INITIATED
  1149. #define ERROR_SUCCESS_REBOOT_INITIATED     1641L // The requested operation completed successfully.  The system will be restarted so the changes can take effect.
  1150. #endif
  1151.  
  1152. #ifndef ERROR_PATCH_TARGET_NOT_FOUND
  1153. #define ERROR_PATCH_TARGET_NOT_FOUND       1642L // The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch.
  1154. #endif
  1155.  
  1156. #pragma option pop /*P_O_Pop*/
  1157. #endif // _MSI_H_
  1158.