diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-18 20:15:33 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-19 12:07:32 -0500 |
commit | fb54576f1d05e82ba47cd718c4c4f8b3bad624c9 (patch) | |
tree | b7d6b30bd3c9294b74874c1a48b20a8da8869a69 /src/api/burn/WixToolset.Mba.Core | |
parent | 581c320e04949300d6c3bee71fb5fc1a557f9263 (diff) | |
download | wix-fb54576f1d05e82ba47cd718c4c4f8b3bad624c9.tar.gz wix-fb54576f1d05e82ba47cd718c4c4f8b3bad624c9.tar.bz2 wix-fb54576f1d05e82ba47cd718c4c4f8b3bad624c9.zip |
Give BA process id and option to wait for cancelled process to exit.
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core')
4 files changed, 98 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index 8a2e0e93..5ed064fa 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
@@ -280,6 +280,9 @@ namespace WixToolset.Mba.Core | |||
280 | /// <inheritdoc/> | 280 | /// <inheritdoc/> |
281 | public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; | 281 | public event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; |
282 | 282 | ||
283 | /// <inheritdoc/> | ||
284 | public event EventHandler<ExecuteProcessCancelEventArgs> ExecuteProcessCancel; | ||
285 | |||
283 | /// <summary> | 286 | /// <summary> |
284 | /// Entry point that is called when the bootstrapper application is ready to run. | 287 | /// Entry point that is called when the bootstrapper application is ready to run. |
285 | /// </summary> | 288 | /// </summary> |
@@ -1369,6 +1372,19 @@ namespace WixToolset.Mba.Core | |||
1369 | } | 1372 | } |
1370 | } | 1373 | } |
1371 | 1374 | ||
1375 | /// <summary> | ||
1376 | /// Called by the engine, raises the <see cref="ExecuteProcessCancel"/> event. | ||
1377 | /// </summary> | ||
1378 | /// <param name="args">Additional arguments for this event.</param> | ||
1379 | protected virtual void OnExecuteProcessCancel(ExecuteProcessCancelEventArgs args) | ||
1380 | { | ||
1381 | EventHandler<ExecuteProcessCancelEventArgs> handler = this.ExecuteProcessCancel; | ||
1382 | if (null != handler) | ||
1383 | { | ||
1384 | handler(this, args); | ||
1385 | } | ||
1386 | } | ||
1387 | |||
1372 | #region IBootstrapperApplication Members | 1388 | #region IBootstrapperApplication Members |
1373 | 1389 | ||
1374 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) | 1390 | int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) |
@@ -2119,6 +2135,15 @@ namespace WixToolset.Mba.Core | |||
2119 | return args.HResult; | 2135 | return args.HResult; |
2120 | } | 2136 | } |
2121 | 2137 | ||
2138 | int IBootstrapperApplication.OnExecuteProcessCancel(string wzPackageId, int processId, BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation, ref BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION pAction) | ||
2139 | { | ||
2140 | ExecuteProcessCancelEventArgs args = new ExecuteProcessCancelEventArgs(wzPackageId, processId, recommendation, pAction); | ||
2141 | this.OnExecuteProcessCancel(args); | ||
2142 | |||
2143 | pAction = args.Action; | ||
2144 | return args.HResult; | ||
2145 | } | ||
2146 | |||
2122 | #endregion | 2147 | #endregion |
2123 | } | 2148 | } |
2124 | } | 2149 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index c93c2885..c2c73067 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs | |||
@@ -2488,4 +2488,40 @@ namespace WixToolset.Mba.Core | |||
2488 | /// </summary> | 2488 | /// </summary> |
2489 | public RequestState State { get; set; } | 2489 | public RequestState State { get; set; } |
2490 | } | 2490 | } |
2491 | |||
2492 | /// <summary> | ||
2493 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.ExecuteProcessCancel"/> | ||
2494 | /// </summary> | ||
2495 | [Serializable] | ||
2496 | public class ExecuteProcessCancelEventArgs : HResultEventArgs | ||
2497 | { | ||
2498 | /// <summary /> | ||
2499 | public ExecuteProcessCancelEventArgs(string packageId, int processId, BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation, BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION action) | ||
2500 | { | ||
2501 | this.PackageId = packageId; | ||
2502 | this.ProcessId = processId; | ||
2503 | this.Recommendation = recommendation; | ||
2504 | this.Action = action; | ||
2505 | } | ||
2506 | |||
2507 | /// <summary> | ||
2508 | /// Gets the identity of the package. | ||
2509 | /// </summary> | ||
2510 | public string PackageId { get; private set; } | ||
2511 | |||
2512 | /// <summary> | ||
2513 | /// Gets the process id. | ||
2514 | /// </summary> | ||
2515 | public int ProcessId { get; private set; } | ||
2516 | |||
2517 | /// <summary> | ||
2518 | /// Gets the recommended action from the engine. | ||
2519 | /// </summary> | ||
2520 | public BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION Recommendation { get; private set; } | ||
2521 | |||
2522 | /// <summary> | ||
2523 | /// Gets or sets the action to be performed. This is passed back to the engine. | ||
2524 | /// </summary> | ||
2525 | public BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION Action { get; set; } | ||
2526 | } | ||
2491 | } | 2527 | } |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index d4fe8320..1786eecd 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
@@ -1170,6 +1170,18 @@ namespace WixToolset.Mba.Core | |||
1170 | [MarshalAs(UnmanagedType.I4)] int hrRecommended, | 1170 | [MarshalAs(UnmanagedType.I4)] int hrRecommended, |
1171 | [MarshalAs(UnmanagedType.I4)] ref int hrStatus | 1171 | [MarshalAs(UnmanagedType.I4)] ref int hrStatus |
1172 | ); | 1172 | ); |
1173 | |||
1174 | /// <summary> | ||
1175 | /// See <see cref="IDefaultBootstrapperApplication.ExecuteProcessCancel"/>. | ||
1176 | /// </summary> | ||
1177 | [PreserveSig] | ||
1178 | [return: MarshalAs(UnmanagedType.I4)] | ||
1179 | int OnExecuteProcessCancel( | ||
1180 | [MarshalAs(UnmanagedType.LPWStr)] string wzPackageId, | ||
1181 | int processId, | ||
1182 | [MarshalAs(UnmanagedType.I4)] BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION recommendation, | ||
1183 | [MarshalAs(UnmanagedType.I4)] ref BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION pAction | ||
1184 | ); | ||
1173 | } | 1185 | } |
1174 | 1186 | ||
1175 | /// <summary> | 1187 | /// <summary> |
@@ -1907,6 +1919,26 @@ namespace WixToolset.Mba.Core | |||
1907 | } | 1919 | } |
1908 | 1920 | ||
1909 | /// <summary> | 1921 | /// <summary> |
1922 | /// The available actions for <see cref="IDefaultBootstrapperApplication.ExecuteProcessCancel"/>. | ||
1923 | /// </summary> | ||
1924 | public enum BOOTSTRAPPER_EXECUTEPROCESSCANCEL_ACTION | ||
1925 | { | ||
1926 | /// <summary> | ||
1927 | /// Instructs the engine to stop waiting for the process to exit. | ||
1928 | /// The package is immediately considered to have failed with ERROR_INSTALL_USEREXIT. | ||
1929 | /// The engine will never rollback the package. | ||
1930 | /// </summary> | ||
1931 | Abandon, | ||
1932 | |||
1933 | /// <summary> | ||
1934 | /// Instructs the engine to wait for the process to exit. | ||
1935 | /// Once the process has exited, the package is considered to have failed with ERROR_INSTALL_USEREXIT. | ||
1936 | /// This allows the engine to rollback the package if necessary. | ||
1937 | /// </summary> | ||
1938 | Wait, | ||
1939 | } | ||
1940 | |||
1941 | /// <summary> | ||
1910 | /// The result of evaluating a condition from a package. | 1942 | /// The result of evaluating a condition from a package. |
1911 | /// </summary> | 1943 | /// </summary> |
1912 | public enum BOOTSTRAPPER_PACKAGE_CONDITION_RESULT | 1944 | public enum BOOTSTRAPPER_PACKAGE_CONDITION_RESULT |
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index c9284b69..21d99b32 100644 --- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
@@ -244,6 +244,11 @@ namespace WixToolset.Mba.Core | |||
244 | event EventHandler<ExecutePackageCompleteEventArgs> ExecutePackageComplete; | 244 | event EventHandler<ExecutePackageCompleteEventArgs> ExecutePackageComplete; |
245 | 245 | ||
246 | /// <summary> | 246 | /// <summary> |
247 | /// Fired when a package that spawned a process is cancelled. | ||
248 | /// </summary> | ||
249 | event EventHandler<ExecuteProcessCancelEventArgs> ExecuteProcessCancel; | ||
250 | |||
251 | /// <summary> | ||
247 | /// Fired when the engine executes one or more patches targeting a product. | 252 | /// Fired when the engine executes one or more patches targeting a product. |
248 | /// </summary> | 253 | /// </summary> |
249 | event EventHandler<ExecutePatchTargetEventArgs> ExecutePatchTarget; | 254 | event EventHandler<ExecutePatchTargetEventArgs> ExecutePatchTarget; |