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