Setup.Configuration.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  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 __ISetupInstanceCatalog_FWD_DEFINED__
  77. #define __ISetupInstanceCatalog_FWD_DEFINED__
  78. typedef struct ISetupInstanceCatalog ISetupInstanceCatalog;
  79. #endif
  80. #ifndef __ISetupLocalizedProperties_FWD_DEFINED__
  81. #define __ISetupLocalizedProperties_FWD_DEFINED__
  82. typedef struct ISetupLocalizedProperties ISetupLocalizedProperties;
  83. #endif
  84. #ifndef __IEnumSetupInstances_FWD_DEFINED__
  85. #define __IEnumSetupInstances_FWD_DEFINED__
  86. typedef struct IEnumSetupInstances IEnumSetupInstances;
  87. #endif
  88. #ifndef __ISetupConfiguration_FWD_DEFINED__
  89. #define __ISetupConfiguration_FWD_DEFINED__
  90. typedef struct ISetupConfiguration ISetupConfiguration;
  91. #endif
  92. #ifndef __ISetupConfiguration2_FWD_DEFINED__
  93. #define __ISetupConfiguration2_FWD_DEFINED__
  94. typedef struct ISetupConfiguration2 ISetupConfiguration2;
  95. #endif
  96. #ifndef __ISetupPackageReference_FWD_DEFINED__
  97. #define __ISetupPackageReference_FWD_DEFINED__
  98. typedef struct ISetupPackageReference ISetupPackageReference;
  99. #endif
  100. #ifndef __ISetupHelper_FWD_DEFINED__
  101. #define __ISetupHelper_FWD_DEFINED__
  102. typedef struct ISetupHelper ISetupHelper;
  103. #endif
  104. #ifndef __ISetupErrorState_FWD_DEFINED__
  105. #define __ISetupErrorState_FWD_DEFINED__
  106. typedef struct ISetupErrorState ISetupErrorState;
  107. #endif
  108. #ifndef __ISetupErrorState2_FWD_DEFINED__
  109. #define __ISetupErrorState2_FWD_DEFINED__
  110. typedef struct ISetupErrorState2 ISetupErrorState2;
  111. #endif
  112. #ifndef __ISetupFailedPackageReference_FWD_DEFINED__
  113. #define __ISetupFailedPackageReference_FWD_DEFINED__
  114. typedef struct ISetupFailedPackageReference ISetupFailedPackageReference;
  115. #endif
  116. #ifndef __ISetupFailedPackageReference2_FWD_DEFINED__
  117. #define __ISetupFailedPackageReference2_FWD_DEFINED__
  118. typedef struct ISetupFailedPackageReference2 ISetupFailedPackageReference2;
  119. #endif
  120. #ifndef __ISetupFailedPackageReference3_FWD_DEFINED__
  121. #define __ISetupFailedPackageReference3_FWD_DEFINED__
  122. typedef struct ISetupFailedPackageReference3 ISetupFailedPackageReference3;
  123. #endif
  124. #ifndef __ISetupPropertyStore_FWD_DEFINED__
  125. #define __ISetupPropertyStore_FWD_DEFINED__
  126. typedef struct ISetupPropertyStore ISetupPropertyStore;
  127. #endif
  128. #ifndef __ISetupLocalizedPropertyStore_FWD_DEFINED__
  129. #define __ISetupLocalizedPropertyStore_FWD_DEFINED__
  130. typedef struct ISetupLocalizedPropertyStore ISetupLocalizedPropertyStore;
  131. #endif
  132. // Forward class declarations
  133. //
  134. #ifndef __SetupConfiguration_FWD_DEFINED__
  135. #define __SetupConfiguration_FWD_DEFINED__
  136. #ifdef __cplusplus
  137. typedef class SetupConfiguration SetupConfiguration;
  138. #endif
  139. #endif
  140. #ifdef __cplusplus
  141. extern "C" {
  142. #endif
  143. // Interface definitions
  144. //
  145. EXTERN_C const IID IID_ISetupInstance;
  146. #if defined(__cplusplus) && !defined(CINTERFACE)
  147. /// <summary>
  148. /// Information about an instance of a product.
  149. /// </summary>
  150. struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
  151. {
  152. /// <summary>
  153. /// Gets the instance identifier (should match the name of the parent instance directory).
  154. /// </summary>
  155. /// <param name="pbstrInstanceId">The instance identifier.</param>
  156. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  157. STDMETHOD(GetInstanceId)(
  158. _Out_ BSTR* pbstrInstanceId
  159. ) = 0;
  160. /// <summary>
  161. /// Gets the local date and time when the installation was originally installed.
  162. /// </summary>
  163. /// <param name="pInstallDate">The local date and time when the installation was originally installed.</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(GetInstallDate)(
  166. _Out_ LPFILETIME pInstallDate
  167. ) = 0;
  168. /// <summary>
  169. /// Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
  170. /// </summary>
  171. /// <param name="pbstrInstallationName">The unique name of the installation, often indicating the branch and other information used for telemetry.</param>
  172. /// <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>
  173. STDMETHOD(GetInstallationName)(
  174. _Out_ BSTR* pbstrInstallationName
  175. ) = 0;
  176. /// <summary>
  177. /// Gets the path to the installation root of the product.
  178. /// </summary>
  179. /// <param name="pbstrInstallationPath">The path to the installation root of the product.</param>
  180. /// <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>
  181. STDMETHOD(GetInstallationPath)(
  182. _Out_ BSTR* pbstrInstallationPath
  183. ) = 0;
  184. /// <summary>
  185. /// Gets the version of the product installed in this instance.
  186. /// </summary>
  187. /// <param name="pbstrInstallationVersion">The version of the product installed in this instance.</param>
  188. /// <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>
  189. STDMETHOD(GetInstallationVersion)(
  190. _Out_ BSTR* pbstrInstallationVersion
  191. ) = 0;
  192. /// <summary>
  193. /// Gets the display name (title) of the product installed in this instance.
  194. /// </summary>
  195. /// <param name="lcid">The LCID for the display name.</param>
  196. /// <param name="pbstrDisplayName">The display name (title) of the product installed in this instance.</param>
  197. /// <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>
  198. STDMETHOD(GetDisplayName)(
  199. _In_ LCID lcid,
  200. _Out_ BSTR* pbstrDisplayName
  201. ) = 0;
  202. /// <summary>
  203. /// Gets the description of the product installed in this instance.
  204. /// </summary>
  205. /// <param name="lcid">The LCID for the description.</param>
  206. /// <param name="pbstrDescription">The description of the product installed in this instance.</param>
  207. /// <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>
  208. STDMETHOD(GetDescription)(
  209. _In_ LCID lcid,
  210. _Out_ BSTR* pbstrDescription
  211. ) = 0;
  212. /// <summary>
  213. /// Resolves the optional relative path to the root path of the instance.
  214. /// </summary>
  215. /// <param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
  216. /// <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>
  217. /// <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>
  218. STDMETHOD(ResolvePath)(
  219. _In_opt_z_ LPCOLESTR pwszRelativePath,
  220. _Out_ BSTR* pbstrAbsolutePath
  221. ) = 0;
  222. };
  223. #endif
  224. EXTERN_C const IID IID_ISetupInstance2;
  225. #if defined(__cplusplus) && !defined(CINTERFACE)
  226. /// <summary>
  227. /// Information about an instance of a product.
  228. /// </summary>
  229. struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance
  230. {
  231. /// <summary>
  232. /// Gets the state of the instance.
  233. /// </summary>
  234. /// <param name="pState">The state of the instance.</param>
  235. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  236. STDMETHOD(GetState)(
  237. _Out_ InstanceState* pState
  238. ) = 0;
  239. /// <summary>
  240. /// Gets an array of package references registered to the instance.
  241. /// </summary>
  242. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>.</param>
  243. /// <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>
  244. STDMETHOD(GetPackages)(
  245. _Out_ LPSAFEARRAY* ppsaPackages
  246. ) = 0;
  247. /// <summary>
  248. /// Gets a pointer to the <see cref="ISetupPackageReference"/> that represents the registered product.
  249. /// </summary>
  250. /// <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>
  251. /// <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>
  252. STDMETHOD(GetProduct)(
  253. _Outptr_result_maybenull_ ISetupPackageReference** ppPackage
  254. ) = 0;
  255. /// <summary>
  256. /// Gets the relative path to the product application, if available.
  257. /// </summary>
  258. /// <param name="pbstrProductPath">The relative path to the product application, if available.</param>
  259. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  260. STDMETHOD(GetProductPath)(
  261. _Outptr_result_maybenull_ BSTR* pbstrProductPath
  262. ) = 0;
  263. /// <summary>
  264. /// Gets the error state of the instance, if available.
  265. /// </summary>
  266. /// <param name="pErrorState">The error state of the instance, if available.</param>
  267. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  268. STDMETHOD(GetErrors)(
  269. _Outptr_result_maybenull_ ISetupErrorState** ppErrorState
  270. ) = 0;
  271. /// <summary>
  272. /// Gets a value indicating whether the instance can be launched.
  273. /// </summary>
  274. /// <param name="pfIsLaunchable">Whether the instance can be launched.</param>
  275. /// <returns>Standard HRESULT indicating success or failure.</returns>
  276. /// <remarks>
  277. /// An instance could have had errors during install but still be launched. Some features may not work correctly, but others will.
  278. /// </remarks>
  279. STDMETHOD(IsLaunchable)(
  280. _Out_ VARIANT_BOOL* pfIsLaunchable
  281. ) = 0;
  282. /// <summary>
  283. /// Gets a value indicating whether the instance is complete.
  284. /// </summary>
  285. /// <param name="pfIsLaunchable">Whether the instance is complete.</param>
  286. /// <returns>Standard HRESULT indicating success or failure.</returns>
  287. /// <remarks>
  288. /// An instance is complete if it had no errors during install, resume, or repair.
  289. /// </remarks>
  290. STDMETHOD(IsComplete)(
  291. _Out_ VARIANT_BOOL* pfIsComplete
  292. ) = 0;
  293. /// <summary>
  294. /// Gets product-specific properties.
  295. /// </summary>
  296. /// <param name="ppPropeties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param>
  297. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  298. STDMETHOD(GetProperties)(
  299. _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties
  300. ) = 0;
  301. /// <summary>
  302. /// Gets the directory path to the setup engine that installed the instance.
  303. /// </summary>
  304. /// <param name="pbstrEnginePath">The directory path to the setup engine that installed the instance.</param>
  305. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
  306. STDMETHOD(GetEnginePath)(
  307. _Outptr_result_maybenull_ BSTR* pbstrEnginePath
  308. ) = 0;
  309. };
  310. #endif
  311. EXTERN_C const IID IID_ISetupInstanceCatalog;
  312. #if defined(__cplusplus) && !defined(CINTERFACE)
  313. /// <summary>
  314. /// Information about a catalog used to install an instance.
  315. /// </summary>
  316. struct DECLSPEC_UUID("9AD8E40F-39A2-40F1-BF64-0A6C50DD9EEB") DECLSPEC_NOVTABLE ISetupInstanceCatalog : public IUnknown
  317. {
  318. /// <summary>
  319. /// Gets catalog information properties.
  320. /// </summary>
  321. /// <param name="ppCatalogInfo">A pointer to an instance of <see cref="ISetupPropertyStore"/>.</param>
  322. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property does not exist.</returns>
  323. STDMETHOD(GetCatalogInfo)(
  324. _Out_ ISetupPropertyStore** ppCatalogInfo
  325. ) = 0;
  326. /// <summary>
  327. /// Gets a value indicating whether the catalog is a prerelease.
  328. /// </summary>
  329. /// <param name="pfIsPrerelease">Whether the catalog for the instance is a prerelease version.</param>
  330. /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property does not exist.</returns>
  331. STDMETHOD(IsPrerelease)(
  332. _Out_ VARIANT_BOOL* pfIsPrerelease
  333. ) = 0;
  334. };
  335. #endif
  336. EXTERN_C const IID IID_ISetupLocalizedProperties;
  337. #if defined(__cplusplus) && !defined(CINTERFACE)
  338. /// <summary>
  339. /// Provides localized properties of an instance of a product.
  340. /// </summary>
  341. struct DECLSPEC_UUID("F4BD7382-FE27-4AB4-B974-9905B2A148B0") DECLSPEC_NOVTABLE ISetupLocalizedProperties : public IUnknown
  342. {
  343. /// <summary>
  344. /// Gets localized product-specific properties.
  345. /// </summary>
  346. /// <param name="ppLocalizedProperties">A pointer to an instance of <see cref="ISetupLocalizedPropertyStore"/>. This may be NULL if no properties are defined.</param>
  347. /// <returns>Standard HRESULT indicating success or failure.</returns>
  348. STDMETHOD(GetLocalizedProperties)(
  349. _Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedProperties
  350. ) = 0;
  351. /// <summary>
  352. /// Gets localized channel-specific properties.
  353. /// </summary>
  354. /// <param name="ppLocalizedChannelProperties">A pointer to an instance of <see cref="ISetupLocalizedPropertyStore"/>. This may be NULL if no channel properties are defined.</param>
  355. /// <returns>Standard HRESULT indicating success or failure.</returns>
  356. STDMETHOD(GetLocalizedChannelProperties)(
  357. _Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedChannelProperties
  358. ) = 0;
  359. };
  360. #endif
  361. EXTERN_C const IID IID_IEnumSetupInstances;
  362. #if defined(__cplusplus) && !defined(CINTERFACE)
  363. /// <summary>
  364. /// An enumerator of installed <see cref="ISetupInstance"/> objects.
  365. /// </summary>
  366. struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown
  367. {
  368. /// <summary>
  369. /// Retrieves the next set of product instances in the enumeration sequence.
  370. /// </summary>
  371. /// <param name="celt">The number of product instances to retrieve.</param>
  372. /// <param name="rgelt">A pointer to an array of <see cref="ISetupInstance"/>.</param>
  373. /// <param name="pceltFetched">A pointer to the number of product instances retrieved. If <paramref name="celt"/> is 1 this parameter may be NULL.</param>
  374. /// <returns>S_OK if the number of elements were fetched, S_FALSE if nothing was fetched (at end of enumeration), E_INVALIDARG if <paramref name="celt"/> is greater than 1 and pceltFetched is NULL, or E_OUTOFMEMORY if an <see cref="ISetupInstance"/> could not be allocated.</returns>
  375. STDMETHOD(Next)(
  376. _In_ ULONG celt,
  377. _Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt,
  378. _Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched
  379. ) = 0;
  380. /// <summary>
  381. /// Skips the next set of product instances in the enumeration sequence.
  382. /// </summary>
  383. /// <param name="celt">The number of product instances to skip.</param>
  384. /// <returns>S_OK if the number of elements could be skipped; otherwise, S_FALSE;</returns>
  385. STDMETHOD(Skip)(
  386. _In_ ULONG celt
  387. ) = 0;
  388. /// <summary>
  389. /// Resets the enumeration sequence to the beginning.
  390. /// </summary>
  391. /// <returns>Always returns S_OK;</returns>
  392. STDMETHOD(Reset)(void) = 0;
  393. /// <summary>
  394. /// 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.
  395. /// </summary>
  396. /// <param name="ppenum">A pointer to a pointer to a new <see cref="IEnumSetupInstances"/> interface. If the method fails, this parameter is undefined.</param>
  397. /// <returns>S_OK if a clone was returned; otherwise, E_OUTOFMEMORY.</returns>
  398. STDMETHOD(Clone)(
  399. _Deref_out_opt_ IEnumSetupInstances** ppenum
  400. ) = 0;
  401. };
  402. #endif
  403. EXTERN_C const IID IID_ISetupConfiguration;
  404. #if defined(__cplusplus) && !defined(CINTERFACE)
  405. /// <summary>
  406. /// Gets information about product instances installed on the machine.
  407. /// </summary>
  408. struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown
  409. {
  410. /// <summary>
  411. /// Enumerates all launchable product instances installed.
  412. /// </summary>
  413. /// <param name="ppEnumInstances">An enumeration of completed, installed product instances.</param>
  414. /// <returns>Standard HRESULT indicating success or failure.</returns>
  415. STDMETHOD(EnumInstances)(
  416. _Out_ IEnumSetupInstances** ppEnumInstances
  417. ) = 0;
  418. /// <summary>
  419. /// Gets the instance for the current process path.
  420. /// </summary>
  421. /// <param name="ppInstance">The instance for the current process path.</param>
  422. /// <returns>
  423. /// The instance for the current process path, or E_NOTFOUND if not found.
  424. /// The <see cref="ISetupInstance::GetState"/> may indicate the instance is invalid.
  425. /// </returns>
  426. /// <remarks>
  427. /// The returned instance may not be launchable.
  428. /// </remarks>
  429. STDMETHOD(GetInstanceForCurrentProcess)(
  430. _Out_ ISetupInstance** ppInstance
  431. ) = 0;
  432. /// <summary>
  433. /// Gets the instance for the given path.
  434. /// </summary>
  435. /// <param name="ppInstance">The instance for the given path.</param>
  436. /// <returns>
  437. /// The instance for the given path, or E_NOTFOUND if not found.
  438. /// The <see cref="ISetupInstance::GetState"/> may indicate the instance is invalid.
  439. /// </returns>
  440. /// <remarks>
  441. /// The returned instance may not be launchable.
  442. /// </remarks>
  443. STDMETHOD(GetInstanceForPath)(
  444. _In_z_ LPCWSTR wzPath,
  445. _Out_ ISetupInstance** ppInstance
  446. ) = 0;
  447. };
  448. #endif
  449. EXTERN_C const IID IID_ISetupConfiguration2;
  450. #if defined(__cplusplus) && !defined(CINTERFACE)
  451. /// <summary>
  452. /// Gets information about product instances.
  453. /// </summary>
  454. struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration
  455. {
  456. /// <summary>
  457. /// Enumerates all product instances.
  458. /// </summary>
  459. /// <param name="ppEnumInstances">An enumeration of all product instances.</param>
  460. /// <returns>Standard HRESULT indicating success or failure.</returns>
  461. STDMETHOD(EnumAllInstances)(
  462. _Out_ IEnumSetupInstances** ppEnumInstances
  463. ) = 0;
  464. };
  465. #endif
  466. EXTERN_C const IID IID_ISetupPackageReference;
  467. #if defined(__cplusplus) && !defined(CINTERFACE)
  468. /// <summary>
  469. /// A reference to a package.
  470. /// </summary>
  471. struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown
  472. {
  473. /// <summary>
  474. /// Gets the general package identifier.
  475. /// </summary>
  476. /// <param name="pbstrId">The general package identifier.</param>
  477. /// <returns>Standard HRESULT indicating success or failure.</returns>
  478. STDMETHOD(GetId)(
  479. _Out_ BSTR* pbstrId
  480. ) = 0;
  481. /// <summary>
  482. /// Gets the version of the package.
  483. /// </summary>
  484. /// <param name="pbstrVersion">The version of the package.</param>
  485. /// <returns>Standard HRESULT indicating success or failure.</returns>
  486. STDMETHOD(GetVersion)(
  487. _Out_ BSTR* pbstrVersion
  488. ) = 0;
  489. /// <summary>
  490. /// Gets the target process architecture of the package.
  491. /// </summary>
  492. /// <param name="pbstrChip">The target process architecture of the package.</param>
  493. /// <returns>Standard HRESULT indicating success or failure.</returns>
  494. STDMETHOD(GetChip)(
  495. _Out_ BSTR* pbstrChip
  496. ) = 0;
  497. /// <summary>
  498. /// Gets the language and optional region identifier.
  499. /// </summary>
  500. /// <param name="pbstrLanguage">The language and optional region identifier.</param>
  501. /// <returns>Standard HRESULT indicating success or failure.</returns>
  502. STDMETHOD(GetLanguage)(
  503. _Out_ BSTR* pbstrLanguage
  504. ) = 0;
  505. /// <summary>
  506. /// Gets the build branch of the package.
  507. /// </summary>
  508. /// <param name="pbstrBranch">The build branch of the package.</param>
  509. /// <returns>Standard HRESULT indicating success or failure.</returns>
  510. STDMETHOD(GetBranch)(
  511. _Out_ BSTR* pbstrBranch
  512. ) = 0;
  513. /// <summary>
  514. /// Gets the type of the package.
  515. /// </summary>
  516. /// <param name="pbstrType">The type of the package.</param>
  517. /// <returns>Standard HRESULT indicating success or failure.</returns>
  518. STDMETHOD(GetType)(
  519. _Out_ BSTR* pbstrType
  520. ) = 0;
  521. /// <summary>
  522. /// Gets the unique identifier consisting of all defined tokens.
  523. /// </summary>
  524. /// <param name="pbstrUniqueId">The unique identifier consisting of all defined tokens.</param>
  525. /// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
  526. STDMETHOD(GetUniqueId)(
  527. _Out_ BSTR* pbstrUniqueId
  528. ) = 0;
  529. /// <summary>
  530. /// Gets a value indicating whether the package refers to an external extension.
  531. /// </summary>
  532. /// <param name="pfIsExtension">A value indicating whether the package refers to an external extension.</param>
  533. /// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
  534. STDMETHOD(GetIsExtension)(
  535. _Out_ VARIANT_BOOL* pfIsExtension
  536. ) = 0;
  537. };
  538. #endif
  539. EXTERN_C const IID IID_ISetupHelper;
  540. #if defined(__cplusplus) && !defined(CINTERFACE)
  541. /// <summary>
  542. /// Helper functions.
  543. /// </summary>
  544. /// <remarks>
  545. /// You can query for this interface from the <see cref="SetupConfiguration"/> class.
  546. /// </remarks>
  547. struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown
  548. {
  549. /// <summary>
  550. /// Parses a dotted quad version string into a 64-bit unsigned integer.
  551. /// </summary>
  552. /// <param name="pwszVersion">The dotted quad version string to parse, e.g. 1.2.3.4.</param>
  553. /// <param name="pullVersion">A 64-bit unsigned integer representing the version. You can compare this to other versions.</param>
  554. /// <returns>Standard HRESULT indicating success or failure, including E_INVALIDARG if the version is not valid.</returns>
  555. STDMETHOD(ParseVersion)(
  556. _In_ LPCOLESTR pwszVersion,
  557. _Out_ PULONGLONG pullVersion
  558. ) = 0;
  559. /// <summary>
  560. /// Parses a dotted quad version string into a 64-bit unsigned integer.
  561. /// </summary>
  562. /// <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>
  563. /// <param name="pullMinVersion">A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions.</param>
  564. /// <param name="pullMaxVersion">A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions.</param>
  565. /// <returns>Standard HRESULT indicating success or failure, including E_INVALIDARG if the version range is not valid.</returns>
  566. STDMETHOD(ParseVersionRange)(
  567. _In_ LPCOLESTR pwszVersionRange,
  568. _Out_ PULONGLONG pullMinVersion,
  569. _Out_ PULONGLONG pullMaxVersion
  570. ) = 0;
  571. };
  572. #endif
  573. EXTERN_C const IID IID_ISetupErrorState;
  574. #if defined(__cplusplus) && !defined(CINTERFACE)
  575. /// <summary>
  576. /// Information about the error state of an instance.
  577. /// </summary>
  578. struct DECLSPEC_UUID("46DCCD94-A287-476A-851E-DFBC2FFDBC20") DECLSPEC_NOVTABLE ISetupErrorState : public IUnknown
  579. {
  580. /// <summary>
  581. /// Gets an array of failed package references.
  582. /// </summary>
  583. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupFailedPackageReference"/>, if packages have failed.</param>
  584. /// <returns>Standard HRESULT indicating success or failure.</returns>
  585. STDMETHOD(GetFailedPackages)(
  586. _Outptr_result_maybenull_ LPSAFEARRAY* ppsaFailedPackages
  587. ) = 0;
  588. /// <summary>
  589. /// Gets an array of skipped package references.
  590. /// </summary>
  591. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>, if packages have been skipped.</param>
  592. /// <returns>Standard HRESULT indicating success or failure.</returns>
  593. STDMETHOD(GetSkippedPackages)(
  594. _Outptr_result_maybenull_ LPSAFEARRAY* ppsaSkippedPackages
  595. ) = 0;
  596. };
  597. #endif
  598. EXTERN_C const IID IID_ISetupErrorState2;
  599. #if defined(__cplusplus) && !defined(CINTERFACE)
  600. /// <summary>
  601. /// Information about the error state of an instance.
  602. /// </summary>
  603. struct DECLSPEC_UUID("9871385B-CA69-48F2-BC1F-7A37CBF0B1EF") DECLSPEC_NOVTABLE ISetupErrorState2 : public ISetupErrorState
  604. {
  605. /// <summary>
  606. /// Gets the path to the error log.
  607. /// </summary>
  608. /// <param name="pbstrChip">The path to the error log.</param>
  609. /// <returns>Standard HRESULT indicating success or failure.</returns>
  610. STDMETHOD(GetErrorLogFilePath)(
  611. _Outptr_result_maybenull_ BSTR* pbstrErrorLogFilePath
  612. ) = 0;
  613. /// <summary>
  614. /// Gets the path to the main setup log.
  615. /// </summary>
  616. /// <param name="pbstrChip">The path to the main setup log.</param>
  617. /// <returns>Standard HRESULT indicating success or failure.</returns>
  618. STDMETHOD(GetLogFilePath)(
  619. _Outptr_result_maybenull_ BSTR* pbstrLogFilePath
  620. ) = 0;
  621. };
  622. #endif
  623. EXTERN_C const IID IID_ISetupFailedPackageReference;
  624. #if defined(__cplusplus) && !defined(CINTERFACE)
  625. /// <summary>
  626. /// A reference to a failed package.
  627. /// </summary>
  628. struct DECLSPEC_UUID("E73559CD-7003-4022-B134-27DC650B280F") DECLSPEC_NOVTABLE ISetupFailedPackageReference : public ISetupPackageReference
  629. {
  630. };
  631. #endif
  632. EXTERN_C const IID IID_ISetupFailedPackageReference2;
  633. #if defined(__cplusplus) && !defined(CINTERFACE)
  634. /// <summary>
  635. /// A reference to a failed package.
  636. /// </summary>
  637. struct DECLSPEC_UUID("0FAD873E-E874-42E3-B268-4FE2F096B9CA") DECLSPEC_NOVTABLE ISetupFailedPackageReference2 : public ISetupFailedPackageReference
  638. {
  639. /// <summary>
  640. /// Gets the path to the optional package log.
  641. /// </summary>
  642. /// <param name="pbstrId">The path to the optional package log.</param>
  643. /// <returns>Standard HRESULT indicating success or failure.</returns>
  644. STDMETHOD(GetLogFilePath)(
  645. _Outptr_result_maybenull_ BSTR* pbstrLogFilePath
  646. ) = 0;
  647. /// <summary>
  648. /// Gets the description of the package failure.
  649. /// </summary>
  650. /// <param name="pbstrId">The description of the package failure.</param>
  651. /// <returns>Standard HRESULT indicating success or failure.</returns>
  652. STDMETHOD(GetDescription)(
  653. _Outptr_result_maybenull_ BSTR* pbstrDescription
  654. ) = 0;
  655. /// <summary>
  656. /// Gets the signature to use for feedback reporting.
  657. /// </summary>
  658. /// <param name="pbstrId">The signature to use for feedback reporting.</param>
  659. /// <returns>Standard HRESULT indicating success or failure.</returns>
  660. STDMETHOD(GetSignature)(
  661. _Outptr_result_maybenull_ BSTR* pbstrSignature
  662. ) = 0;
  663. /// <summary>
  664. /// Gets the array of details for this package failure.
  665. /// </summary>
  666. /// <param name="ppsaDetails">Pointer to an array of details as BSTRs.</param>
  667. /// <returns>Standard HRESULT indicating success or failure.</returns>
  668. STDMETHOD(GetDetails)(
  669. _Out_ LPSAFEARRAY* ppsaDetails
  670. ) = 0;
  671. /// <summary>
  672. /// Gets an array of packages affected by this package failure.
  673. /// </summary>
  674. /// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/> for packages affected by this package failure. This may be NULL.</param>
  675. /// <returns>Standard HRESULT indicating success or failure.</returns>
  676. STDMETHOD(GetAffectedPackages)(
  677. _Out_ LPSAFEARRAY* ppsaAffectedPackages
  678. ) = 0;
  679. };
  680. #endif
  681. EXTERN_C const IID IID_ISetupFailedPackageReference3;
  682. #if defined(__cplusplus) && !defined(CINTERFACE)
  683. /// <summary>
  684. /// A reference to a failed package.
  685. /// </summary>
  686. struct DECLSPEC_UUID("EBC3AE68-AD15-44E8-8377-39DBF0316F6C") DECLSPEC_NOVTABLE ISetupFailedPackageReference3 : public ISetupFailedPackageReference2
  687. {
  688. /// <summary>
  689. /// Gets the action attempted when the package failed.
  690. /// </summary>
  691. /// <param name="pbstrAction">The action, eg: Install, Download, etc.</param>
  692. /// <returns>Standard HRESULT indicating success or failure.</returns>
  693. STDMETHOD(GetAction)(
  694. _Outptr_result_maybenull_ BSTR* pbstrAction
  695. ) = 0;
  696. /// <summary>
  697. /// Gets the return code of the failure.
  698. /// </summary>
  699. /// <param name="pbstrReturnCode">The return code.</param>
  700. /// <returns>Standard HRESULT indicating success or failure.</returns>
  701. STDMETHOD(GetReturnCode)(
  702. _Outptr_result_maybenull_ BSTR* pbstrReturnCode
  703. ) = 0;
  704. };
  705. #endif
  706. EXTERN_C const IID IID_ISetupPropertyStore;
  707. #if defined(__cplusplus) && !defined(CINTERFACE)
  708. /// <summary>
  709. /// Provides named properties.
  710. /// </summary>
  711. /// <remarks>
  712. /// You can get this from an <see cref="ISetupInstance"/>, <see cref="ISetupPackageReference"/>, or derivative.
  713. /// </remarks>
  714. struct DECLSPEC_UUID("C601C175-A3BE-44BC-91F6-4568D230FC83") DECLSPEC_NOVTABLE ISetupPropertyStore : public IUnknown
  715. {
  716. /// <summary>
  717. /// Gets an array of property names in this property store.
  718. /// </summary>
  719. /// <param name="ppsaNames">Pointer to an array of property names as BSTRs.</param>
  720. /// <returns>Standard HRESULT indicating success or failure.</returns>
  721. STDMETHOD(GetNames)(
  722. _Out_ LPSAFEARRAY* ppsaNames
  723. ) = 0;
  724. /// <summary>
  725. /// Gets the value of a named property in this property store.
  726. /// </summary>
  727. /// <param name="pwszName">The name of the property to get.</param>
  728. /// <param name="pvtValue">The value of the property.</param>
  729. /// <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>
  730. STDMETHOD(GetValue)(
  731. _In_ LPCOLESTR pwszName,
  732. _Out_ LPVARIANT pvtValue
  733. ) = 0;
  734. };
  735. #endif
  736. EXTERN_C const IID IID_ISetupLocalizedPropertyStore;
  737. #if defined(__cplusplus) && !defined(CINTERFACE)
  738. /// <summary>
  739. /// Provides localized named properties.
  740. /// </summary>
  741. /// <remarks>
  742. /// You can get this from an <see cref="ISetupLocalizedProperties"/>.
  743. /// </remarks>
  744. struct DECLSPEC_UUID("5BB53126-E0D5-43DF-80F1-6B161E5C6F6C") DECLSPEC_NOVTABLE ISetupLocalizedPropertyStore : public IUnknown
  745. {
  746. /// <summary>
  747. /// Gets an array of property names in this property store.
  748. /// </summary>
  749. /// <param name="lcid">The LCID for the property names.</param>
  750. /// <param name="ppsaNames">Pointer to an array of property names as BSTRs.</param>
  751. /// <returns>Standard HRESULT indicating success or failure.</returns>
  752. STDMETHOD(GetNames)(
  753. _In_ LCID lcid,
  754. _Out_ LPSAFEARRAY* ppsaNames
  755. ) = 0;
  756. /// <summary>
  757. /// Gets the value of a named property in this property store.
  758. /// </summary>
  759. /// <param name="pwszName">The name of the property to get.</param>
  760. /// <param name="lcid">The LCID for the property.</param>
  761. /// <param name="pvtValue">The value of the property.</param>
  762. /// <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>
  763. STDMETHOD(GetValue)(
  764. _In_ LPCOLESTR pwszName,
  765. _In_ LCID lcid,
  766. _Out_ LPVARIANT pvtValue
  767. ) = 0;
  768. };
  769. #endif
  770. // Class declarations
  771. //
  772. EXTERN_C const CLSID CLSID_SetupConfiguration;
  773. #ifdef __cplusplus
  774. /// <summary>
  775. /// This class implements <see cref="ISetupConfiguration"/>, <see cref="ISetupConfiguration2"/>, and <see cref="ISetupHelper"/>.
  776. /// </summary>
  777. class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration;
  778. #endif
  779. // Function declarations
  780. //
  781. /// <summary>
  782. /// Gets an <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.
  783. /// </summary>
  784. /// <param name="ppConfiguration">The <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.</param>
  785. /// <param name="pReserved">Reserved for future use.</param>
  786. /// <returns>Standard HRESULT indicating success or failure.</returns>
  787. STDMETHODIMP GetSetupConfiguration(
  788. _Out_ ISetupConfiguration** ppConfiguration,
  789. _Reserved_ LPVOID pReserved
  790. );
  791. #ifdef __cplusplus
  792. }
  793. #endif