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 ++-- src/api/wix/WixToolset.Data/Burn/BurnConstants.cs | 1 + .../wix/WixToolset.Data/Symbols/WixBundleSymbol.cs | 8 ++++ src/api/wix/api_wix.sln | 14 +------ 11 files changed, 97 insertions(+), 61 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 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. diff --git a/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs b/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs index 484b144d..1ecccbd2 100644 --- a/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs +++ b/src/api/wix/WixToolset.Data/Burn/BurnConstants.cs @@ -18,6 +18,7 @@ namespace WixToolset.Data.Burn public const string BundleExtensionSearchSymbolDefinitionTag = "WixBundleExtensionSearch"; // The following constants must stay in sync with src\burn\engine\core.h + public const string BURN_BUNDLE_INPROGRESS_NAME = "WixBundleInProgressName"; public const string BURN_BUNDLE_NAME = "WixBundleName"; public const string BURN_BUNDLE_ORIGINAL_SOURCE = "WixBundleOriginalSource"; public const string BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER = "WixBundleOriginalSourceFolder"; diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs index 8cad5c36..9724cbd7 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleSymbol.cs @@ -32,6 +32,7 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.ParentName), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.BundleId), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.ProviderKey), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundleSymbolFields.InProgressName), IntermediateFieldType.String), }, typeof(WixBundleSymbol)); } @@ -65,6 +66,7 @@ namespace WixToolset.Data.Symbols ParentName, BundleId, ProviderKey, + InProgressName, } [Flags] @@ -221,6 +223,12 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleSymbolFields.ProviderKey, value); } + public string InProgressName + { + get => (string)this.Fields[(int)WixBundleSymbolFields.InProgressName]; + set => this.Set((int)WixBundleSymbolFields.InProgressName, value); + } + public PackagingType DefaultPackagingType => (this.Compressed.HasValue && !this.Compressed.Value) ? PackagingType.External : PackagingType.Embedded; public bool DisableModify => (this.Attributes & WixBundleAttributes.DisableModify) == WixBundleAttributes.DisableModify; diff --git a/src/api/wix/api_wix.sln b/src/api/wix/api_wix.sln index 6b799e66..6096c12a 100644 --- a/src/api/wix/api_wix.sln +++ b/src/api/wix/api_wix.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2009 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31205.134 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Data", "WixToolset.Data\WixToolset.Data.csproj", "{73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}" EndProject @@ -12,43 +12,33 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|arm = Debug|arm Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|arm = Release|arm Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|arm.ActiveCfg = Debug|Any CPU - {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|arm.Build.0 = Debug|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|x64.ActiveCfg = Debug|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|x64.Build.0 = Debug|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|x86.ActiveCfg = Debug|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Debug|x86.Build.0 = Debug|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|Any CPU.ActiveCfg = Release|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|Any CPU.Build.0 = Release|Any CPU - {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|arm.ActiveCfg = Release|Any CPU - {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|arm.Build.0 = Release|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|x64.ActiveCfg = Release|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|x64.Build.0 = Release|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|x86.ActiveCfg = Release|Any CPU {73ADBD3A-8FB2-47DB-BC79-9BC61C40F2E0}.Release|x86.Build.0 = Release|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|arm.ActiveCfg = Debug|Any CPU - {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|arm.Build.0 = Debug|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|x64.ActiveCfg = Debug|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|x64.Build.0 = Debug|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|x86.ActiveCfg = Debug|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Debug|x86.Build.0 = Debug|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|Any CPU.Build.0 = Release|Any CPU - {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|arm.ActiveCfg = Release|Any CPU - {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|arm.Build.0 = Release|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|x64.ActiveCfg = Release|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|x64.Build.0 = Release|Any CPU {6C1FA8B7-BF3C-4735-95F8-26DEEFEF00C8}.Release|x86.ActiveCfg = Release|Any CPU -- cgit v1.2.3-55-g6feb