aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-02-10 18:09:34 -0600
committerSean Hall <r.sean.hall@gmail.com>2022-02-10 19:51:19 -0600
commit27a0db4070a2b5756282bf15b957dd7f0021417f (patch)
tree2d0cdfe80d5ccd6d207bdf664a4f8e512281c1cf /src/api
parent091573d459d6ab4947bd39bd3bc8faee3d18b4fc (diff)
downloadwix-27a0db4070a2b5756282bf15b957dd7f0021417f.tar.gz
wix-27a0db4070a2b5756282bf15b957dd7f0021417f.tar.bz2
wix-27a0db4070a2b5756282bf15b957dd7f0021417f.zip
When rolling back a bundle failure, reinstall all upgrade related bundles.
Fixes #3421
Diffstat (limited to 'src/api')
-rw-r--r--src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h15
-rw-r--r--src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs26
-rw-r--r--src/api/burn/WixToolset.Mba.Core/EventArgs.cs31
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs12
-rw-r--r--src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs5
-rw-r--r--src/api/burn/balutil/inc/BAFunctions.h1
-rw-r--r--src/api/burn/balutil/inc/BalBaseBAFunctions.h10
-rw-r--r--src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h1
-rw-r--r--src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h11
-rw-r--r--src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h12
-rw-r--r--src/api/burn/balutil/inc/IBootstrapperApplication.h8
11 files changed, 132 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 659901be..5c6258d0 100644
--- a/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h
+++ b/src/api/burn/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h
@@ -209,6 +209,7 @@ enum BOOTSTRAPPER_APPLICATION_MESSAGE
209 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, 209 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN,
210 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, 210 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE,
211 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE, 211 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE,
212 BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE,
212}; 213};
213 214
214enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION 215enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION
@@ -1208,6 +1209,20 @@ struct BA_ONPLANRELATEDBUNDLE_RESULTS
1208 BOOTSTRAPPER_REQUEST_STATE requestedState; 1209 BOOTSTRAPPER_REQUEST_STATE requestedState;
1209}; 1210};
1210 1211
1212struct BA_ONPLANRESTORERELATEDBUNDLE_ARGS
1213{
1214 DWORD cbSize;
1215 LPCWSTR wzBundleId;
1216 BOOTSTRAPPER_REQUEST_STATE recommendedState;
1217};
1218
1219struct BA_ONPLANRESTORERELATEDBUNDLE_RESULTS
1220{
1221 DWORD cbSize;
1222 BOOL fCancel;
1223 BOOTSTRAPPER_REQUEST_STATE requestedState;
1224};
1225
1211struct BA_ONPLANROLLBACKBOUNDARY_ARGS 1226struct BA_ONPLANROLLBACKBOUNDARY_ARGS
1212{ 1227{
1213 DWORD cbSize; 1228 DWORD cbSize;
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs
index f277425e..b08e66c0 100644
--- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs
+++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs
@@ -271,6 +271,9 @@ namespace WixToolset.Mba.Core
271 /// <inheritdoc/> 271 /// <inheritdoc/>
272 public event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete; 272 public event EventHandler<SetUpdateCompleteEventArgs> SetUpdateComplete;
273 273
274 /// <inheritdoc/>
275 public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle;
276
274 /// <summary> 277 /// <summary>
275 /// Entry point that is called when the bootstrapper application is ready to run. 278 /// Entry point that is called when the bootstrapper application is ready to run.
276 /// </summary> 279 /// </summary>
@@ -1321,6 +1324,19 @@ namespace WixToolset.Mba.Core
1321 } 1324 }
1322 } 1325 }
1323 1326
1327 /// <summary>
1328 /// Called by the engine, raises the <see cref="PlanRestoreRelatedBundle"/> event.
1329 /// </summary>
1330 /// <param name="args">Additional arguments for this event.</param>
1331 protected virtual void OnPlanRestoreRelatedBundle(PlanRestoreRelatedBundleEventArgs args)
1332 {
1333 EventHandler<PlanRestoreRelatedBundleEventArgs> handler = this.PlanRestoreRelatedBundle;
1334 if (null != handler)
1335 {
1336 handler(this, args);
1337 }
1338 }
1339
1324 #region IBootstrapperApplication Members 1340 #region IBootstrapperApplication Members
1325 1341
1326 int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) 1342 int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext)
@@ -2042,6 +2058,16 @@ namespace WixToolset.Mba.Core
2042 return args.HResult; 2058 return args.HResult;
2043 } 2059 }
2044 2060
2061 int IBootstrapperApplication.OnPlanRestoreRelatedBundle(string wzBundleId, RequestState recommendedState, ref RequestState pRequestedState, ref bool fCancel)
2062 {
2063 PlanRestoreRelatedBundleEventArgs args = new PlanRestoreRelatedBundleEventArgs(wzBundleId, recommendedState, pRequestedState, fCancel);
2064 this.OnPlanRestoreRelatedBundle(args);
2065
2066 pRequestedState = args.State;
2067 fCancel = args.Cancel;
2068 return args.HResult;
2069 }
2070
2045 #endregion 2071 #endregion
2046 } 2072 }
2047} 2073}
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs
index d4d70651..2e1e1be3 100644
--- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs
+++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs
@@ -2402,4 +2402,35 @@ namespace WixToolset.Mba.Core
2402 /// </summary> 2402 /// </summary>
2403 public string NewPackageId { get; private set; } 2403 public string NewPackageId { get; private set; }
2404 } 2404 }
2405
2406 /// <summary>
2407 /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>
2408 /// </summary>
2409 [Serializable]
2410 public class PlanRestoreRelatedBundleEventArgs : CancellableHResultEventArgs
2411 {
2412 /// <summary />
2413 public PlanRestoreRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation)
2414 : base(cancelRecommendation)
2415 {
2416 this.BundleId = bundleId;
2417 this.RecommendedState = recommendedState;
2418 this.State = state;
2419 }
2420
2421 /// <summary>
2422 /// Gets the identity of the bundle to plan for.
2423 /// </summary>
2424 public string BundleId { get; private set; }
2425
2426 /// <summary>
2427 /// Gets the recommended requested state for the bundle.
2428 /// </summary>
2429 public RequestState RecommendedState { get; private set; }
2430
2431 /// <summary>
2432 /// Gets or sets the requested state for the bundle.
2433 /// </summary>
2434 public RequestState State { get; set; }
2435 }
2405} 2436}
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs
index 05f96106..4fbe5e18 100644
--- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs
@@ -1136,6 +1136,18 @@ namespace WixToolset.Mba.Core
1136 [MarshalAs(UnmanagedType.LPWStr)] string wzPreviousPackageId, 1136 [MarshalAs(UnmanagedType.LPWStr)] string wzPreviousPackageId,
1137 [MarshalAs(UnmanagedType.LPWStr)] string wzNewPackageId 1137 [MarshalAs(UnmanagedType.LPWStr)] string wzNewPackageId
1138 ); 1138 );
1139
1140 /// <summary>
1141 /// See <see cref="IDefaultBootstrapperApplication.PlanRestoreRelatedBundle"/>.
1142 /// </summary>
1143 [PreserveSig]
1144 [return: MarshalAs(UnmanagedType.I4)]
1145 int OnPlanRestoreRelatedBundle(
1146 [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId,
1147 [MarshalAs(UnmanagedType.U4)] RequestState recommendedState,
1148 [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState,
1149 [MarshalAs(UnmanagedType.Bool)] ref bool fCancel
1150 );
1139 } 1151 }
1140 1152
1141 /// <summary> 1153 /// <summary>
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs
index ce06408e..c237cb9d 100644
--- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs
+++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs
@@ -334,6 +334,11 @@ namespace WixToolset.Mba.Core
334 event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; 334 event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle;
335 335
336 /// <summary> 336 /// <summary>
337 /// Fired when the engine has begun planning an upgrade related bundle for restoring in case of failure.
338 /// </summary>
339 event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle;
340
341 /// <summary>
337 /// Fired when the engine is planning a rollback boundary. 342 /// Fired when the engine is planning a rollback boundary.
338 /// </summary> 343 /// </summary>
339 event EventHandler<PlanRollbackBoundaryEventArgs> PlanRollbackBoundary; 344 event EventHandler<PlanRollbackBoundaryEventArgs> PlanRollbackBoundary;
diff --git a/src/api/burn/balutil/inc/BAFunctions.h b/src/api/burn/balutil/inc/BAFunctions.h
index 84359d65..cbef88df 100644
--- a/src/api/burn/balutil/inc/BAFunctions.h
+++ b/src/api/burn/balutil/inc/BAFunctions.h
@@ -88,6 +88,7 @@ enum BA_FUNCTIONS_MESSAGE
88 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, 88 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN,
89 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, 89 BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE = BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE,
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 92
92 BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024, 93 BA_FUNCTIONS_MESSAGE_ONTHEMELOADED = 1024,
93 BA_FUNCTIONS_MESSAGE_WNDPROC, 94 BA_FUNCTIONS_MESSAGE_WNDPROC,
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctions.h b/src/api/burn/balutil/inc/BalBaseBAFunctions.h
index c6d0924f..e98ebc9f 100644
--- a/src/api/burn/balutil/inc/BalBaseBAFunctions.h
+++ b/src/api/burn/balutil/inc/BalBaseBAFunctions.h
@@ -849,6 +849,16 @@ public: // IBootstrapperApplication
849 return S_OK; 849 return S_OK;
850 } 850 }
851 851
852 virtual STDMETHODIMP OnPlanRestoreRelatedBundle(
853 __in_z LPCWSTR /*wzBundleId*/,
854 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/,
855 __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestedState*/,
856 __inout BOOL* /*pfCancel*/
857 )
858 {
859 return S_OK;
860 }
861
852public: // IBAFunctions 862public: // IBAFunctions
853 virtual STDMETHODIMP OnPlan( 863 virtual STDMETHODIMP OnPlan(
854 ) 864 )
diff --git a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
index 5d5ff098..09cc189e 100644
--- a/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
+++ b/src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
@@ -159,6 +159,7 @@ static HRESULT WINAPI BalBaseBAFunctionsProc(
159 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN: 159 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN:
160 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE: 160 case BA_FUNCTIONS_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE:
161 case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: 161 case BA_FUNCTIONS_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE:
162 case BA_FUNCTIONS_MESSAGE_ONPLANRESTORERELATEDBUNDLE:
162 hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext); 163 hr = BalBaseBootstrapperApplicationProc((BOOTSTRAPPER_APPLICATION_MESSAGE)message, pvArgs, pvResults, pvContext);
163 break; 164 break;
164 case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED: 165 case BA_FUNCTIONS_MESSAGE_ONTHEMELOADED:
diff --git a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
index e1a36fdf..6a24f24b 100644
--- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
+++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplication.h
@@ -1047,6 +1047,17 @@ public: // IBootstrapperApplication
1047 return S_OK; 1047 return S_OK;
1048 } 1048 }
1049 1049
1050 virtual STDMETHODIMP OnPlanRestoreRelatedBundle(
1051 __in_z LPCWSTR /*wzBundleId*/,
1052 __in BOOTSTRAPPER_REQUEST_STATE /*recommendedState*/,
1053 __inout BOOTSTRAPPER_REQUEST_STATE* /*pRequestedState*/,
1054 __inout BOOL* pfCancel
1055 )
1056 {
1057 *pfCancel |= CheckCanceled();
1058 return S_OK;
1059 }
1060
1050public: //CBalBaseBootstrapperApplication 1061public: //CBalBaseBootstrapperApplication
1051 virtual STDMETHODIMP Initialize( 1062 virtual STDMETHODIMP Initialize(
1052 __in const BOOTSTRAPPER_CREATE_ARGS* pCreateArgs 1063 __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 1ee5258e..d40390e5 100644
--- a/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h
+++ b/src/api/burn/balutil/inc/BalBaseBootstrapperApplicationProc.h
@@ -720,6 +720,15 @@ static HRESULT BalBaseBAProcOnSetUpdateComplete(
720 return pBA->OnSetUpdateComplete(pArgs->hrStatus, pArgs->wzPreviousPackageId, pArgs->wzNewPackageId); 720 return pBA->OnSetUpdateComplete(pArgs->hrStatus, pArgs->wzPreviousPackageId, pArgs->wzNewPackageId);
721} 721}
722 722
723static HRESULT BalBaseBAProcOnPlanRestoreRelatedBundle(
724 __in IBootstrapperApplication* pBA,
725 __in BA_ONPLANRESTORERELATEDBUNDLE_ARGS* pArgs,
726 __inout BA_ONPLANRESTORERELATEDBUNDLE_RESULTS* pResults
727 )
728{
729 return pBA->OnPlanRestoreRelatedBundle(pArgs->wzBundleId, pArgs->recommendedState, &pResults->requestedState, &pResults->fCancel);
730}
731
723/******************************************************************* 732/*******************************************************************
724BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication. 733BalBaseBootstrapperApplicationProc - requires pvContext to be of type IBootstrapperApplication.
725 Provides a default mapping between the new message based BA interface and 734 Provides a default mapping between the new message based BA interface and
@@ -976,6 +985,9 @@ static HRESULT WINAPI BalBaseBootstrapperApplicationProc(
976 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE: 985 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANNEDCOMPATIBLEPACKAGE:
977 hr = BalBaseBAProcOnPlannedCompatiblePackage(pBA, reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS*>(pvResults)); 986 hr = BalBaseBAProcOnPlannedCompatiblePackage(pBA, reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANNEDCOMPATIBLEPACKAGE_RESULTS*>(pvResults));
978 break; 987 break;
988 case BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRESTORERELATEDBUNDLE:
989 hr = BalBaseBAProcOnPlanRestoreRelatedBundle(pBA, reinterpret_cast<BA_ONPLANRESTORERELATEDBUNDLE_ARGS*>(pvArgs), reinterpret_cast<BA_ONPLANRESTORERELATEDBUNDLE_RESULTS*>(pvResults));
990 break;
979 } 991 }
980 } 992 }
981 993
diff --git a/src/api/burn/balutil/inc/IBootstrapperApplication.h b/src/api/burn/balutil/inc/IBootstrapperApplication.h
index 640f609d..5932c06e 100644
--- a/src/api/burn/balutil/inc/IBootstrapperApplication.h
+++ b/src/api/burn/balutil/inc/IBootstrapperApplication.h
@@ -691,4 +691,12 @@ DECLARE_INTERFACE_IID_(IBootstrapperApplication, IUnknown, "53C31D56-49C0-426B-A
691 __in_z_opt LPCWSTR wzPreviousPackageId, 691 __in_z_opt LPCWSTR wzPreviousPackageId,
692 __in_z_opt LPCWSTR wzNewPackageId 692 __in_z_opt LPCWSTR wzNewPackageId
693 ) = 0; 693 ) = 0;
694
695 // OnPlanRestoreRelatedBundle - called when the engine begins planning an upgrade related bundle for restoring in case of failure.
696 STDMETHOD(OnPlanRestoreRelatedBundle)(
697 __in_z LPCWSTR wzBundleId,
698 __in BOOTSTRAPPER_REQUEST_STATE recommendedState,
699 __inout BOOTSTRAPPER_REQUEST_STATE* pRequestedState,
700 __inout BOOL* pfCancel
701 ) = 0;
694}; 702};