Setup.Configuration.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. // The MIT License(MIT)
  2. // Copyright(C) Microsoft Corporation.All rights reserved.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files(the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions :
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //
  22. #pragma once
  23. // Constants
  24. //
  25. #ifndef E_NOTFOUND
  26. #define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
  27. #endif
  28. #ifndef E_FILENOTFOUND
  29. #define E_FILENOTFOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
  30. #endif
  31. #ifndef E_NOTSUPPORTED
  32. #define E_NOTSUPPORTED HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)
  33. #endif
  34. // Enumerations
  35. //
  36. /// <summary>
  37. /// The state of an instance.
  38. /// </summary>
  39. enum InstanceState
  40. {
  41. /// <summary>
  42. /// The instance state has not been determined.
  43. /// </summary>
  44. eNone = 0,
  45. /// <summary>
  46. /// The instance installation path exists.
  47. /// </summary>
  48. eLocal = 1,
  49. /// <summary>
  50. /// A product is registered to the instance.
  51. /// </summary>
  52. eRegistered = 2,
  53. /// <summary>
  54. /// No reboot is required for the instance.
  55. /// </summary>
  56. eNoRebootRequired = 4,
  57. /// <summary>
  58. /// No errors were reported for the instance.
  59. /// </summary>
  60. eNoErrors = 8,
  61. /// <summary>
  62. /// The instance represents a complete install.
  63. /// </summary>
  64. eComplete = MAXUINT,
  65. };
  66. // Forward interface declarations
  67. //
  68. #ifndef __ISetupInstance_FWD_DEFINED__
  69. #define __ISetupInstance_FWD_DEFINED__
  70. typedef struct ISetupInstance ISetupInstance;
  71. #endif
  72. #ifndef __ISetupInstance2_FWD_DEFINED__
  73. #define __ISetupInstance2_FWD_DEFINED__
  74. typedef struct ISetupInstance2 ISetupInstance2;
  75. #endif
  76. #ifndef __IEnumSetupInstances_FWD_DEFINED__
  77. #define __IEnumSetupInstances_FWD_DEFINED__
  78. typedef struct IEnumSetupInstances IEnumSetupInstances;
  79. #endif
  80. #ifndef __ISetupConfiguration_FWD_DEFINED__
  81. #define __ISetupConfiguration_FWD_DEFINED__
  82. typedef struct ISetupConfiguration ISetupConfiguration;
  83. #endif
  84. #ifndef __ISetupConfiguration2_FWD_DEFINED__
  85. #define __ISetupConfiguration2_FWD_DEFINED__
  86. typedef struct ISetupConfiguration2 ISetupConfiguration2;
  87. #endif
  88. #ifndef __ISetupPackageReference_FWD_DEFINED__
  89. #define __ISetupPackageReference_FWD_DEFINED__
  90. typedef struct ISetupPackageReference ISetupPackageReference;
  91. #endif
  92. #ifndef __ISetupHelper_FWD_DEFINED__
  93. #define __ISetupHelper_FWD_DEFINED__
  94. typedef struct ISetupHelper ISetupHelper;
  95. #endif
  96. #ifndef __ISetupErrorState_FWD_DEFINED__
  97. #define __ISetupErrorState_FWD_DEFINED__
  98. typedef struct ISetupErrorState ISetupErrorState;
  99. #endif
  100. #ifndef __ISetupFailedPackageReference_FWD_DEFINED__
  101. #define __ISetupFailedPackageReference_FWD_DEFINED__
  102. typedef struct ISetupFailedPackageReference ISetupFailedPackageReference;
  103. #endif
  104. #ifndef __ISetupPropertyStore_FWD_DEFINED__
  105. #define __ISetupPropertyStore_FWD_DEFINED__
  106. typedef struct ISetupPropertyStore ISetupPropertyStore;
  107. #endif
  108. // Forward class declarations
  109. //
  110. #ifndef __SetupConfiguration_FWD_DEFINED__
  111. #define __SetupConfiguration_FWD_DEFINED__
  112. #ifdef __cplusplus
  113. typedef class SetupConfiguration SetupConfiguration;
  114. #endif
  115. #endif
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119. // Interface definitions
  120. //
  121. EXTERN_C const IID IID_ISetupInstance;
  122. #if defined(__cplusplus) && !defined(CINTERFACE)
  123. /// <summary>
  124. /// Information about an instance of a product.
  125. /// </summary>
  126. struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
  127. {
  128. /// <summary>
  129. /// Gets the instance identifier (should match the name of the parent instance directory).
  130. /// </summary>
  131. /// <param name="pbstrInstanceId">The instance identifier.</param>
  132. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  133. STDMETHOD(GetInstanceId)(
  134. _Out_ BSTR* pbstrInstanceId
  135. ) = 0;
  136. /// <summary>
  137. /// Gets the local date and time when the installation was originally installed.
  138. /// </summary>
  139. /// <param name="pInstallDate">The local date and time when the installation was originally installed.</param>
  140. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  141. STDMETHOD(GetInstallDate)(
  142. _Out_ LPFILETIME pInstallDate
  143. ) = 0;
  144. /// <summary>
  145. /// Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
  146. /// </summary>
  147. /// <param name="pbstrInstallationName">The unique name of the installation, often indicating the branch and other information used for telemetry.</param>
  148. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  149. STDMETHOD(GetInstallationName)(
  150. _Out_ BSTR* pbstrInstallationName
  151. ) = 0;
  152. /// <summary>
  153. /// Gets the path to the installation root of the product.
  154. /// </summary>
  155. /// <param name="pbstrInstallationPath">The path to the installation root of the product.</param>
  156. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  157. STDMETHOD(GetInstallationPath)(
  158. _Out_ BSTR* pbstrInstallationPath
  159. ) = 0;
  160. /// <summary>
  161. /// Gets the version of the product installed in this instance.
  162. /// </summary>
  163. /// <param name="pbstrInstallationVersion">The version of the product installed in this instance.</param>
  164. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  165. STDMETHOD(GetInstallationVersion)(
  166. _Out_ BSTR* pbstrInstallationVersion
  167. ) = 0;
  168. /// <summary>
  169. /// Gets the display name (title) of the product installed in this instance.
  170. /// </summary>
  171. /// <param name="lcid">The LCID for the display name.</param>
  172. /// <param name="pbstrDisplayName">The display name (title) of the product installed in this instance.</param>
  173. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  174. STDMETHOD(GetDisplayName)(
  175. _In_ LCID lcid,
  176. _Out_ BSTR* pbstrDisplayName
  177. ) = 0;
  178. /// <summary>
  179. /// Gets the description of the product installed in this instance.
  180. /// </summary>
  181. /// <param name="lcid">The LCID for the description.</param>
  182. /// <param name="pbstrDescription">The description of the product installed in this instance.</param>
  183. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  184. STDMETHOD(GetDescription)(
  185. _In_ LCID lcid,
  186. _Out_ BSTR* pbstrDescription
  187. ) = 0;
  188. /// <summary>
  189. /// Resolves the optional relative path to the root path of the instance.
  190. /// </summary>
  191. /// <param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
  192. /// <param name="pbstrAbsolutePath">The full path to the optional relative path within the instance. If the relative path is NULL, the root path will always terminate in a backslash.</param>
  193. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined.</returns>
  194. STDMETHOD(ResolvePath)(
  195. _In_opt_z_ LPCOLESTR pwszRelativePath,
  196. _Out_ BSTR* pbstrAbsolutePath
  197. ) = 0;
  198. };
  199. #endif
  200. EXTERN_C const IID IID_ISetupInstance2;
  201. #if defined(__cplusplus) && !defined(CINTERFACE)
  202. /// <summary>
  203. /// Information about an instance of a product.
  204. /// </summary>
  205. struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance
  206. {
  207. /// <summary>
  208. /// Gets the state of the instance.
  209. /// </summary>
  210. /// <param name="pState">The state of the instance.</param>
  211. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  212. STDMETHOD(GetState)(
  213. _Out_ InstanceState* pState
  214. ) = 0;
  215. /// <summary>
  216. /// Gets an array of package references registered to the instance.
  217. /// </summary>
  218. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>.</param>
  219. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined.</returns>
  220. STDMETHOD(GetPackages)(
  221. _Out_ LPSAFEARRAY* ppsaPackages
  222. ) = 0;
  223. /// <summary>
  224. /// Gets a pointer to the <see cref="ISetupPackageReference"/> that represents the registered product.
  225. /// </summary>
  226. /// <param name="ppPackage">Pointer to an instance of <see cref="ISetupPackageReference"/>. This may be NULL if <see cref="GetState"/> does not return <see cref="eComplete"/>.</param>
  227. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined.</returns>
  228. STDMETHOD(GetProduct)(
  229. _Outptr_result_maybenull_ ISetupPackageReference** ppPackage
  230. ) = 0;
  231. /// <summary>
  232. /// Gets the relative path to the product application, if available.
  233. /// </summary>
  234. /// <param name="pbstrProductPath">The relative path to the product application, if available.</param>
  235. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  236. STDMETHOD(GetProductPath)(
  237. _Outptr_result_maybenull_ BSTR* pbstrProductPath
  238. ) = 0;
  239. /// <summary>
  240. /// Gets the error state of the instance, if available.
  241. /// </summary>
  242. /// <param name="pErrorState">The error state of the instance, if available.</param>
  243. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  244. STDMETHOD(GetErrors)(
  245. _Outptr_result_maybenull_ ISetupErrorState** ppErrorState
  246. ) = 0;
  247. /// <summary>
  248. /// Gets a value indicating whether the instance can be launched.
  249. /// </summary>
  250. /// <param name="pfIsLaunchable">Whether the instance can be launched.</param>
  251. /// <returns>Standard HRESULT indicating success or failure.</returns>
  252. /// <remarks>
  253. /// An instance could have had errors during install but still be launched. Some features may not work correctly, but others will.
  254. /// </remarks>
  255. STDMETHOD(IsLaunchable)(
  256. _Out_ VARIANT_BOOL* pfIsLaunchable
  257. ) = 0;
  258. /// <summary>
  259. /// Gets a value indicating whether the instance is complete.
  260. /// </summary>
  261. /// <param name="pfIsLaunchable">Whether the instance is complete.</param>
  262. /// <returns>Standard HRESULT indicating success or failure.</returns>
  263. /// <remarks>
  264. /// An instance is complete if it had no errors during install, resume, or repair.
  265. /// </remarks>
  266. STDMETHOD(IsComplete)(
  267. _Out_ VARIANT_BOOL* pfIsComplete
  268. ) = 0;
  269. /// <summary>
  270. /// Gets product-specific properties.
  271. /// </summary>
  272. /// <param name="ppPropeties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param>
  273. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  274. STDMETHOD(GetProperties)(
  275. _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties
  276. ) = 0;
  277. /// <summary>
  278. /// Gets the directory path to the setup engine that installed the instance.
  279. /// </summary>
  280. /// <param name="pbstrEnginePath">The directory path to the setup engine that installed the instance.</param>
  281. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  282. STDMETHOD(GetEnginePath)(
  283. _Outptr_result_maybenull_ BSTR* pbstrEnginePath
  284. ) = 0;
  285. };
  286. #endif
  287. EXTERN_C const IID IID_IEnumSetupInstances;
  288. #if defined(__cplusplus) && !defined(CINTERFACE)
  289. /// <summary>
  290. /// A enumerator of installed <see cref="ISetupInstance"/> objects.
  291. /// </summary>
  292. struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown
  293. {
  294. /// <summary>
  295. /// Retrieves the next set of product instances in the enumeration sequence.
  296. /// </summary>
  297. /// <param name="celt">The number of product instances to retrieve.</param>
  298. /// <param name="rgelt">A pointer to an array of <see cref="ISetupInstance"/>.</param>
  299. /// <param name="pceltFetched">A pointer to the number of product instances retrieved. If celt is 1 this parameter may be NULL.</param>
  300. /// <returns>S_OK if the number of elements were fetched, S_FALSE if nothing was fetched (at end of enumeration), E_INVALIDARG if celt is greater than 1 and pceltFetched is NULL, or E_OUTOFMEMORY if an <see cref="ISetupInstance"/> could not be allocated.</returns>
  301. STDMETHOD(Next)(
  302. _In_ ULONG celt,
  303. _Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt,
  304. _Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched
  305. ) = 0;
  306. /// <summary>
  307. /// Skips the next set of product instances in the enumeration sequence.
  308. /// </summary>
  309. /// <param name="celt">The number of product instances to skip.</param>
  310. /// <returns>S_OK if the number of elements could be skipped; otherwise, S_FALSE;</returns>
  311. STDMETHOD(Skip)(
  312. _In_ ULONG celt
  313. ) = 0;
  314. /// <summary>
  315. /// Resets the enumeration sequence to the beginning.
  316. /// </summary>
  317. /// <returns>Always returns S_OK;</returns>
  318. STDMETHOD(Reset)(void) = 0;
  319. /// <summary>
  320. /// Creates a new enumeration object in the same state as the current enumeration object: the new object points to the same place in the enumeration sequence.
  321. /// </summary>
  322. /// <param name="ppenum">A pointer to a pointer to a new <see cref="IEnumSetupInstances"/> interface. If the method fails, this parameter is undefined.</param>
  323. /// <returns>S_OK if a clone was returned; otherwise, E_OUTOFMEMORY.</returns>
  324. STDMETHOD(Clone)(
  325. _Deref_out_opt_ IEnumSetupInstances** ppenum
  326. ) = 0;
  327. };
  328. #endif
  329. EXTERN_C const IID IID_ISetupConfiguration;
  330. #if defined(__cplusplus) && !defined(CINTERFACE)
  331. /// <summary>
  332. /// Gets information about product instances set up on the machine.
  333. /// </summary>
  334. struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown
  335. {
  336. /// <summary>
  337. /// Enumerates all completed product instances installed.
  338. /// </summary>
  339. /// <param name="ppEnumInstances">An enumeration of completed, installed product instances.</param>
  340. /// <returns>Standard HRESULT indicating success or failure.</returns>
  341. STDMETHOD(EnumInstances)(
  342. _Out_ IEnumSetupInstances** ppEnumInstances
  343. ) = 0;
  344. /// <summary>
  345. /// Gets the instance for the current process path.
  346. /// </summary>
  347. /// <param name="ppInstance">The instance for the current process path.</param>
  348. /// <returns>
  349. /// The instance for the current process path, or E_NOTFOUND if not found.
  350. /// The <see cref="ISetupInstance::GetState"/> may indicate the instance is invalid.
  351. /// </returns>
  352. STDMETHOD(GetInstanceForCurrentProcess)(
  353. _Out_ ISetupInstance** ppInstance
  354. ) = 0;
  355. /// <summary>
  356. /// Gets the instance for the given path.
  357. /// </summary>
  358. /// <param name="ppInstance">The instance for the given path.</param>
  359. /// <returns>
  360. /// The instance for the given path, or E_NOTFOUND if not found.
  361. /// The <see cref="ISetupInstance::GetState"/> may indicate the instance is invalid.
  362. /// </returns>
  363. STDMETHOD(GetInstanceForPath)(
  364. _In_z_ LPCWSTR wzPath,
  365. _Out_ ISetupInstance** ppInstance
  366. ) = 0;
  367. };
  368. #endif
  369. EXTERN_C const IID IID_ISetupConfiguration2;
  370. #if defined(__cplusplus) && !defined(CINTERFACE)
  371. /// <summary>
  372. /// Gets information about product instances.
  373. /// </summary>
  374. struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration
  375. {
  376. /// <summary>
  377. /// Enumerates all product instances.
  378. /// </summary>
  379. /// <param name="ppEnumInstances">An enumeration of all product instances.</param>
  380. /// <returns>Standard HRESULT indicating success or failure.</returns>
  381. STDMETHOD(EnumAllInstances)(
  382. _Out_ IEnumSetupInstances** ppEnumInstances
  383. ) = 0;
  384. };
  385. #endif
  386. EXTERN_C const IID IID_ISetupPackageReference;
  387. #if defined(__cplusplus) && !defined(CINTERFACE)
  388. /// <summary>
  389. /// A reference to a package.
  390. /// </summary>
  391. struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown
  392. {
  393. /// <summary>
  394. /// Gets the general package identifier.
  395. /// </summary>
  396. /// <param name="pbstrId">The general package identifier.</param>
  397. /// <returns>Standard HRESULT indicating success or failure.</returns>
  398. STDMETHOD(GetId)(
  399. _Out_ BSTR* pbstrId
  400. ) = 0;
  401. /// <summary>
  402. /// Gets the version of the package.
  403. /// </summary>
  404. /// <param name="pbstrVersion">The version of the package.</param>
  405. /// <returns>Standard HRESULT indicating success or failure.</returns>
  406. STDMETHOD(GetVersion)(
  407. _Out_ BSTR* pbstrVersion
  408. ) = 0;
  409. /// <summary>
  410. /// Gets the target process architecture of the package.
  411. /// </summary>
  412. /// <param name="pbstrChip">The target process architecture of the package.</param>
  413. /// <returns>Standard HRESULT indicating success or failure.</returns>
  414. STDMETHOD(GetChip)(
  415. _Out_ BSTR* pbstrChip
  416. ) = 0;
  417. /// <summary>
  418. /// Gets the language and optional region identifier.
  419. /// </summary>
  420. /// <param name="pbstrLanguage">The language and optional region identifier.</param>
  421. /// <returns>Standard HRESULT indicating success or failure.</returns>
  422. STDMETHOD(GetLanguage)(
  423. _Out_ BSTR* pbstrLanguage
  424. ) = 0;
  425. /// <summary>
  426. /// Gets the build branch of the package.
  427. /// </summary>
  428. /// <param name="pbstrBranch">The build branch of the package.</param>
  429. /// <returns>Standard HRESULT indicating success or failure.</returns>
  430. STDMETHOD(GetBranch)(
  431. _Out_ BSTR* pbstrBranch
  432. ) = 0;
  433. /// <summary>
  434. /// Gets the type of the package.
  435. /// </summary>
  436. /// <param name="pbstrType">The type of the package.</param>
  437. /// <returns>Standard HRESULT indicating success or failure.</returns>
  438. STDMETHOD(GetType)(
  439. _Out_ BSTR* pbstrType
  440. ) = 0;
  441. /// <summary>
  442. /// Gets the unique identifier consisting of all defined tokens.
  443. /// </summary>
  444. /// <param name="pbstrUniqueId">The unique identifier consisting of all defined tokens.</param>
  445. /// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
  446. STDMETHOD(GetUniqueId)(
  447. _Out_ BSTR* pbstrUniqueId
  448. ) = 0;
  449. /// <summary>
  450. /// Gets a value indicating whether the package refers to an external extension.
  451. /// </summary>
  452. /// <param name="pfIsExtension">A value indicating whether the package refers to an external extension.</param>
  453. /// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
  454. STDMETHOD(GetIsExtension)(
  455. _Out_ VARIANT_BOOL* pfIsExtension
  456. ) = 0;
  457. };
  458. #endif
  459. EXTERN_C const IID IID_ISetupHelper;
  460. #if defined(__cplusplus) && !defined(CINTERFACE)
  461. /// <summary>
  462. /// Helper functions.
  463. /// </summary>
  464. /// <remarks>
  465. /// You can query for this interface from the <see cref="SetupConfiguration"/> class.
  466. /// </remarks>
  467. struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown
  468. {
  469. /// <summary>
  470. /// Parses a dotted quad version string into a 64-bit unsigned integer.
  471. /// </summary>
  472. /// <param name="pwszVersion">The dotted quad version string to parse, e.g. 1.2.3.4.</param>
  473. /// <param name="pullVersion">A 64-bit unsigned integer representing the version. You can compare this to other versions.</param>
  474. /// <returns>Standard HRESULT indicating success or failure, including E_INVALIDARG if the version is not valid.</returns>
  475. STDMETHOD(ParseVersion)(
  476. _In_ LPCOLESTR pwszVersion,
  477. _Out_ PULONGLONG pullVersion
  478. ) = 0;
  479. /// <summary>
  480. /// Parses a dotted quad version string into a 64-bit unsigned integer.
  481. /// </summary>
  482. /// <param name="pwszVersionRange">The string containing 1 or 2 dotted quad version strings to parse, e.g. [1.0,) that means 1.0.0.0 or newer.</param>
  483. /// <param name="pullMinVersion">A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions.</param>
  484. /// <param name="pullMaxVersion">A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions.</param>
  485. /// <returns>Standard HRESULT indicating success or failure, including E_INVALIDARG if the version range is not valid.</returns>
  486. STDMETHOD(ParseVersionRange)(
  487. _In_ LPCOLESTR pwszVersionRange,
  488. _Out_ PULONGLONG pullMinVersion,
  489. _Out_ PULONGLONG pullMaxVersion
  490. ) = 0;
  491. };
  492. #endif
  493. EXTERN_C const IID IID_ISetupErrorState;
  494. #if defined(__cplusplus) && !defined(CINTERFACE)
  495. /// <summary>
  496. /// Information about the error state of the instance.
  497. /// </summary>
  498. struct DECLSPEC_UUID("46DCCD94-A287-476A-851E-DFBC2FFDBC20") DECLSPEC_NOVTABLE ISetupErrorState : public IUnknown
  499. {
  500. /// <summary>
  501. /// Gets an array of failed package references.
  502. /// </summary>
  503. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupFailedPackageReference"/>, if packages have failed.</param>
  504. /// <returns>Standard HRESULT indicating success or failure.</returns>
  505. STDMETHOD(GetFailedPackages)(
  506. _Outptr_result_maybenull_ LPSAFEARRAY* ppsaFailedPackages
  507. ) = 0;
  508. /// <summary>
  509. /// Gets an array of skipped package references.
  510. /// </summary>
  511. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>, if packages have been skipped.</param>
  512. /// <returns>Standard HRESULT indicating success or failure.</returns>
  513. STDMETHOD(GetSkippedPackages)(
  514. _Outptr_result_maybenull_ LPSAFEARRAY* ppsaSkippedPackages
  515. ) = 0;
  516. };
  517. #endif
  518. EXTERN_C const IID IID_ISetupFailedPackageReference;
  519. #if defined(__cplusplus) && !defined(CINTERFACE)
  520. /// <summary>
  521. /// A reference to a failed package.
  522. /// </summary>
  523. struct DECLSPEC_UUID("E73559CD-7003-4022-B134-27DC650B280F") DECLSPEC_NOVTABLE ISetupFailedPackageReference : public ISetupPackageReference
  524. {
  525. };
  526. #endif
  527. EXTERN_C const IID IID_ISetupPropertyStore;
  528. #if defined(__cplusplus) && !defined(CINTERFACE)
  529. /// <summary>
  530. /// Provides named properties.
  531. /// </summary>
  532. /// <remarks>
  533. /// You can get this from an <see cref="ISetupInstance"/>, <see cref="ISetupPackageReference"/>, or derivative.
  534. /// </remarks>
  535. struct DECLSPEC_UUID("C601C175-A3BE-44BC-91F6-4568D230FC83") DECLSPEC_NOVTABLE ISetupPropertyStore : public IUnknown
  536. {
  537. /// <summary>
  538. /// Gets an array of property names in this property store.
  539. /// </summary>
  540. /// <param name="ppsaNames">Pointer to an array of property names as BSTRs.</param>
  541. /// <returns>Standard HRESULT indicating success or failure.</returns>
  542. STDMETHOD(GetNames)(
  543. _Out_ LPSAFEARRAY* ppsaNames
  544. ) = 0;
  545. /// <summary>
  546. /// Gets the value of a named property in this property store.
  547. /// </summary>
  548. /// <param name="pwszName">The name of the property to get.</param>
  549. /// <param name="pvtValue">The value of the property.</param>
  550. /// <returns>Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported.</returns>
  551. STDMETHOD(GetValue)(
  552. _In_ LPCOLESTR pwszName,
  553. _Out_ LPVARIANT pvtValue
  554. ) = 0;
  555. };
  556. #endif
  557. // Class declarations
  558. //
  559. EXTERN_C const CLSID CLSID_SetupConfiguration;
  560. #ifdef __cplusplus
  561. /// <summary>
  562. /// This class implements <see cref="ISetupConfiguration"/>, <see cref="ISetupConfiguration2"/>, and <see cref="ISetupHelper"/>.
  563. /// </summary>
  564. class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration;
  565. #endif
  566. // Function declarations
  567. //
  568. /// <summary>
  569. /// Gets an <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.
  570. /// </summary>
  571. /// <param name="ppConfiguration">The <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.</param>
  572. /// <param name="pReserved">Reserved for future use.</param>
  573. /// <returns>Standard HRESULT indicating success or failure.</returns>
  574. STDMETHODIMP GetSetupConfiguration(
  575. _Out_ ISetupConfiguration** ppConfiguration,
  576. _Reserved_ LPVOID pReserved
  577. );
  578. #ifdef __cplusplus
  579. }
  580. #endif