From efbe40802d13867ab43f4d7808e1b91052b18ca2 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 21 Apr 2020 17:11:49 +1000 Subject: Add action to OnExecutePackageBegin. --- src/WixToolset.Mba.Core/BootstrapperApplication.cs | 4 ++-- src/WixToolset.Mba.Core/EventArgs.cs | 13 ++++++++++--- src/WixToolset.Mba.Core/IBootstrapperApplication.cs | 1 + src/balutil/balutil.vcxproj | 4 ++-- src/balutil/inc/BalBaseBAFunctions.h | 1 + src/balutil/inc/BalBaseBootstrapperApplication.h | 1 + src/balutil/inc/BalBaseBootstrapperApplicationProc.h | 2 +- src/balutil/inc/IBootstrapperApplication.h | 3 ++- src/balutil/packages.config | 2 +- src/bextutil/bextutil.vcxproj | 4 ++-- src/bextutil/packages.config | 2 +- src/mbanative/mbanative.vcxproj | 4 ++-- src/mbanative/packages.config | 2 +- 13 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index f8ac2a1e..249c17c9 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs @@ -1466,9 +1466,9 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ref bool fCancel) + int IBootstrapperApplication.OnExecutePackageBegin(string wzPackageId, bool fExecute, ActionState action, ref bool fCancel) { - ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, fCancel); + ExecutePackageBeginEventArgs args = new ExecutePackageBeginEventArgs(wzPackageId, fExecute, action, fCancel); this.OnExecutePackageBegin(args); fCancel = args.Cancel; diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index 83c0c96a..ca0fa173 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs @@ -1501,13 +1501,15 @@ namespace WixToolset.Mba.Core /// Creates a new instance of the class. /// /// The identity of the package to act on. - /// Whether the package should really be acted on. + /// Whether the package is being executed or rolled back. + /// The action about to be executed. /// The recommendation from the engine. - public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, bool cancelRecommendation) + public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, ActionState action, bool cancelRecommendation) : base(cancelRecommendation) { this.PackageId = packageId; this.ShouldExecute = shouldExecute; + this.Action = action; } /// @@ -1516,9 +1518,14 @@ namespace WixToolset.Mba.Core public string PackageId { get; private set; } /// - /// Gets whether the package should really be acted on. + /// Gets whether the package is being executed or rolled back. /// public bool ShouldExecute { get; private set; } + + /// + /// Gets the action about to be executed. + /// + public ActionState Action { get; private set; } } /// diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index 8e5d2aeb..c4daaf32 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs @@ -392,6 +392,7 @@ namespace WixToolset.Mba.Core int OnExecutePackageBegin( [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, [MarshalAs(UnmanagedType.Bool)] bool fExecute, + [MarshalAs(UnmanagedType.U4)] ActionState action, [MarshalAs(UnmanagedType.Bool)] ref bool fCancel ); diff --git a/src/balutil/balutil.vcxproj b/src/balutil/balutil.vcxproj index ce109d36..b3a43d4c 100644 --- a/src/balutil/balutil.vcxproj +++ b/src/balutil/balutil.vcxproj @@ -2,7 +2,7 @@ - + @@ -90,7 +90,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/src/balutil/inc/BalBaseBAFunctions.h b/src/balutil/inc/BalBaseBAFunctions.h index dd190ee9..411524fb 100644 --- a/src/balutil/inc/BalBaseBAFunctions.h +++ b/src/balutil/inc/BalBaseBAFunctions.h @@ -489,6 +489,7 @@ public: // IBootstrapperApplication virtual STDMETHODIMP OnExecutePackageBegin( __in_z LPCWSTR /*wzPackageId*/, __in BOOL /*fExecute*/, + __in BOOTSTRAPPER_ACTION_STATE /*action*/, __inout BOOL* /*pfCancel*/ ) { diff --git a/src/balutil/inc/BalBaseBootstrapperApplication.h b/src/balutil/inc/BalBaseBootstrapperApplication.h index ac354e7b..269777a6 100644 --- a/src/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/balutil/inc/BalBaseBootstrapperApplication.h @@ -603,6 +603,7 @@ public: // IBootstrapperApplication virtual STDMETHODIMP OnExecutePackageBegin( __in_z LPCWSTR wzPackageId, __in BOOL fExecute, + __in BOOTSTRAPPER_ACTION_STATE /*action*/, __inout BOOL* pfCancel ) { diff --git a/src/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/balutil/inc/BalBaseBootstrapperApplicationProc.h index 4b8f4ca7..35bc0a9e 100644 --- a/src/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/balutil/inc/BalBaseBootstrapperApplicationProc.h @@ -402,7 +402,7 @@ static HRESULT BalBaseBAProcOnExecutePackageBegin( __inout BA_ONEXECUTEPACKAGEBEGIN_RESULTS* pResults ) { - return pBA->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, &pResults->fCancel); + return pBA->OnExecutePackageBegin(pArgs->wzPackageId, pArgs->fExecute, pArgs->action, &pResults->fCancel); } static HRESULT BalBaseBAProcOnExecutePatchTarget( diff --git a/src/balutil/inc/IBootstrapperApplication.h b/src/balutil/inc/IBootstrapperApplication.h index 6ab7ed20..30b456c7 100644 --- a/src/balutil/inc/IBootstrapperApplication.h +++ b/src/balutil/inc/IBootstrapperApplication.h @@ -388,7 +388,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A // STDMETHOD(OnExecutePackageBegin)( __in_z LPCWSTR wzPackageId, - __in BOOL fExecute, + __in BOOL fExecute, // false means rollback. + __in BOOTSTRAPPER_ACTION_STATE action, __inout BOOL* pfCancel ) = 0; diff --git a/src/balutil/packages.config b/src/balutil/packages.config index 75a6476b..38569fda 100644 --- a/src/balutil/packages.config +++ b/src/balutil/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/bextutil/bextutil.vcxproj b/src/bextutil/bextutil.vcxproj index 3deb3317..d0f045ed 100644 --- a/src/bextutil/bextutil.vcxproj +++ b/src/bextutil/bextutil.vcxproj @@ -2,7 +2,7 @@ - + @@ -79,7 +79,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/src/bextutil/packages.config b/src/bextutil/packages.config index 75a6476b..38569fda 100644 --- a/src/bextutil/packages.config +++ b/src/bextutil/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/mbanative/mbanative.vcxproj b/src/mbanative/mbanative.vcxproj index 605cc535..d2e2b90a 100644 --- a/src/mbanative/mbanative.vcxproj +++ b/src/mbanative/mbanative.vcxproj @@ -2,7 +2,7 @@ - + @@ -69,7 +69,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/src/mbanative/packages.config b/src/mbanative/packages.config index 75a6476b..38569fda 100644 --- a/src/mbanative/packages.config +++ b/src/mbanative/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file -- cgit v1.2.3-55-g6feb