diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-13 23:51:36 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-14 14:53:29 -0500 |
| commit | 9453eaa9a38f78e248526ddd996485140a5d4d9a (patch) | |
| tree | 8ef6bda85836fd3f1b9c2c6c16cb4a994519e863 /src/api | |
| parent | 78125b7c4bd59468275d65b63860bdb68b1bc6f1 (diff) | |
| download | wix-9453eaa9a38f78e248526ddd996485140a5d4d9a.tar.gz wix-9453eaa9a38f78e248526ddd996485140a5d4d9a.tar.bz2 wix-9453eaa9a38f78e248526ddd996485140a5d4d9a.zip | |
Make engine skip planning if there are any downgrade related bundles.
Fixes 6677, 6722
Reverts 6537
Diffstat (limited to 'src/api')
11 files changed, 114 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h index b507b167..0b81b35a 100644 --- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h +++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h | |||
| @@ -223,6 +223,7 @@ enum BOOTSTRAPPER_APPLICATION_MESSAGE | |||
| 223 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, | 223 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, |
| 224 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, | 224 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, |
| 225 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, | 225 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, |
| 226 | BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, | ||
| 226 | }; | 227 | }; |
| 227 | 228 | ||
| 228 | enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION | 229 | enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION |
| @@ -354,6 +355,18 @@ struct BA_ONAPPLYCOMPLETE_RESULTS | |||
| 354 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION action; | 355 | BOOTSTRAPPER_APPLYCOMPLETE_ACTION action; |
| 355 | }; | 356 | }; |
| 356 | 357 | ||
| 358 | struct BA_ONAPPLYDOWNGRADE_ARGS | ||
| 359 | { | ||
| 360 | DWORD cbSize; | ||
| 361 | HRESULT hrRecommended; | ||
| 362 | }; | ||
| 363 | |||
| 364 | struct BA_ONAPPLYDOWNGRADE_RESULTS | ||
| 365 | { | ||
| 366 | DWORD cbSize; | ||
| 367 | HRESULT hrStatus; | ||
| 368 | }; | ||
| 369 | |||
| 357 | struct BA_ONBEGINMSITRANSACTIONBEGIN_ARGS | 370 | struct BA_ONBEGINMSITRANSACTIONBEGIN_ARGS |
| 358 | { | 371 | { |
| 359 | DWORD cbSize; | 372 | DWORD cbSize; |
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index fd36cf26..8a2e0e93 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
| @@ -209,6 +209,9 @@ namespace WixToolset.Mba.Core | |||
| 209 | public event EventHandler<ApplyCompleteEventArgs> ApplyComplete; | 209 | public event EventHandler<ApplyCompleteEventArgs> ApplyComplete; |
| 210 | 210 | ||
| 211 | /// <inheritdoc/> | 211 | /// <inheritdoc/> |
| 212 | public event EventHandler<ApplyDowngradeEventArgs> ApplyDowngrade; | ||
| 213 | |||
| 214 | /// <inheritdoc/> | ||
| 212 | public event EventHandler<ExecuteProgressEventArgs> ExecuteProgress; | 215 | public event EventHandler<ExecuteProgressEventArgs> ExecuteProgress; |
| 213 | 216 | ||
| 214 | /// <inheritdoc/> | 217 | /// <inheritdoc/> |
| @@ -1056,6 +1059,19 @@ namespace WixToolset.Mba.Core | |||
| 1056 | } | 1059 | } |
| 1057 | 1060 | ||
| 1058 | /// <summary> | 1061 | /// <summary> |
| 1062 | /// Called by the engine, raises the <see cref="ApplyDowngrade"/> event. | ||
| 1063 | /// </summary> | ||
| 1064 | /// <param name="args">Additional arguments for this event.</param> | ||
| 1065 | protected virtual void OnApplyDowngrade(ApplyDowngradeEventArgs args) | ||
| 1066 | { | ||
| 1067 | EventHandler<ApplyDowngradeEventArgs> handler = this.ApplyDowngrade; | ||
| 1068 | if (null != handler) | ||
| 1069 | { | ||
| 1070 | handler(this, args); | ||
| 1071 | } | ||
| 1072 | } | ||
| 1073 | |||
| 1074 | /// <summary> | ||
| 1059 | /// Called by the engine, raises the <see cref="ExecuteProgress"/> event. | 1075 | /// Called by the engine, raises the <see cref="ExecuteProgress"/> event. |
| 1060 | /// </summary> | 1076 | /// </summary> |
| 1061 | /// <param name="args">Additional arguments for this event.</param> | 1077 | /// <param name="args">Additional arguments for this event.</param> |
| @@ -1907,6 +1923,15 @@ namespace WixToolset.Mba.Core | |||
| 1907 | return args.HResult; | 1923 | return args.HResult; |
| 1908 | } | 1924 | } |
| 1909 | 1925 | ||
| 1926 | int IBootstrapperApplication.OnApplyDowngrade(int hrRecommendation, ref int hrStatus) | ||
| 1927 | { | ||
| 1928 | ApplyDowngradeEventArgs args = new ApplyDowngradeEventArgs(hrRecommendation, hrStatus); | ||
| 1929 | this.OnApplyDowngrade(args); | ||
| 1930 | |||
| 1931 | hrStatus = args.Status; | ||
| 1932 | return args.HResult; | ||
| 1933 | } | ||
| 1934 | |||
| 1910 | int IBootstrapperApplication.OnLaunchApprovedExeBegin(ref bool fCancel) | 1935 | int IBootstrapperApplication.OnLaunchApprovedExeBegin(ref bool fCancel) |
| 1911 | { | 1936 | { |
| 1912 | LaunchApprovedExeBeginEventArgs args = new LaunchApprovedExeBeginEventArgs(fCancel); | 1937 | LaunchApprovedExeBeginEventArgs args = new LaunchApprovedExeBeginEventArgs(fCancel); |
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index d8ec7998..c93c2885 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs | |||
| @@ -1859,6 +1859,30 @@ namespace WixToolset.Mba.Core | |||
| 1859 | } | 1859 | } |
| 1860 | 1860 | ||
| 1861 | /// <summary> | 1861 | /// <summary> |
| 1862 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ApplyDowngrade"/> | ||
| 1863 | /// </summary> | ||
| 1864 | [Serializable] | ||
| 1865 | public class ApplyDowngradeEventArgs : HResultEventArgs | ||
| 1866 | { | ||
| 1867 | /// <summary /> | ||
| 1868 | public ApplyDowngradeEventArgs(int hrRecommendation, int hrStatus) | ||
| 1869 | { | ||
| 1870 | this.Recommendation = hrRecommendation; | ||
| 1871 | this.Status = hrStatus; | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | /// <summary> | ||
| 1875 | /// Gets the recommended HRESULT. | ||
| 1876 | /// </summary> | ||
| 1877 | public int Recommendation { get; private set; } | ||
| 1878 | |||
| 1879 | /// <summary> | ||
| 1880 | /// Gets or sets the HRESULT for Apply. | ||
| 1881 | /// </summary> | ||
| 1882 | public int Status { get; set; } | ||
| 1883 | } | ||
| 1884 | |||
| 1885 | /// <summary> | ||
| 1862 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. | 1886 | /// EventArgs for <see cref="IDefaultBootstrapperApplication.CacheAcquireResolving"/>. |
| 1863 | /// </summary> | 1887 | /// </summary> |
| 1864 | [Serializable] | 1888 | [Serializable] |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index 4ab0f8d9..d4fe8320 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
| @@ -1160,6 +1160,16 @@ namespace WixToolset.Mba.Core | |||
| 1160 | [MarshalAs(UnmanagedType.U4)] ref RelatedBundlePlanType pRequestedType, | 1160 | [MarshalAs(UnmanagedType.U4)] ref RelatedBundlePlanType pRequestedType, |
| 1161 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 1161 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
| 1162 | ); | 1162 | ); |
| 1163 | |||
| 1164 | /// <summary> | ||
| 1165 | /// See <see cref="IDefaultBootstrapperApplication.ApplyDowngrade"/>. | ||
| 1166 | /// </summary> | ||
| 1167 | [PreserveSig] | ||
| 1168 | [return: MarshalAs(UnmanagedType.I4)] | ||
| 1169 | int OnApplyDowngrade( | ||
| 1170 | [MarshalAs(UnmanagedType.I4)] int hrRecommended, | ||
| 1171 | [MarshalAs(UnmanagedType.I4)] ref int hrStatus | ||
| 1172 | ); | ||
| 1163 | } | 1173 | } |
| 1164 | 1174 | ||
| 1165 | /// <summary> | 1175 | /// <summary> |
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index ebd1580b..c9284b69 100644 --- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
| @@ -20,6 +20,11 @@ namespace WixToolset.Mba.Core | |||
| 20 | event EventHandler<ApplyCompleteEventArgs> ApplyComplete; | 20 | event EventHandler<ApplyCompleteEventArgs> ApplyComplete; |
| 21 | 21 | ||
| 22 | /// <summary> | 22 | /// <summary> |
| 23 | /// Fired when the plan determined that nothing should happen to prevent downgrading. | ||
| 24 | /// </summary> | ||
| 25 | event EventHandler<ApplyDowngradeEventArgs> ApplyDowngrade; | ||
| 26 | |||
| 27 | /// <summary> | ||
| 23 | /// Fired when the engine is about to begin an MSI transaction. | 28 | /// Fired when the engine is about to begin an MSI transaction. |
| 24 | /// </summary> | 29 | /// </summary> |
| 25 | event EventHandler<BeginMsiTransactionBeginEventArgs> BeginMsiTransactionBegin; | 30 | event EventHandler<BeginMsiTransactionBeginEventArgs> BeginMsiTransactionBegin; |
diff --git a/src/api/burn/balutil/inc/BAFunctions.h b/src/api/burn/balutil/inc/BAFunctions.h index f772eb3f..58c26166 100644 --- a/src/api/burn/balutil/inc/BAFunctions.h +++ b/src/api/burn/balutil/inc/BAFunctions.h | |||
| @@ -90,6 +90,7 @@ enum BA_FUNCTIONS_MESSAGE | |||
| 90 | BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, | 90 | BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, |
| 91 | BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, | 91 | BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE, |
| 92 | BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, | 92 | BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE, |
| 93 | BA_FUNCTIONS_MESSAGE_ONAPPLYDOWNGRADE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE, | ||
| 93 | 94 | ||
| 94 | BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, | 95 | BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, |
| 95 | BA_FUNCTIONS_MESSAGE_WNDPROC, | 96 | BA_FUNCTIONS_MESSAGE_WNDPROC, |
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h index f558828f..fe5c99ba 100644 --- a/src/api/burn/balutil/inc/BalBaseBAFunctions.h +++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h | |||
| @@ -869,6 +869,14 @@ public: // IBootstrapperApplication | |||
| 869 | return S_OK; | 869 | return S_OK; |
| 870 | } | 870 | } |
| 871 | 871 | ||
| 872 | virtual STDMETHODIMP OnApplyDowngrade( | ||
| 873 | __in HRESULT /*hrRecommended*/, | ||
| 874 | __in HRESULT* /*phrStatus*/ | ||
| 875 | ) | ||
| 876 | { | ||
| 877 | return S_OK; | ||
| 878 | } | ||
| 879 | |||
| 872 | public: // IBAFunctions | 880 | public: // IBAFunctions |
| 873 | virtual STDMETHODIMP OnPlan( | 881 | virtual STDMETHODIMP OnPlan( |
| 874 | ) | 882 | ) |
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h index ede00f28..100e5c30 100644 --- a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h +++ b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h | |||
| @@ -161,6 +161,7 @@ static HRESULT WINAPI BalBaseBAFunctionsProc( | |||
| 161 | case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: | 161 | case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: |
| 162 | case BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE: | 162 | case BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE: |
| 163 | case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE: | 163 | case BA_FUNCTIONS_MESSAGE_ONPLANRELATEDBUNDLETYPE: |
| 164 | case BA_FUNCTIONS_MESSAGE_ONAPPLYDOWNGRADE: | ||
| 164 | hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext); | 165 | hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext); |
| 165 | break; | 166 | break; |
| 166 | case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED: | 167 | case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED: |
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h index 49f4b7ca..fd06a83f 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h | |||
| @@ -1069,6 +1069,14 @@ public: // IBootstrapperApplication | |||
| 1069 | return S_OK; | 1069 | return S_OK; |
| 1070 | } | 1070 | } |
| 1071 | 1071 | ||
| 1072 | virtual STDMETHODIMP OnApplyDowngrade( | ||
| 1073 | __in HRESULT /*hrRecommended*/, | ||
| 1074 | __in HRESULT* /*phrStatus*/ | ||
| 1075 | ) | ||
| 1076 | { | ||
| 1077 | return S_OK; | ||
| 1078 | } | ||
| 1079 | |||
| 1072 | public: //CBalBaseBootstrapperApplication | 1080 | public: //CBalBaseBootstrapperApplication |
| 1073 | virtual STDMETHODIMP Initialize( | 1081 | virtual STDMETHODIMP Initialize( |
| 1074 | __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs | 1082 | __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs |
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h index 698349f7..4e413e4e 100644 --- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h +++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h | |||
| @@ -738,6 +738,15 @@ static HRESULT BalBaseBAProcOnPlanRelatedBundleType( | |||
| 738 | return pBA->OnPlanRelatedBundleType(pArgs->wzBundleId, pArgs->recommendedType, &pResults->requestedType, &pResults->fCancel); | 738 | return pBA->OnPlanRelatedBundleType(pArgs->wzBundleId, pArgs->recommendedType, &pResults->requestedType, &pResults->fCancel); |
| 739 | } | 739 | } |
| 740 | 740 | ||
| 741 | static HRESULT BalBaseBAProcOnApplyDowngrade( | ||
| 742 | __in IBootstrapperApplication* pBA, | ||
| 743 | __in BA_ONAPPLYDOWNGRADE_ARGS* pArgs, | ||
| 744 | __inout BA_ONAPPLYDOWNGRADE_RESULTS* pResults | ||
| 745 | ) | ||
| 746 | { | ||
| 747 | return pBA->OnApplyDowngrade(pArgs->hrRecommended, &pResults->hrStatus); | ||
| 748 | } | ||
| 749 | |||
| 741 | /******************************************************************* | 750 | /******************************************************************* |
| 742 | BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. | 751 | BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. |
| 743 | Provides a default mapping between the new message based BA interface and | 752 | Provides a default mapping between the new message based BA interface and |
| @@ -1000,6 +1009,9 @@ static HRESULT WINAPI BalBaseBootstrapperApplicationProc( | |||
| 1000 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE: | 1009 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLETYPE: |
| 1001 | hr = BalBaseBAProcOnPlanRelatedBundleType(pBA, reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_RESULTS*>(pvResults)); | 1010 | hr = BalBaseBAProcOnPlanRelatedBundleType(pBA, reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRELATEDBUNDLETYPE_RESULTS*>(pvResults)); |
| 1002 | break; | 1011 | break; |
| 1012 | case BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYDOWNGRADE: | ||
| 1013 | hr = BalBaseBAProcOnApplyDowngrade(pBA, reinterpret_cast<BA_ONAPPLYDOWNGRADE_ARGS*>(pvArgs), reinterpret_cast<BA_ONAPPLYDOWNGRADE_RESULTS*>(pvResults)); | ||
| 1014 | break; | ||
| 1003 | } | 1015 | } |
| 1004 | } | 1016 | } |
| 1005 | 1017 | ||
diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h index 462df0cc..c9cf3126 100644 --- a/src/api/burn/balutil/inc/IBootstrapperApplication.h +++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h | |||
| @@ -707,4 +707,11 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A | |||
| 707 | __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType, | 707 | __inout BOOTSTRAPPER_RELATED_BUNDLE_PLAN_TYPE* pRequestedType, |
| 708 | __inout BOOL* pfCancel | 708 | __inout BOOL* pfCancel |
| 709 | ) = 0; | 709 | ) = 0; |
| 710 | |||
| 711 | // OnApplyDowngrade - called when the plan determined that nothing should happen to prevent downgrading. | ||
| 712 | // | ||
| 713 | STDMETHOD(OnApplyDowngrade)( | ||
| 714 | __in HRESULT hrRecommended, | ||
| 715 | __inout HRESULT* phrStatus | ||
| 716 | ) = 0; | ||
| 710 | }; | 717 | }; |
