Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/cmvssetup/Setup.Configuration.h
3148 views
1
// <copyright file="Setup.Configuration.h" company="Microsoft Corporation">
2
// Copyright (C) Microsoft Corporation. All rights reserved.
3
// </copyright>
4
5
// This file is licensed under "The MIT License(MIT)".
6
// This file is released by Visual Studio setup team for consumption by external applications.
7
// For more information please look at this git repo https://github.com/microsoft/vs-setup-samples
8
9
#ifndef SetupConfiguration_h
10
#define SetupConfiguration_h
11
12
#include <objbase.h>
13
14
// Constants
15
//
16
#ifndef E_NOTFOUND
17
#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
18
#endif
19
20
#ifndef E_FILENOTFOUND
21
#define E_FILENOTFOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
22
#endif
23
24
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
25
26
#ifndef _Outptr_result_maybenull_
27
#define _Outptr_result_maybenull_
28
#endif
29
#ifndef _Out_writes_to_
30
#define _Out_writes_to_(x,y)
31
#endif
32
#ifndef _Reserved_
33
#define _Reserved_
34
#endif
35
#ifndef MAXUINT
36
#define MAXUINT ((UINT)~((UINT)0))
37
#endif
38
39
// Enumerations
40
//
41
/// <summary>
42
/// The state of an instance.
43
/// </summary>
44
enum InstanceState
45
{
46
/// <summary>
47
/// The instance state has not been determined.
48
/// </summary>
49
eNone = 0,
50
51
/// <summary>
52
/// The instance installation path exists.
53
/// </summary>
54
eLocal = 1,
55
56
/// <summary>
57
/// A product is registered to the instance.
58
/// </summary>
59
eRegistered = 2,
60
61
/// <summary>
62
/// No reboot is required for the instance.
63
/// </summary>
64
eNoRebootRequired = 4,
65
66
/// <summary>
67
/// The instance represents a complete install.
68
/// </summary>
69
eComplete = MAXUINT,
70
};
71
72
// Forward interface declarations
73
//
74
#ifndef __ISetupInstance_FWD_DEFINED__
75
#define __ISetupInstance_FWD_DEFINED__
76
typedef struct ISetupInstance ISetupInstance;
77
#endif
78
79
#ifndef __ISetupInstance2_FWD_DEFINED__
80
#define __ISetupInstance2_FWD_DEFINED__
81
typedef struct ISetupInstance2 ISetupInstance2;
82
#endif
83
84
#ifndef __IEnumSetupInstances_FWD_DEFINED__
85
#define __IEnumSetupInstances_FWD_DEFINED__
86
typedef struct IEnumSetupInstances IEnumSetupInstances;
87
#endif
88
89
#ifndef __ISetupConfiguration_FWD_DEFINED__
90
#define __ISetupConfiguration_FWD_DEFINED__
91
typedef struct ISetupConfiguration ISetupConfiguration;
92
#endif
93
94
#ifndef __ISetupConfiguration2_FWD_DEFINED__
95
#define __ISetupConfiguration2_FWD_DEFINED__
96
typedef struct ISetupConfiguration2 ISetupConfiguration2;
97
#endif
98
99
#ifndef __ISetupPackageReference_FWD_DEFINED__
100
#define __ISetupPackageReference_FWD_DEFINED__
101
typedef struct ISetupPackageReference ISetupPackageReference;
102
#endif
103
104
#ifndef __ISetupHelper_FWD_DEFINED__
105
#define __ISetupHelper_FWD_DEFINED__
106
typedef struct ISetupHelper ISetupHelper;
107
#endif
108
109
// Forward class declarations
110
//
111
#ifndef __SetupConfiguration_FWD_DEFINED__
112
#define __SetupConfiguration_FWD_DEFINED__
113
114
#ifdef __cplusplus
115
typedef class SetupConfiguration SetupConfiguration;
116
#endif
117
118
#endif
119
120
#ifdef __cplusplus
121
extern "C" {
122
#endif
123
124
// Interface definitions
125
//
126
EXTERN_C const IID IID_ISetupInstance;
127
128
#if defined(__cplusplus) && !defined(CINTERFACE)
129
/// <summary>
130
/// Information about an instance of a product.
131
/// </summary>
132
struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
133
{
134
/// <summary>
135
/// Gets the instance identifier (should match the name of the parent instance directory).
136
/// </summary>
137
/// <param name="pbstrInstanceId">The instance identifier.</param>
138
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
139
STDMETHOD(GetInstanceId)(
140
_Out_ BSTR* pbstrInstanceId
141
) = 0;
142
143
/// <summary>
144
/// Gets the local date and time when the installation was originally installed.
145
/// </summary>
146
/// <param name="pInstallDate">The local date and time when the installation was originally installed.</param>
147
/// <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>
148
STDMETHOD(GetInstallDate)(
149
_Out_ LPFILETIME pInstallDate
150
) = 0;
151
152
/// <summary>
153
/// Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
154
/// </summary>
155
/// <param name="pbstrInstallationName">The unique name of the installation, often indicating the branch and other information used for telemetry.</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(GetInstallationName)(
158
_Out_ BSTR* pbstrInstallationName
159
) = 0;
160
161
/// <summary>
162
/// Gets the path to the installation root of the product.
163
/// </summary>
164
/// <param name="pbstrInstallationPath">The path to the installation root of the product.</param>
165
/// <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>
166
STDMETHOD(GetInstallationPath)(
167
_Out_ BSTR* pbstrInstallationPath
168
) = 0;
169
170
/// <summary>
171
/// Gets the version of the product installed in this instance.
172
/// </summary>
173
/// <param name="pbstrInstallationVersion">The version of the product installed in this instance.</param>
174
/// <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>
175
STDMETHOD(GetInstallationVersion)(
176
_Out_ BSTR* pbstrInstallationVersion
177
) = 0;
178
179
/// <summary>
180
/// Gets the display name (title) of the product installed in this instance.
181
/// </summary>
182
/// <param name="lcid">The LCID for the display name.</param>
183
/// <param name="pbstrDisplayName">The display name (title) of the product installed in this instance.</param>
184
/// <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>
185
STDMETHOD(GetDisplayName)(
186
_In_ LCID lcid,
187
_Out_ BSTR* pbstrDisplayName
188
) = 0;
189
190
/// <summary>
191
/// Gets the description of the product installed in this instance.
192
/// </summary>
193
/// <param name="lcid">The LCID for the description.</param>
194
/// <param name="pbstrDescription">The description of the product installed in this instance.</param>
195
/// <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>
196
STDMETHOD(GetDescription)(
197
_In_ LCID lcid,
198
_Out_ BSTR* pbstrDescription
199
) = 0;
200
201
/// <summary>
202
/// Resolves the optional relative path to the root path of the instance.
203
/// </summary>
204
/// <param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
205
/// <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>
206
/// <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>
207
STDMETHOD(ResolvePath)(
208
_In_opt_z_ LPCOLESTR pwszRelativePath,
209
_Out_ BSTR* pbstrAbsolutePath
210
) = 0;
211
};
212
#endif
213
214
EXTERN_C const IID IID_ISetupInstance2;
215
216
#if defined(__cplusplus) && !defined(CINTERFACE)
217
/// <summary>
218
/// Information about an instance of a product.
219
/// </summary>
220
struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance
221
{
222
/// <summary>
223
/// Gets the state of the instance.
224
/// </summary>
225
/// <param name="pState">The state of the instance.</param>
226
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
227
STDMETHOD(GetState)(
228
_Out_ InstanceState* pState
229
) = 0;
230
231
/// <summary>
232
/// Gets an array of package references registered to the instance.
233
/// </summary>
234
/// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>.</param>
235
/// <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>
236
STDMETHOD(GetPackages)(
237
_Out_ LPSAFEARRAY* ppsaPackages
238
) = 0;
239
240
/// <summary>
241
/// Gets a pointer to the <see cref="ISetupPackageReference"/> that represents the registered product.
242
/// </summary>
243
/// <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>
244
/// <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>
245
STDMETHOD(GetProduct)(
246
_Outptr_result_maybenull_ ISetupPackageReference** ppPackage
247
) = 0;
248
249
/// <summary>
250
/// Gets the relative path to the product application, if available.
251
/// </summary>
252
/// <param name="pbstrProductPath">The relative path to the product application, if available.</param>
253
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
254
STDMETHOD(GetProductPath)(
255
_Outptr_result_maybenull_ BSTR* pbstrProductPath
256
) = 0;
257
};
258
#endif
259
260
EXTERN_C const IID IID_IEnumSetupInstances;
261
262
#if defined(__cplusplus) && !defined(CINTERFACE)
263
/// <summary>
264
/// A enumerator of installed <see cref="ISetupInstance"/> objects.
265
/// </summary>
266
struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown
267
{
268
/// <summary>
269
/// Retrieves the next set of product instances in the enumeration sequence.
270
/// </summary>
271
/// <param name="celt">The number of product instances to retrieve.</param>
272
/// <param name="rgelt">A pointer to an array of <see cref="ISetupInstance"/>.</param>
273
/// <param name="pceltFetched">A pointer to the number of product instances retrieved. If celt is 1 this parameter may be NULL.</param>
274
/// <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>
275
STDMETHOD(Next)(
276
_In_ ULONG celt,
277
_Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt,
278
_Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched
279
) = 0;
280
281
/// <summary>
282
/// Skips the next set of product instances in the enumeration sequence.
283
/// </summary>
284
/// <param name="celt">The number of product instances to skip.</param>
285
/// <returns>S_OK if the number of elements could be skipped; otherwise, S_FALSE;</returns>
286
STDMETHOD(Skip)(
287
_In_ ULONG celt
288
) = 0;
289
290
/// <summary>
291
/// Resets the enumeration sequence to the beginning.
292
/// </summary>
293
/// <returns>Always returns S_OK;</returns>
294
STDMETHOD(Reset)(void) = 0;
295
296
/// <summary>
297
/// 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.
298
/// </summary>
299
/// <param name="ppenum">A pointer to a pointer to a new <see cref="IEnumSetupInstances"/> interface. If the method fails, this parameter is undefined.</param>
300
/// <returns>S_OK if a clone was returned; otherwise, E_OUTOFMEMORY.</returns>
301
STDMETHOD(Clone)(
302
_Deref_out_opt_ IEnumSetupInstances** ppenum
303
) = 0;
304
};
305
#endif
306
307
EXTERN_C const IID IID_ISetupConfiguration;
308
309
#if defined(__cplusplus) && !defined(CINTERFACE)
310
/// <summary>
311
/// Gets information about product instances set up on the machine.
312
/// </summary>
313
struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown
314
{
315
/// <summary>
316
/// Enumerates all completed product instances installed.
317
/// </summary>
318
/// <param name="ppEnumInstances">An enumeration of completed, installed product instances.</param>
319
/// <returns>Standard HRESULT indicating success or failure.</returns>
320
STDMETHOD(EnumInstances)(
321
_Out_ IEnumSetupInstances** ppEnumInstances
322
) = 0;
323
324
/// <summary>
325
/// Gets the instance for the current process path.
326
/// </summary>
327
/// <param name="ppInstance">The instance for the current process path.</param>
328
/// <returns>The instance for the current process path, or E_NOTFOUND if not found.</returns>
329
STDMETHOD(GetInstanceForCurrentProcess)(
330
_Out_ ISetupInstance** ppInstance
331
) = 0;
332
333
/// <summary>
334
/// Gets the instance for the given path.
335
/// </summary>
336
/// <param name="ppInstance">The instance for the given path.</param>
337
/// <returns>The instance for the given path, or E_NOTFOUND if not found.</returns>
338
STDMETHOD(GetInstanceForPath)(
339
_In_z_ LPCWSTR wzPath,
340
_Out_ ISetupInstance** ppInstance
341
) = 0;
342
};
343
#endif
344
345
EXTERN_C const IID IID_ISetupConfiguration2;
346
347
#if defined(__cplusplus) && !defined(CINTERFACE)
348
/// <summary>
349
/// Gets information about product instances.
350
/// </summary>
351
struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration
352
{
353
/// <summary>
354
/// Enumerates all product instances.
355
/// </summary>
356
/// <param name="ppEnumInstances">An enumeration of all product instances.</param>
357
/// <returns>Standard HRESULT indicating success or failure.</returns>
358
STDMETHOD(EnumAllInstances)(
359
_Out_ IEnumSetupInstances** ppEnumInstances
360
) = 0;
361
};
362
#endif
363
364
EXTERN_C const IID IID_ISetupPackageReference;
365
366
#if defined(__cplusplus) && !defined(CINTERFACE)
367
/// <summary>
368
/// A reference to a package.
369
/// </summary>
370
struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown
371
{
372
/// <summary>
373
/// Gets the general package identifier.
374
/// </summary>
375
/// <param name="pbstrId">The general package identifier.</param>
376
/// <returns>Standard HRESULT indicating success or failure.</returns>
377
STDMETHOD(GetId)(
378
_Out_ BSTR* pbstrId
379
) = 0;
380
381
/// <summary>
382
/// Gets the version of the package.
383
/// </summary>
384
/// <param name="pbstrVersion">The version of the package.</param>
385
/// <returns>Standard HRESULT indicating success or failure.</returns>
386
STDMETHOD(GetVersion)(
387
_Out_ BSTR* pbstrVersion
388
) = 0;
389
390
/// <summary>
391
/// Gets the target process architecture of the package.
392
/// </summary>
393
/// <param name="pbstrChip">The target process architecture of the package.</param>
394
/// <returns>Standard HRESULT indicating success or failure.</returns>
395
STDMETHOD(GetChip)(
396
_Out_ BSTR* pbstrChip
397
) = 0;
398
399
/// <summary>
400
/// Gets the language and optional region identifier.
401
/// </summary>
402
/// <param name="pbstrLanguage">The language and optional region identifier.</param>
403
/// <returns>Standard HRESULT indicating success or failure.</returns>
404
STDMETHOD(GetLanguage)(
405
_Out_ BSTR* pbstrLanguage
406
) = 0;
407
408
/// <summary>
409
/// Gets the build branch of the package.
410
/// </summary>
411
/// <param name="pbstrBranch">The build branch of the package.</param>
412
/// <returns>Standard HRESULT indicating success or failure.</returns>
413
STDMETHOD(GetBranch)(
414
_Out_ BSTR* pbstrBranch
415
) = 0;
416
417
/// <summary>
418
/// Gets the type of the package.
419
/// </summary>
420
/// <param name="pbstrType">The type of the package.</param>
421
/// <returns>Standard HRESULT indicating success or failure.</returns>
422
STDMETHOD(GetType)(
423
_Out_ BSTR* pbstrType
424
) = 0;
425
426
/// <summary>
427
/// Gets the unique identifier consisting of all defined tokens.
428
/// </summary>
429
/// <param name="pbstrUniqueId">The unique identifier consisting of all defined tokens.</param>
430
/// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
431
STDMETHOD(GetUniqueId)(
432
_Out_ BSTR* pbstrUniqueId
433
) = 0;
434
};
435
#endif
436
437
EXTERN_C const IID IID_ISetupHelper;
438
439
#if defined(__cplusplus) && !defined(CINTERFACE)
440
/// <summary>
441
/// Helper functions.
442
/// </summary>
443
/// <remarks>
444
/// You can query for this interface from the <see cref="SetupConfiguration"/> class.
445
/// </remarks>
446
struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown
447
{
448
/// <summary>
449
/// Parses a dotted quad version string into a 64-bit unsigned integer.
450
/// </summary>
451
/// <param name="pwszVersion">The dotted quad version string to parse, e.g. 1.2.3.4.</param>
452
/// <param name="pullVersion">A 64-bit unsigned integer representing the version. You can compare this to other versions.</param>
453
/// <returns>Standard HRESULT indicating success or failure.</returns>
454
STDMETHOD(ParseVersion)(
455
_In_ LPCOLESTR pwszVersion,
456
_Out_ PULONGLONG pullVersion
457
) = 0;
458
459
/// <summary>
460
/// Parses a dotted quad version string into a 64-bit unsigned integer.
461
/// </summary>
462
/// <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>
463
/// <param name="pullMinVersion">A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions.</param>
464
/// <param name="pullMaxVersion">A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions.</param>
465
/// <returns>Standard HRESULT indicating success or failure.</returns>
466
STDMETHOD(ParseVersionRange)(
467
_In_ LPCOLESTR pwszVersionRange,
468
_Out_ PULONGLONG pullMinVersion,
469
_Out_ PULONGLONG pullMaxVersion
470
) = 0;
471
};
472
#endif
473
474
// Class declarations
475
//
476
EXTERN_C const CLSID CLSID_SetupConfiguration;
477
478
#ifdef __cplusplus
479
/// <summary>
480
/// This class implements <see cref="ISetupConfiguration"/>, <see cref="ISetupConfiguration2"/>, and <see cref="ISetupHelper"/>.
481
/// </summary>
482
class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration;
483
#endif
484
485
// Function declarations
486
//
487
/// <summary>
488
/// Gets an <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.
489
/// </summary>
490
/// <param name="ppConfiguration">The <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.</param>
491
/// <param name="pReserved">Reserved for future use.</param>
492
/// <returns>Standard HRESULT indicating success or failure.</returns>
493
STDMETHODIMP GetSetupConfiguration(
494
_Out_ ISetupConfiguration** ppConfiguration,
495
_Reserved_ LPVOID pReserved
496
);
497
498
#ifdef __cplusplus
499
}
500
#endif
501
502
#else
503
504
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
505
#define VS_SETUP_GCC_DIAGNOSTIC_PUSHED
506
#pragma GCC diagnostic push
507
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
508
#endif
509
510
#ifndef MAXUINT
511
#define MAXUINT ((UINT)~((UINT)0))
512
#endif
513
514
#ifndef DECLSPEC_NOVTABLE
515
#if (_MSC_VER >= 1100) && defined(__cplusplus)
516
#define DECLSPEC_NOVTABLE __declspec(novtable)
517
#else
518
#define DECLSPEC_NOVTABLE
519
#endif
520
#endif
521
522
// Enumerations
523
//
524
/// <summary>
525
/// The state of an instance.
526
/// </summary>
527
enum InstanceState
528
{
529
/// <summary>
530
/// The instance state has not been determined.
531
/// </summary>
532
eNone = 0,
533
534
/// <summary>
535
/// The instance installation path exists.
536
/// </summary>
537
eLocal = 1,
538
539
/// <summary>
540
/// A product is registered to the instance.
541
/// </summary>
542
eRegistered = 2,
543
544
/// <summary>
545
/// No reboot is required for the instance.
546
/// </summary>
547
eNoRebootRequired = 4,
548
549
/// <summary>
550
/// The instance represents a complete install.
551
/// </summary>
552
eComplete = MAXUINT,
553
};
554
555
// Forward interface declarations
556
//
557
#ifndef __ISetupInstance_FWD_DEFINED__
558
#define __ISetupInstance_FWD_DEFINED__
559
typedef struct ISetupInstance ISetupInstance;
560
#endif
561
562
#ifndef __ISetupInstance2_FWD_DEFINED__
563
#define __ISetupInstance2_FWD_DEFINED__
564
typedef struct ISetupInstance2 ISetupInstance2;
565
#endif
566
567
#ifndef __IEnumSetupInstances_FWD_DEFINED__
568
#define __IEnumSetupInstances_FWD_DEFINED__
569
typedef struct IEnumSetupInstances IEnumSetupInstances;
570
#endif
571
572
#ifndef __ISetupConfiguration_FWD_DEFINED__
573
#define __ISetupConfiguration_FWD_DEFINED__
574
typedef struct ISetupConfiguration ISetupConfiguration;
575
#endif
576
577
#ifndef __ISetupConfiguration2_FWD_DEFINED__
578
#define __ISetupConfiguration2_FWD_DEFINED__
579
typedef struct ISetupConfiguration2 ISetupConfiguration2;
580
#endif
581
582
#ifndef __ISetupPackageReference_FWD_DEFINED__
583
#define __ISetupPackageReference_FWD_DEFINED__
584
typedef struct ISetupPackageReference ISetupPackageReference;
585
#endif
586
587
#ifndef __ISetupHelper_FWD_DEFINED__
588
#define __ISetupHelper_FWD_DEFINED__
589
typedef struct ISetupHelper ISetupHelper;
590
#endif
591
592
// Forward class declarations
593
//
594
#ifndef __SetupConfiguration_FWD_DEFINED__
595
#define __SetupConfiguration_FWD_DEFINED__
596
597
#ifdef __cplusplus
598
typedef class SetupConfiguration SetupConfiguration;
599
#endif
600
601
#endif
602
603
#ifdef __cplusplus
604
extern "C" {
605
#endif
606
607
// Interface definitions
608
//
609
EXTERN_C const IID IID_ISetupInstance;
610
611
#if defined(__cplusplus) && !defined(CINTERFACE)
612
/// <summary>
613
/// Information about an instance of a product.
614
/// </summary>
615
struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
616
{
617
/// <summary>
618
/// Gets the instance identifier (should match the name of the parent instance directory).
619
/// </summary>
620
/// <param name="pbstrInstanceId">The instance identifier.</param>
621
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
622
STDMETHOD(GetInstanceId)(
623
BSTR* pbstrInstanceId
624
) = 0;
625
626
/// <summary>
627
/// Gets the local date and time when the installation was originally installed.
628
/// </summary>
629
/// <param name="pInstallDate">The local date and time when the installation was originally installed.</param>
630
/// <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>
631
STDMETHOD(GetInstallDate)(
632
LPFILETIME pInstallDate
633
) = 0;
634
635
/// <summary>
636
/// Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
637
/// </summary>
638
/// <param name="pbstrInstallationName">The unique name of the installation, often indicating the branch and other information used for telemetry.</param>
639
/// <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>
640
STDMETHOD(GetInstallationName)(
641
BSTR* pbstrInstallationName
642
) = 0;
643
644
/// <summary>
645
/// Gets the path to the installation root of the product.
646
/// </summary>
647
/// <param name="pbstrInstallationPath">The path to the installation root of the product.</param>
648
/// <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>
649
STDMETHOD(GetInstallationPath)(
650
BSTR* pbstrInstallationPath
651
) = 0;
652
653
/// <summary>
654
/// Gets the version of the product installed in this instance.
655
/// </summary>
656
/// <param name="pbstrInstallationVersion">The version of the product installed in this instance.</param>
657
/// <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>
658
STDMETHOD(GetInstallationVersion)(
659
BSTR* pbstrInstallationVersion
660
) = 0;
661
662
/// <summary>
663
/// Gets the display name (title) of the product installed in this instance.
664
/// </summary>
665
/// <param name="lcid">The LCID for the display name.</param>
666
/// <param name="pbstrDisplayName">The display name (title) of the product installed in this instance.</param>
667
/// <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>
668
STDMETHOD(GetDisplayName)(
669
LCID lcid,
670
BSTR* pbstrDisplayName
671
) = 0;
672
673
/// <summary>
674
/// Gets the description of the product installed in this instance.
675
/// </summary>
676
/// <param name="lcid">The LCID for the description.</param>
677
/// <param name="pbstrDescription">The description of the product installed in this instance.</param>
678
/// <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>
679
STDMETHOD(GetDescription)(
680
LCID lcid,
681
BSTR* pbstrDescription
682
) = 0;
683
684
/// <summary>
685
/// Resolves the optional relative path to the root path of the instance.
686
/// </summary>
687
/// <param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
688
/// <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>
689
/// <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>
690
STDMETHOD(ResolvePath)(
691
LPCOLESTR pwszRelativePath,
692
BSTR* pbstrAbsolutePath
693
) = 0;
694
};
695
#endif
696
697
EXTERN_C const IID IID_ISetupInstance2;
698
699
#if defined(__cplusplus) && !defined(CINTERFACE)
700
/// <summary>
701
/// Information about an instance of a product.
702
/// </summary>
703
struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance
704
{
705
/// <summary>
706
/// Gets the state of the instance.
707
/// </summary>
708
/// <param name="pState">The state of the instance.</param>
709
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
710
STDMETHOD(GetState)(
711
InstanceState* pState
712
) = 0;
713
714
/// <summary>
715
/// Gets an array of package references registered to the instance.
716
/// </summary>
717
/// <param name="ppsaPackages">Pointer to an array of <see cref="ISetupPackageReference"/>.</param>
718
/// <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>
719
STDMETHOD(GetPackages)(
720
LPSAFEARRAY* ppsaPackages
721
) = 0;
722
723
/// <summary>
724
/// Gets a pointer to the <see cref="ISetupPackageReference"/> that represents the registered product.
725
/// </summary>
726
/// <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>
727
/// <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>
728
STDMETHOD(GetProduct)(
729
ISetupPackageReference** ppPackage
730
) = 0;
731
732
/// <summary>
733
/// Gets the relative path to the product application, if available.
734
/// </summary>
735
/// <param name="pbstrProductPath">The relative path to the product application, if available.</param>
736
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
737
STDMETHOD(GetProductPath)(
738
BSTR* pbstrProductPath
739
) = 0;
740
};
741
#endif
742
743
EXTERN_C const IID IID_IEnumSetupInstances;
744
745
#if defined(__cplusplus) && !defined(CINTERFACE)
746
/// <summary>
747
/// A enumerator of installed <see cref="ISetupInstance"/> objects.
748
/// </summary>
749
struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown
750
{
751
/// <summary>
752
/// Retrieves the next set of product instances in the enumeration sequence.
753
/// </summary>
754
/// <param name="celt">The number of product instances to retrieve.</param>
755
/// <param name="rgelt">A pointer to an array of <see cref="ISetupInstance"/>.</param>
756
/// <param name="pceltFetched">A pointer to the number of product instances retrieved. If celt is 1 this parameter may be NULL.</param>
757
/// <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>
758
STDMETHOD(Next)(
759
ULONG celt,
760
ISetupInstance** rgelt,
761
ULONG* pceltFetched
762
) = 0;
763
764
/// <summary>
765
/// Skips the next set of product instances in the enumeration sequence.
766
/// </summary>
767
/// <param name="celt">The number of product instances to skip.</param>
768
/// <returns>S_OK if the number of elements could be skipped; otherwise, S_FALSE;</returns>
769
STDMETHOD(Skip)(
770
ULONG celt
771
) = 0;
772
773
/// <summary>
774
/// Resets the enumeration sequence to the beginning.
775
/// </summary>
776
/// <returns>Always returns S_OK;</returns>
777
STDMETHOD(Reset)(void) = 0;
778
779
/// <summary>
780
/// 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.
781
/// </summary>
782
/// <param name="ppenum">A pointer to a pointer to a new <see cref="IEnumSetupInstances"/> interface. If the method fails, this parameter is undefined.</param>
783
/// <returns>S_OK if a clone was returned; otherwise, E_OUTOFMEMORY.</returns>
784
STDMETHOD(Clone)(
785
IEnumSetupInstances** ppenum
786
) = 0;
787
};
788
#endif
789
790
EXTERN_C const IID IID_ISetupConfiguration;
791
792
#if defined(__cplusplus) && !defined(CINTERFACE)
793
/// <summary>
794
/// Gets information about product instances set up on the machine.
795
/// </summary>
796
struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown
797
{
798
/// <summary>
799
/// Enumerates all completed product instances installed.
800
/// </summary>
801
/// <param name="ppEnumInstances">An enumeration of completed, installed product instances.</param>
802
/// <returns>Standard HRESULT indicating success or failure.</returns>
803
STDMETHOD(EnumInstances)(
804
IEnumSetupInstances** ppEnumInstances
805
) = 0;
806
807
/// <summary>
808
/// Gets the instance for the current process path.
809
/// </summary>
810
/// <param name="ppInstance">The instance for the current process path.</param>
811
/// <returns>The instance for the current process path, or E_NOTFOUND if not found.</returns>
812
STDMETHOD(GetInstanceForCurrentProcess)(
813
ISetupInstance** ppInstance
814
) = 0;
815
816
/// <summary>
817
/// Gets the instance for the given path.
818
/// </summary>
819
/// <param name="ppInstance">The instance for the given path.</param>
820
/// <returns>The instance for the given path, or E_NOTFOUND if not found.</returns>
821
STDMETHOD(GetInstanceForPath)(
822
LPCWSTR wzPath,
823
ISetupInstance** ppInstance
824
) = 0;
825
};
826
#endif
827
828
EXTERN_C const IID IID_ISetupConfiguration2;
829
830
#if defined(__cplusplus) && !defined(CINTERFACE)
831
/// <summary>
832
/// Gets information about product instances.
833
/// </summary>
834
struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration
835
{
836
/// <summary>
837
/// Enumerates all product instances.
838
/// </summary>
839
/// <param name="ppEnumInstances">An enumeration of all product instances.</param>
840
/// <returns>Standard HRESULT indicating success or failure.</returns>
841
STDMETHOD(EnumAllInstances)(
842
IEnumSetupInstances** ppEnumInstances
843
) = 0;
844
};
845
#endif
846
847
EXTERN_C const IID IID_ISetupPackageReference;
848
849
#if defined(__cplusplus) && !defined(CINTERFACE)
850
/// <summary>
851
/// A reference to a package.
852
/// </summary>
853
struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown
854
{
855
/// <summary>
856
/// Gets the general package identifier.
857
/// </summary>
858
/// <param name="pbstrId">The general package identifier.</param>
859
/// <returns>Standard HRESULT indicating success or failure.</returns>
860
STDMETHOD(GetId)(
861
BSTR* pbstrId
862
) = 0;
863
864
/// <summary>
865
/// Gets the version of the package.
866
/// </summary>
867
/// <param name="pbstrVersion">The version of the package.</param>
868
/// <returns>Standard HRESULT indicating success or failure.</returns>
869
STDMETHOD(GetVersion)(
870
BSTR* pbstrVersion
871
) = 0;
872
873
/// <summary>
874
/// Gets the target process architecture of the package.
875
/// </summary>
876
/// <param name="pbstrChip">The target process architecture of the package.</param>
877
/// <returns>Standard HRESULT indicating success or failure.</returns>
878
STDMETHOD(GetChip)(
879
BSTR* pbstrChip
880
) = 0;
881
882
/// <summary>
883
/// Gets the language and optional region identifier.
884
/// </summary>
885
/// <param name="pbstrLanguage">The language and optional region identifier.</param>
886
/// <returns>Standard HRESULT indicating success or failure.</returns>
887
STDMETHOD(GetLanguage)(
888
BSTR* pbstrLanguage
889
) = 0;
890
891
/// <summary>
892
/// Gets the build branch of the package.
893
/// </summary>
894
/// <param name="pbstrBranch">The build branch of the package.</param>
895
/// <returns>Standard HRESULT indicating success or failure.</returns>
896
STDMETHOD(GetBranch)(
897
BSTR* pbstrBranch
898
) = 0;
899
900
/// <summary>
901
/// Gets the type of the package.
902
/// </summary>
903
/// <param name="pbstrType">The type of the package.</param>
904
/// <returns>Standard HRESULT indicating success or failure.</returns>
905
STDMETHOD(GetType)(
906
BSTR* pbstrType
907
) = 0;
908
909
/// <summary>
910
/// Gets the unique identifier consisting of all defined tokens.
911
/// </summary>
912
/// <param name="pbstrUniqueId">The unique identifier consisting of all defined tokens.</param>
913
/// <returns>Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required).</returns>
914
STDMETHOD(GetUniqueId)(
915
BSTR* pbstrUniqueId
916
) = 0;
917
};
918
#endif
919
920
EXTERN_C const IID IID_ISetupHelper;
921
922
#if defined(__cplusplus) && !defined(CINTERFACE)
923
/// <summary>
924
/// Helper functions.
925
/// </summary>
926
/// <remarks>
927
/// You can query for this interface from the <see cref="SetupConfiguration"/> class.
928
/// </remarks>
929
struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown
930
{
931
/// <summary>
932
/// Parses a dotted quad version string into a 64-bit unsigned integer.
933
/// </summary>
934
/// <param name="pwszVersion">The dotted quad version string to parse, e.g. 1.2.3.4.</param>
935
/// <param name="pullVersion">A 64-bit unsigned integer representing the version. You can compare this to other versions.</param>
936
/// <returns>Standard HRESULT indicating success or failure.</returns>
937
STDMETHOD(ParseVersion)(
938
LPCOLESTR pwszVersion,
939
PULONGLONG pullVersion
940
) = 0;
941
942
/// <summary>
943
/// Parses a dotted quad version string into a 64-bit unsigned integer.
944
/// </summary>
945
/// <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>
946
/// <param name="pullMinVersion">A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions.</param>
947
/// <param name="pullMaxVersion">A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions.</param>
948
/// <returns>Standard HRESULT indicating success or failure.</returns>
949
STDMETHOD(ParseVersionRange)(
950
LPCOLESTR pwszVersionRange,
951
PULONGLONG pullMinVersion,
952
PULONGLONG pullMaxVersion
953
) = 0;
954
};
955
#endif
956
957
// Class declarations
958
//
959
EXTERN_C const CLSID CLSID_SetupConfiguration;
960
961
#ifdef __cplusplus
962
/// <summary>
963
/// This class implements <see cref="ISetupConfiguration"/>, <see cref="ISetupConfiguration2"/>, and <see cref="ISetupHelper"/>.
964
/// </summary>
965
class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration;
966
#endif
967
968
// Function declarations
969
//
970
/// <summary>
971
/// Gets an <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.
972
/// </summary>
973
/// <param name="ppConfiguration">The <see cref="ISetupConfiguration"/> that provides information about product instances installed on the machine.</param>
974
/// <param name="pReserved">Reserved for future use.</param>
975
/// <returns>Standard HRESULT indicating success or failure.</returns>
976
STDMETHODIMP GetSetupConfiguration(
977
ISetupConfiguration** ppConfiguration,
978
LPVOID pReserved
979
);
980
981
#ifdef __cplusplus
982
}
983
#endif
984
985
#ifdef VS_SETUP_GCC_DIAGNOSTIC_PUSHED
986
#pragma GCC diagnostic pop
987
#undef VS_SETUP_GCC_DIAGNOSTIC_PUSHED
988
#endif
989
990
#endif
991
#endif
992
993