From 022beff26b46c7808eefacfebccfc1fcb5aa5256 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 22 Feb 2021 20:25:55 -0600 Subject: Integrate patch related changes in Burn headers. --- src/WixToolset.Mba.Core/BootstrapperApplication.cs | 60 +++++++--- src/WixToolset.Mba.Core/EventArgs.cs | 126 +++++++++++++-------- .../IBootstrapperApplication.cs | 31 +++-- .../IDefaultBootstrapperApplication.cs | 27 +++-- 4 files changed, 157 insertions(+), 87 deletions(-) (limited to 'src/WixToolset.Mba.Core') diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index 9f4f6330..43e69e81 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs @@ -68,7 +68,7 @@ namespace WixToolset.Mba.Core public event EventHandler DetectRelatedMsiPackage; /// - public event EventHandler DetectTargetMsiPackage; + public event EventHandler DetectPatchTarget; /// public event EventHandler DetectMsiFeature; @@ -89,7 +89,7 @@ namespace WixToolset.Mba.Core public event EventHandler PlanPackageBegin; /// - public event EventHandler PlanTargetMsiPackage; + public event EventHandler PlanPatchTarget; /// public event EventHandler PlanMsiFeature; @@ -100,6 +100,9 @@ namespace WixToolset.Mba.Core /// public event EventHandler PlanPackageComplete; + /// + public event EventHandler PlannedPackage; + /// public event EventHandler PlanComplete; @@ -392,12 +395,12 @@ namespace WixToolset.Mba.Core } /// - /// Called by the engine, raises the event. + /// Called by the engine, raises the event. /// /// Additional arguments for this event. - protected virtual void OnDetectTargetMsiPackage(DetectTargetMsiPackageEventArgs args) + protected virtual void OnDetectPatchTarget(DetectPatchTargetEventArgs args) { - EventHandler handler = this.DetectTargetMsiPackage; + EventHandler handler = this.DetectPatchTarget; if (null != handler) { handler(this, args); @@ -483,12 +486,12 @@ namespace WixToolset.Mba.Core } /// - /// Called by the engine, raises the event. + /// Called by the engine, raises the event. /// /// Additional arguments for this event. - protected virtual void OnPlanTargetMsiPackage(PlanTargetMsiPackageEventArgs args) + protected virtual void OnPlanPatchTarget(PlanPatchTargetEventArgs args) { - EventHandler handler = this.PlanTargetMsiPackage; + EventHandler handler = this.PlanPatchTarget; if (null != handler) { handler(this, args); @@ -534,6 +537,19 @@ namespace WixToolset.Mba.Core } } + /// + /// Called by the engine, raises the event. + /// + /// Additional arguments for this event. + protected virtual void OnPlannedPackage(PlannedPackageEventArgs args) + { + EventHandler handler = this.PlannedPackage; + if (null != handler) + { + handler(this, args); + } + } + /// /// Called by the engine, raises the event. /// @@ -1170,10 +1186,10 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnDetectTargetMsiPackage(string wzPackageId, string wzProductCode, PackageState patchState, ref bool fCancel) + int IBootstrapperApplication.OnDetectPatchTarget(string wzPackageId, string wzProductCode, PackageState patchState, ref bool fCancel) { - DetectTargetMsiPackageEventArgs args = new DetectTargetMsiPackageEventArgs(wzPackageId, wzProductCode, patchState, fCancel); - this.OnDetectTargetMsiPackage(args); + DetectPatchTargetEventArgs args = new DetectPatchTargetEventArgs(wzPackageId, wzProductCode, patchState, fCancel); + this.OnDetectPatchTarget(args); fCancel = args.Cancel; return args.HResult; @@ -1223,9 +1239,9 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) + int IBootstrapperApplication.OnPlanPackageBegin(string wzPackageId, PackageState state, bool fInstallCondition, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) { - PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, recommendedState, pRequestedState, fCancel); + PlanPackageBeginEventArgs args = new PlanPackageBeginEventArgs(wzPackageId, state, fInstallCondition, recommendedState, pRequestedState, fCancel); this.OnPlanPackageBegin(args); pRequestedState = args.State; @@ -1233,10 +1249,10 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnPlanTargetMsiPackage(string wzPackageId, string wzProductCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) + int IBootstrapperApplication.OnPlanPatchTarget(string wzPackageId, string wzProductCode, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel) { - PlanTargetMsiPackageEventArgs args = new PlanTargetMsiPackageEventArgs(wzPackageId, wzProductCode, recommendedState, pRequestedState, fCancel); - this.OnPlanTargetMsiPackage(args); + PlanPatchTargetEventArgs args = new PlanPatchTargetEventArgs(wzPackageId, wzProductCode, recommendedState, pRequestedState, fCancel); + this.OnPlanPatchTarget(args); pRequestedState = args.State; fCancel = args.Cancel; @@ -1265,14 +1281,22 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback) + int IBootstrapperApplication.OnPlanPackageComplete(string wzPackageId, int hrStatus, RequestState requested) { - var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, state, requested, execute, rollback); + var args = new PlanPackageCompleteEventArgs(wzPackageId, hrStatus, requested); this.OnPlanPackageComplete(args); return args.HResult; } + int IBootstrapperApplication.OnPlannedPackage(string wzPackageId, ActionState execute, ActionState rollback) + { + var args = new PlannedPackageEventArgs(wzPackageId, execute, rollback); + this.OnPlannedPackage(args); + + return args.HResult; + } + int IBootstrapperApplication.OnPlanComplete(int hrStatus) { PlanCompleteEventArgs args = new PlanCompleteEventArgs(hrStatus); diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index 2f21b50e..953e31ee 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs @@ -547,18 +547,18 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when a target MSI package has been detected. + /// Event arguments for /// - public class DetectTargetMsiPackageEventArgs : CancellableHResultEventArgs + public class DetectPatchTargetEventArgs : CancellableHResultEventArgs { /// - /// Creates a new instance of the class. + /// /// - /// Detected package identifier. - /// Detected product code. - /// Package state detected. - /// The recommendation from the engine. - public DetectTargetMsiPackageEventArgs(string packageId, string productCode, PackageState state, bool cancelRecommendation) + /// + /// + /// + /// + public DetectPatchTargetEventArgs(string packageId, string productCode, PackageState state, bool cancelRecommendation) : base(cancelRecommendation) { this.PackageId = packageId; @@ -567,17 +567,17 @@ namespace WixToolset.Mba.Core } /// - /// Gets the identity of the target's package detected. + /// Gets the identity of the patch's package. /// public string PackageId { get; private set; } /// - /// Gets the product code of the target MSI detected. + /// Gets the product code of the target. /// public string ProductCode { get; private set; } /// - /// Gets the detected patch package state. + /// Gets the detected patch state for the target. /// public PackageState State { get; private set; } } @@ -732,22 +732,26 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when the engine has begun planning the installation of a specific package. + /// Event arguments for /// [Serializable] public class PlanPackageBeginEventArgs : CancellableHResultEventArgs { /// - /// Creates a new instance of the class. + /// /// - /// The identity of the package to plan for. - /// The recommended requested state for the package. - /// The requested state for the package. - /// The recommendation from the engine. - public PlanPackageBeginEventArgs(string packageId, RequestState recommendedState, RequestState state, bool cancelRecommendation) + /// + /// + /// + /// + /// + /// + public PlanPackageBeginEventArgs(string packageId, PackageState currentState, bool installCondition, RequestState recommendedState, RequestState state, bool cancelRecommendation) : base(cancelRecommendation) { this.PackageId = packageId; + this.CurrentState = currentState; + this.InstallCondition = installCondition; this.RecommendedState = recommendedState; this.State = state; } @@ -757,6 +761,16 @@ namespace WixToolset.Mba.Core /// public string PackageId { get; private set; } + /// + /// Gets the current state of the package. + /// + public PackageState CurrentState { get; private set; } + + /// + /// Gets the evaluated result of the package's install condition. + /// + public bool InstallCondition { get; private set; } + /// /// Gets the recommended requested state for the package. /// @@ -769,20 +783,20 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when engine is about to plan a MSP applied to a target MSI package. + /// Event arguments for /// [Serializable] - public class PlanTargetMsiPackageEventArgs : CancellableHResultEventArgs + public class PlanPatchTargetEventArgs : CancellableHResultEventArgs { /// - /// Creates a new instance of the class. + /// /// - /// Package identifier of the patch being planned. - /// Product code identifier being planned. - /// Recommended package state of the patch being planned. - /// Package state of the patch being planned. - /// The recommendation from the engine. - public PlanTargetMsiPackageEventArgs(string packageId, string productCode, RequestState recommendedState, RequestState state, bool cancelRecommendation) + /// + /// + /// + /// + /// + public PlanPatchTargetEventArgs(string packageId, string productCode, RequestState recommendedState, RequestState state, bool cancelRecommendation) : base(cancelRecommendation) { this.PackageId = packageId; @@ -792,22 +806,22 @@ namespace WixToolset.Mba.Core } /// - /// Gets the identity of the patch package to plan. + /// Gets the identity of the patch's package. /// public string PackageId { get; private set; } /// - /// Gets the identity of the patch's target MSI to plan. + /// Gets the product code of the target. /// public string ProductCode { get; private set; } /// - /// Gets the recommended state of the patch to use by planning. + /// Gets the recommended state of the patch to use by planning for the target. /// public RequestState RecommendedState { get; private set; } /// - /// Gets or sets the state of the patch to use by planning. + /// Gets or sets the state of the patch to use by planning for the target. /// public RequestState State { get; set; } } @@ -915,28 +929,22 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when then engine has completed planning the installation of a specific package. + /// Event arguments for /// [Serializable] public class PlanPackageCompleteEventArgs : StatusEventArgs { /// - /// Creates a new instance of the class. + /// /// - /// The identity of the package planned for. - /// The return code of the operation. - /// The current state of the package. - /// The requested state for the package - /// The execution action to take. - /// The rollback action to take. - public PlanPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback) + /// + /// + /// + public PlanPackageCompleteEventArgs(string packageId, int hrStatus, RequestState requested) : base(hrStatus) { this.PackageId = packageId; - this.State = state; this.Requested = requested; - this.Execute = execute; - this.Rollback = rollback; } /// @@ -945,22 +953,42 @@ namespace WixToolset.Mba.Core public string PackageId { get; private set; } /// - /// Gets the current state of the package. + /// Gets the requested state for the package. /// - public PackageState State { get; private set; } + public RequestState Requested { get; private set; } + } + /// + /// Event arguments for + /// + [Serializable] + public class PlannedPackageEventArgs : HResultEventArgs + { /// - /// Gets the requested state for the package. + /// /// - public RequestState Requested { get; private set; } + /// + /// + /// + public PlannedPackageEventArgs(string packageId, ActionState execute, ActionState rollback) + { + this.PackageId = packageId; + this.Execute = execute; + this.Rollback = rollback; + } + + /// + /// Gets the identity of the package planned for. + /// + public string PackageId { get; private set; } /// - /// Gets the execution action to take. + /// Gets the planned execution action. /// public ActionState Execute { get; private set; } /// - /// Gets the rollback action to take. + /// Gets the planned rollback action. /// public ActionState Rollback { get; private set; } } diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index c1a32ed4..7ff243d2 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs @@ -194,7 +194,7 @@ namespace WixToolset.Mba.Core ); /// - /// See . + /// See . /// /// /// @@ -203,7 +203,7 @@ namespace WixToolset.Mba.Core /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] - int OnDetectTargetMsiPackage( + int OnDetectPatchTarget( [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, [MarshalAs(UnmanagedType.U4)] PackageState patchState, @@ -289,6 +289,8 @@ namespace WixToolset.Mba.Core /// See . /// /// + /// + /// /// /// /// @@ -297,13 +299,15 @@ namespace WixToolset.Mba.Core [return: MarshalAs(UnmanagedType.I4)] int OnPlanPackageBegin( [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, + [MarshalAs(UnmanagedType.U4)] PackageState state, + [MarshalAs(UnmanagedType.Bool)] bool fInstallCondition, [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, [MarshalAs(UnmanagedType.Bool)] ref bool fCancel ); /// - /// See . + /// See . /// /// /// @@ -313,7 +317,7 @@ namespace WixToolset.Mba.Core /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] - int OnPlanTargetMsiPackage( + int OnPlanPatchTarget( [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, [MarshalAs(UnmanagedType.LPWStr)] string wzProductCode, [MarshalAs(UnmanagedType.U4)] RequestState recommendedState, @@ -368,18 +372,27 @@ namespace WixToolset.Mba.Core /// /// /// - /// /// - /// - /// /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] int OnPlanPackageComplete( [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, int hrStatus, - [MarshalAs(UnmanagedType.U4)] PackageState state, - [MarshalAs(UnmanagedType.U4)] RequestState requested, + [MarshalAs(UnmanagedType.U4)] RequestState requested + ); + + /// + /// See . + /// + /// + /// + /// + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlannedPackage( + [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, [MarshalAs(UnmanagedType.U4)] ActionState execute, [MarshalAs(UnmanagedType.U4)] ActionState rollback ); diff --git a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index 9970dc3e..d0518049 100644 --- a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs @@ -114,6 +114,11 @@ namespace WixToolset.Mba.Core /// event EventHandler DetectPackageComplete; + /// + /// Fired when the engine detects a target product for an MSP package. + /// + event EventHandler DetectPatchTarget; + /// /// Fired when a related bundle has been detected for a bundle. /// @@ -124,11 +129,6 @@ namespace WixToolset.Mba.Core /// event EventHandler DetectRelatedMsiPackage; - /// - /// Fired when an MSP package detects a target MSI has been detected. - /// - event EventHandler DetectTargetMsiPackage; - /// /// Fired when the update detection has found a potential update candidate. /// @@ -229,6 +229,11 @@ namespace WixToolset.Mba.Core /// event EventHandler PlanComplete; + /// + /// Fired when the engine has completed planning a package. + /// + event EventHandler PlannedPackage; + /// /// Fired when the engine is about to plan a feature in an MSI package. /// @@ -240,24 +245,24 @@ namespace WixToolset.Mba.Core event EventHandler PlanMsiPackage; /// - /// Fired when the engine has begun planning the installation of a specific package. + /// Fired when the engine has begun getting the BA's input for planning a package. /// event EventHandler PlanPackageBegin; /// - /// Fired when the engine has completed planning the installation of a specific package. + /// Fired when the engine has completed getting the BA's input for planning a package. /// event EventHandler PlanPackageComplete; /// - /// Fired when the engine has begun planning for a related bundle. + /// Fired when the engine is about to plan a target of an MSP package. /// - event EventHandler PlanRelatedBundle; + event EventHandler PlanPatchTarget; /// - /// Fired when the engine is about to plan the target MSI of a MSP package. + /// Fired when the engine has begun planning for a related bundle. /// - event EventHandler PlanTargetMsiPackage; + event EventHandler PlanRelatedBundle; /// /// Fired when the engine has changed progress for the bundle installation. -- cgit v1.2.3-55-g6feb