From 72e20f682c0d64102e86439ba5527dd0d71932ae Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 22 Apr 2022 16:55:29 -0500 Subject: Add RepairCondition. Fixes 6758 --- .../inc/BootstrapperApplication.h | 1 + src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | 4 ++-- src/api/burn/WixToolset.Mba.Core/EventArgs.cs | 8 +++++++- src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | 1 + src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs | 7 ++++++- src/api/burn/WixToolset.Mba.Core/PackageInfo.cs | 5 +++++ src/api/burn/balutil/balinfo.cpp | 7 +++++++ src/api/burn/balutil/inc/BalBaseBAFunctions.h | 1 + src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h | 1 + src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h | 2 +- src/api/burn/balutil/inc/IBootstrapperApplication.h | 1 + src/api/burn/balutil/inc/balinfo.h | 1 + src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs | 8 ++++++++ 13 files changed, 42 insertions(+), 5 deletions(-) (limited to 'src/api') diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h index fbbd10ee..f0b5dad4 100644 --- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h @@ -1243,6 +1243,7 @@ struct BA_ONPLANPACKAGEBEGIN_ARGS BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition; BOOTSTRAPPER_REQUEST_STATE recommendedState; BOOTSTRAPPER_CACHE_TYPE recommendedCacheType; + BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition; }; struct BA_ONPLANPACKAGEBEGIN_RESULTS diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index 41738bf6..6738a4a6 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs @@ -1598,9 +1598,9 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fCached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, ref RequestState pRequestedState, ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, ref bool fCancel) + int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fCached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, ref RequestState pRequestedState, ref BOOTSTRAPPER_CACHE_TYPE pRequestedCacheType, ref bool fCancel) { - PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fCached, installCondition, recommendedState, recommendedCacheType, pRequestedState, pRequestedCacheType, fCancel); + PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fCached, installCondition, repairCondition, recommendedState, recommendedCacheType, pRequestedState, pRequestedCacheType, fCancel); this.OnPlanPackageBegin(args); pRequestedState = args.State; diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index 07b14b3d..d79ac402 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs @@ -783,13 +783,14 @@ namespace WixToolset.Mba.Core public class PlanPackageBeginEventArgs : CancellableHResultEventArgs { /// - public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool cached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, RequestState state, BOOTSTRAPPER_CACHE_TYPE cacheType, bool cancelRecommendation) + public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool cached, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, RequestState recommendedState, BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, RequestState state, BOOTSTRAPPER_CACHE_TYPE cacheType, bool cancelRecommendation) : base(cancelRecommendation) { this.PackageId = packageId; this.CurrentState = currentState; this.Cached = cached; this.InstallCondition = installCondition; + this.RepairCondition = repairCondition; this.RecommendedState = recommendedState; this.RecommendedCacheType = recommendedCacheType; this.State = state; @@ -816,6 +817,11 @@ namespace WixToolset.Mba.Core /// public BOOTSTRAPPER_PACKAGE_CONDITION_RESULT InstallCondition { get; private set; } + /// + /// Gets the evaluated result of the package's repair condition. + /// + public BOOTSTRAPPER_PACKAGE_CONDITION_RESULT RepairCondition { get; private set; } + /// /// Gets the recommended requested state for the package. /// diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index ae642474..2877d4de 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs @@ -314,6 +314,7 @@ namespace WixToolset.Mba.Core [MarshalAs(UnmanagedType.U4)] PackageState state, [MarshalAs(UnmanagedType.Bool)] bool fCached, [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, + [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, [MarshalAs(UnmanagedType.U4)] BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, diff --git a/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs index a1d99b10..ee3be820 100644 --- a/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/IPackageInfo.cs @@ -42,6 +42,11 @@ namespace WixToolset.Mba.Core /// string InstallCondition { get; } + /// + /// + /// + string RepairCondition { get; } + /// /// /// @@ -87,4 +92,4 @@ namespace WixToolset.Mba.Core /// bool Vital { get; } } -} \ No newline at end of file +} diff --git a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs index 39fe4d73..e400cbe4 100644 --- a/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs +++ b/src/api/burn/WixToolset.Mba.Core/PackageInfo.cs @@ -101,6 +101,9 @@ namespace WixToolset.Mba.Core /// public string InstallCondition { get; internal set; } + /// + public string RepairCondition { get; internal set; } + /// public BOOTSTRAPPER_CACHE_TYPE CacheType { get; internal set; } @@ -174,6 +177,8 @@ namespace WixToolset.Mba.Core package.InstallCondition = BootstrapperApplicationData.GetAttribute(node, "InstallCondition"); + package.RepairCondition = BootstrapperApplicationData.GetAttribute(node, "RepairCondition"); + packagesById.Add(package.Id, package); } diff --git a/src/api/burn/balutil/balinfo.cpp b/src/api/burn/balutil/balinfo.cpp index f0eb9904..29e453f6 100644 --- a/src/api/burn/balutil/balinfo.cpp +++ b/src/api/burn/balutil/balinfo.cpp @@ -304,6 +304,7 @@ DAPI_(void) BalInfoUninitialize( ReleaseStr(pBundle->packages.rgPackages[i].sczUpgradeCode); ReleaseStr(pBundle->packages.rgPackages[i].sczVersion); ReleaseStr(pBundle->packages.rgPackages[i].sczInstallCondition); + ReleaseStr(pBundle->packages.rgPackages[i].sczRepairCondition); ReleaseStr(pBundle->packages.rgPackages[i].sczPrereqLicenseFile); ReleaseStr(pBundle->packages.rgPackages[i].sczPrereqLicenseUrl); } @@ -484,6 +485,12 @@ static HRESULT ParsePackagesFromXml( ExitOnFailure(hr, "Failed to get install condition for package."); } + hr = XmlGetAttributeEx(pNode, L"RepairCondition", &prgPackages[iPackage].sczRepairCondition); + if (E_NOTFOUND != hr) + { + ExitOnFailure(hr, "Failed to get repair condition for package."); + } + hr = XmlGetAttributeEx(pNode, L"Cache", &scz); ExitOnFailure(hr, "Failed to get cache type for package."); diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h index 6bde05d2..9ff58d2b 100644 --- a/src/api/burn/balutil/inc/BalBaseBAFunctions.h +++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h @@ -276,6 +276,7 @@ public: // IBootstrapperApplication __in BOOTSTRAPPER_PACKAGE_STATE /*state*/, __in BOOL /*fCached*/, __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT /*installCondition*/, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT /*repairCondition*/, __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, __in BOOTSTRAPPER_CACHE_TYPE /*recommendedCacheType*/, __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestState*/, diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h index b661c7c9..2e848df7 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h @@ -290,6 +290,7 @@ public: // IBootstrapperApplication __in BOOTSTRAPPER_PACKAGE_STATE /*state*/, __in BOOL /*fCached*/, __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT /*installCondition*/, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT /*repairCondition*/, __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/, __in BOOTSTRAPPER_CACHE_TYPE /*recommendedCacheType*/, __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestState*/, diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h index 4ef7bac5..e35678ad 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h @@ -195,7 +195,7 @@ static HRESULT BalBaseBAProcOnPlanPackageBegin( __inout BA_ONPLANPACKAGEBEGIN_RESULTS* pResults ) { - return pBA->OnPlanPackageBegin(pArgs->wzPackageId, pArgs->state, pArgs->fCached, pArgs->installCondition, pArgs->recommendedState, pArgs->recommendedCacheType, &pResults->requestedState, &pResults->requestedCacheType, &pResults->fCancel); + return pBA->OnPlanPackageBegin(pArgs->wzPackageId, pArgs->state, pArgs->fCached, pArgs->installCondition, pArgs->repairCondition, pArgs->recommendedState, pArgs->recommendedCacheType, &pResults->requestedState, &pResults->requestedCacheType, &pResults->fCancel); } static HRESULT BalBaseBAProcOnPlanCompatibleMsiPackageBegin( diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h index a4840228..6eca90fa 100644 --- a/src/api/burn/balutil/inc/IBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h @@ -182,6 +182,7 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A __in BOOTSTRAPPER_PACKAGE_STATE state, __in BOOL fCached, __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT installCondition, + __in BOOTSTRAPPER_PACKAGE_CONDITION_RESULT repairCondition, __in BOOTSTRAPPER_REQUEST_STATE recommendedState, __in BOOTSTRAPPER_CACHE_TYPE recommendedCacheType, __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState, diff --git a/src/api/burn/balutil/inc/balinfo.h b/src/api/burn/balutil/inc/balinfo.h index 0c7a5b93..cd61f34d 100644 --- a/src/api/burn/balutil/inc/balinfo.h +++ b/src/api/burn/balutil/inc/balinfo.h @@ -49,6 +49,7 @@ typedef struct _BAL_INFO_PACKAGE LPWSTR sczUpgradeCode; LPWSTR sczVersion; LPWSTR sczInstallCondition; + LPWSTR sczRepairCondition; BOOTSTRAPPER_CACHE_TYPE cacheType; BOOL fPrereqPackage; LPWSTR sczPrereqLicenseFile; diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs index 6afe657e..8d625664 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundlePackageSymbol.cs @@ -14,6 +14,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PayloadRef), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Attributes), IntermediateFieldType.Number), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.InstallCondition), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.RepairCondition), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.Cache), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.CacheId), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundlePackageSymbolFields.PerMachine), IntermediateFieldType.Bool), @@ -42,6 +43,7 @@ namespace WixToolset.Data.Symbols PayloadRef, Attributes, InstallCondition, + RepairCondition, Cache, CacheId, PerMachine, @@ -124,6 +126,12 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundlePackageSymbolFields.InstallCondition, value); } + public string RepairCondition + { + get => (string)this.Fields[(int)WixBundlePackageSymbolFields.RepairCondition]; + set => this.Set((int)WixBundlePackageSymbolFields.RepairCondition, value); + } + public BundleCacheType? Cache { get => Enum.TryParse((string)this.Fields[(int)WixBundlePackageSymbolFields.Cache], true, out BundleCacheType value) ? value : (BundleCacheType?)null; -- cgit v1.2.3-55-g6feb