From 2c085b3aa89150fff9a0ea6df2cde0ce56e3066d Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 13 May 2021 20:46:08 -0500 Subject: Add InProgressDisplayName for bundles. #6296 --- .../inc/BootstrapperApplication.h | 13 +++++- .../WixToolset.Mba.Core/BootstrapperApplication.cs | 11 +++--- src/api/burn/WixToolset.Mba.Core/EventArgs.cs | 46 +++++++++++----------- .../IBootstrapperApplication.cs | 35 ++++++++++++---- src/api/burn/balutil/inc/BalBaseBAFunctions.h | 8 ++-- .../balutil/inc/BalBaseBootstrapperApplication.h | 8 ++-- .../inc/BalBaseBootstrapperApplicationProc.h | 6 +-- .../burn/balutil/inc/IBootstrapperApplication.h | 8 ++-- 8 files changed, 86 insertions(+), 49 deletions(-) (limited to 'src/api/burn') diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h index 2a6d5c8a..56f6b361 100644 --- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h @@ -20,6 +20,13 @@ enum BOOTSTRAPPER_RESTART BOOTSTRAPPER_RESTART_ALWAYS, }; +enum BOOTSTRAPPER_REGISTRATION_TYPE +{ + BOOTSTRAPPER_REGISTRATION_TYPE_NONE, // The engine will ignore NONE if it recommended INPROGRESS or FULL. + BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS, + BOOTSTRAPPER_REGISTRATION_TYPE_FULL, +}; + enum BOOTSTRAPPER_RESUME_TYPE { BOOTSTRAPPER_RESUME_TYPE_NONE, @@ -1163,12 +1170,14 @@ struct BA_ONPROGRESS_RESULTS struct BA_ONREGISTERBEGIN_ARGS { DWORD cbSize; + BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType; }; struct BA_ONREGISTERBEGIN_RESULTS { DWORD cbSize; BOOL fCancel; + BOOTSTRAPPER_REGISTRATION_TYPE registrationType; }; struct BA_ONREGISTERCOMPLETE_ARGS @@ -1262,13 +1271,13 @@ struct BA_ONSYSTEMSHUTDOWN_RESULTS struct BA_ONUNREGISTERBEGIN_ARGS { DWORD cbSize; - BOOL fKeepRegistration; + BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType; }; struct BA_ONUNREGISTERBEGIN_RESULTS { DWORD cbSize; - BOOL fForceKeepRegistration; + BOOTSTRAPPER_REGISTRATION_TYPE registrationType; }; struct BA_ONUNREGISTERCOMPLETE_ARGS diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index 072d3ef0..d7dbf04c 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs @@ -1490,12 +1490,13 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnRegisterBegin(ref bool fCancel) + int IBootstrapperApplication.OnRegisterBegin(RegistrationType recommendedRegistrationType, ref bool fCancel, ref RegistrationType registrationType) { - RegisterBeginEventArgs args = new RegisterBeginEventArgs(fCancel); + RegisterBeginEventArgs args = new RegisterBeginEventArgs(recommendedRegistrationType, fCancel, registrationType); this.OnRegisterBegin(args); fCancel = args.Cancel; + registrationType = args.RegistrationType; return args.HResult; } @@ -1679,12 +1680,12 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnUnregisterBegin(bool fKeepRegistration, ref bool fForceKeepRegistration) + int IBootstrapperApplication.OnUnregisterBegin(RegistrationType recommendedRegistrationType, ref RegistrationType registrationType) { - UnregisterBeginEventArgs args = new UnregisterBeginEventArgs(fKeepRegistration, fForceKeepRegistration); + UnregisterBeginEventArgs args = new UnregisterBeginEventArgs(recommendedRegistrationType, registrationType); this.OnUnregisterBegin(args); - fForceKeepRegistration = args.ForceKeepRegistration; + registrationType = args.RegistrationType; return args.HResult; } diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index 8ef8af14..00d90c83 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs @@ -1184,22 +1184,31 @@ namespace WixToolset.Mba.Core public class RegisterBeginEventArgs : CancellableHResultEventArgs { /// - public RegisterBeginEventArgs(bool cancelRecommendation) + public RegisterBeginEventArgs(RegistrationType recommendedRegistrationType, bool cancelRecommendation, RegistrationType registrationType) : base(cancelRecommendation) { + this.RecommendedRegistrationType = recommendedRegistrationType; + this.RegistrationType = registrationType; } + + /// + /// Gets the recommended registration type. + /// + public RegistrationType RecommendedRegistrationType { get; private set; } + + /// + /// Gets or sets the registration type. + /// + public RegistrationType RegistrationType { get; set; } } /// - /// Additional arguments used when the engine has completed registering the location and visilibity of the bundle. + /// Event arguments for . /// [Serializable] public class RegisterCompleteEventArgs : StatusEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The return code of the operation. + /// public RegisterCompleteEventArgs(int hrStatus) : base(hrStatus) { @@ -1212,26 +1221,22 @@ namespace WixToolset.Mba.Core [Serializable] public class UnregisterBeginEventArgs : HResultEventArgs { - /// - /// - /// - /// - /// - public UnregisterBeginEventArgs(bool keepRegistration, bool forceKeepRegistration) + /// + public UnregisterBeginEventArgs(RegistrationType recommendedRegistrationType, RegistrationType registrationType) { - this.KeepRegistration = keepRegistration; - this.ForceKeepRegistration = forceKeepRegistration; + this.RecommendedRegistrationType = recommendedRegistrationType; + this.RegistrationType = registrationType; } /// - /// Indicates whether the engine will uninstall the bundle. + /// Gets the recommended registration type. /// - public bool ForceKeepRegistration { get; set; } + public RegistrationType RecommendedRegistrationType { get; private set; } /// - /// If is FALSE, then this can be set to TRUE to make the engine keep the bundle installed. + /// Gets or sets the registration type. /// - public bool KeepRegistration { get; private set; } + public RegistrationType RegistrationType { get; set; } } /// @@ -1240,10 +1245,7 @@ namespace WixToolset.Mba.Core [Serializable] public class UnregisterCompleteEventArgs : StatusEventArgs { - /// - /// - /// - /// + /// public UnregisterCompleteEventArgs(int hrStatus) : base(hrStatus) { diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index 530fb1a9..e6e03906 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs @@ -500,12 +500,12 @@ namespace WixToolset.Mba.Core /// /// See . /// - /// - /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] int OnRegisterBegin( - [MarshalAs(UnmanagedType.Bool)] ref bool fCancel + [MarshalAs(UnmanagedType.I4)] RegistrationType recommendedRegistrationType, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.I4)] ref RegistrationType pRegistrationType ); /// @@ -820,14 +820,11 @@ namespace WixToolset.Mba.Core /// /// See . /// - /// - /// - /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] int OnUnregisterBegin( - [MarshalAs(UnmanagedType.Bool)] bool fKeepRegistration, - [MarshalAs(UnmanagedType.Bool)] ref bool fForceKeepRegistration + [MarshalAs(UnmanagedType.I4)] RegistrationType recommendedRegistrationType, + [MarshalAs(UnmanagedType.I4)] ref RegistrationType pRegistrationType ); /// @@ -1259,6 +1256,28 @@ namespace WixToolset.Mba.Core Always, } + /// + /// The display name to use when registering in Add/Remove Programs. + /// + public enum RegistrationType + { + /// + /// No registration. + /// The engine will ignore None if it recommended InProgress or Full. + /// + None, + + /// + /// The in-progress display name. + /// + InProgress, + + /// + /// The default display name. + /// + Full, + } + /// /// Result codes (based on Dialog Box Command IDs from WinUser.h). /// diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h index ee2e452f..c5771efc 100644 --- a/src/api/burn/balutil/inc/BalBaseBAFunctions.h +++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h @@ -379,7 +379,9 @@ public: // IBootstrapperApplication } virtual STDMETHODIMP OnRegisterBegin( - __inout BOOL* /*pfCancel*/ + __in BOOTSTRAPPER_REGISTRATION_TYPE /*recommendedRegistrationType*/, + __inout BOOL* /*pfCancel*/, + __inout BOOTSTRAPPER_REGISTRATION_TYPE* /*pRegistrationType*/ ) { return S_OK; @@ -597,8 +599,8 @@ public: // IBootstrapperApplication } virtual STDMETHODIMP OnUnregisterBegin( - __in BOOL /*fKeepRegistration*/, - __inout BOOL* /*pfForceKeepRegistration*/ + __in BOOTSTRAPPER_REGISTRATION_TYPE /*recommendedRegistrationType*/, + __inout BOOTSTRAPPER_REGISTRATION_TYPE* /*pRegistrationType*/ ) { return S_OK; diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h index bf21c4a5..393987ba 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h @@ -435,7 +435,9 @@ public: // IBootstrapperApplication } virtual STDMETHODIMP OnRegisterBegin( - __inout BOOL* pfCancel + __in BOOTSTRAPPER_REGISTRATION_TYPE /*recommendedRegistrationType*/, + __inout BOOL* pfCancel, + __inout BOOTSTRAPPER_REGISTRATION_TYPE* /*pRegistrationType*/ ) { *pfCancel |= CheckCanceled(); @@ -769,8 +771,8 @@ public: // IBootstrapperApplication } virtual STDMETHODIMP OnUnregisterBegin( - __in BOOL /*fKeepRegistration*/, - __inout BOOL* /*pfForceKeepRegistration*/ + __in BOOTSTRAPPER_REGISTRATION_TYPE /*recommendedRegistrationType*/, + __inout BOOTSTRAPPER_REGISTRATION_TYPE* /*pRegistrationType*/ ) { return S_OK; diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h index 7fe3ffd8..69031d62 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h @@ -263,11 +263,11 @@ static HRESULT BalBaseBAProcOnError( static HRESULT BalBaseBAProcOnRegisterBegin( __in IBootstrapperApplication* pBA, - __in BA_ONREGISTERBEGIN_ARGS* /*pArgs*/, + __in BA_ONREGISTERBEGIN_ARGS* pArgs, __inout BA_ONREGISTERBEGIN_RESULTS* pResults ) { - return pBA->OnRegisterBegin(&pResults->fCancel); + return pBA->OnRegisterBegin(pArgs->recommendedRegistrationType, &pResults->fCancel, &pResults->registrationType); } static HRESULT BalBaseBAProcOnRegisterComplete( @@ -456,7 +456,7 @@ static HRESULT BalBaseBAProcOnUnregisterBegin( __inout BA_ONUNREGISTERBEGIN_RESULTS* pResults ) { - return pBA->OnUnregisterBegin(pArgs->fKeepRegistration, &pResults->fForceKeepRegistration); + return pBA->OnUnregisterBegin(pArgs->recommendedRegistrationType, &pResults->registrationType); } static HRESULT BalBaseBAProcOnUnregisterComplete( diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h index c284cb49..98b88f44 100644 --- a/src/api/burn/balutil/inc/IBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h @@ -280,7 +280,9 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A // OnRegisterBegin - called when the engine registers the bundle. // STDMETHOD(OnRegisterBegin)( - __inout BOOL* pfCancel + __in BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType, + __inout BOOL* pfCancel, + __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType ) = 0; // OnRegisterComplete - called when the engine registration is @@ -519,8 +521,8 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A // OnUnregisterBegin - called when the engine unregisters the bundle. // STDMETHOD(OnUnregisterBegin)( - __in BOOL fKeepRegistration, - __inout BOOL* pfForceKeepRegistration + __in BOOTSTRAPPER_REGISTRATION_TYPE recommendedRegistrationType, + __inout BOOTSTRAPPER_REGISTRATION_TYPE* pRegistrationType ) = 0; // OnUnregisterComplete - called when the engine unregistration is complete. -- cgit v1.2.3-55-g6feb