diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-18 20:16:07 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-19 12:07:32 -0500 |
commit | fbc1a73743368211d5d8c7fc0625adf6eb9ca50c (patch) | |
tree | c314d72b4b25afab7a27be664a1bffa5bdd80b3a /src/burn/engine/exeengine.cpp | |
parent | fb54576f1d05e82ba47cd718c4c4f8b3bad624c9 (diff) | |
download | wix-fbc1a73743368211d5d8c7fc0625adf6eb9ca50c.tar.gz wix-fbc1a73743368211d5d8c7fc0625adf6eb9ca50c.tar.bz2 wix-fbc1a73743368211d5d8c7fc0625adf6eb9ca50c.zip |
Add checkpoint so Exe and Msu packages rollback after being cancelled.
Fixes 5950
Diffstat (limited to 'src/burn/engine/exeengine.cpp')
-rw-r--r-- | src/burn/engine/exeengine.cpp | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/burn/engine/exeengine.cpp b/src/burn/engine/exeengine.cpp index 4c3c6fb0..a1049006 100644 --- a/src/burn/engine/exeengine.cpp +++ b/src/burn/engine/exeengine.cpp | |||
@@ -276,30 +276,33 @@ extern "C" HRESULT ExeEnginePlanAddPackage( | |||
276 | hr = DependencyPlanPackage(NULL, pPackage, pPlan); | 276 | hr = DependencyPlanPackage(NULL, pPackage, pPlan); |
277 | ExitOnFailure(hr, "Failed to plan package dependency actions."); | 277 | ExitOnFailure(hr, "Failed to plan package dependency actions."); |
278 | 278 | ||
279 | // add execute action | 279 | // add rollback action |
280 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->execute) | 280 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->rollback) |
281 | { | 281 | { |
282 | hr = PlanAppendExecuteAction(pPlan, &pAction); | 282 | hr = PlanAppendRollbackAction(pPlan, &pAction); |
283 | ExitOnFailure(hr, "Failed to append execute action."); | 283 | ExitOnFailure(hr, "Failed to append rollback action."); |
284 | 284 | ||
285 | pAction->type = BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE; | 285 | pAction->type = BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE; |
286 | pAction->exePackage.pPackage = pPackage; | 286 | pAction->exePackage.pPackage = pPackage; |
287 | pAction->exePackage.action = pPackage->execute; | 287 | pAction->exePackage.action = pPackage->rollback; |
288 | 288 | ||
289 | LoggingSetPackageVariable(pPackage, NULL, FALSE, pLog, pVariables, NULL); // ignore errors. | 289 | LoggingSetPackageVariable(pPackage, NULL, TRUE, pLog, pVariables, NULL); // ignore errors. |
290 | |||
291 | hr = PlanExecuteCheckpoint(pPlan); | ||
292 | ExitOnFailure(hr, "Failed to append execute checkpoint."); | ||
290 | } | 293 | } |
291 | 294 | ||
292 | // add rollback action | 295 | // add execute action |
293 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->rollback) | 296 | if (BOOTSTRAPPER_ACTION_STATE_NONE != pPackage->execute) |
294 | { | 297 | { |
295 | hr = PlanAppendRollbackAction(pPlan, &pAction); | 298 | hr = PlanAppendExecuteAction(pPlan, &pAction); |
296 | ExitOnFailure(hr, "Failed to append rollback action."); | 299 | ExitOnFailure(hr, "Failed to append execute action."); |
297 | 300 | ||
298 | pAction->type = BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE; | 301 | pAction->type = BURN_EXECUTE_ACTION_TYPE_EXE_PACKAGE; |
299 | pAction->exePackage.pPackage = pPackage; | 302 | pAction->exePackage.pPackage = pPackage; |
300 | pAction->exePackage.action = pPackage->rollback; | 303 | pAction->exePackage.action = pPackage->execute; |
301 | 304 | ||
302 | LoggingSetPackageVariable(pPackage, NULL, TRUE, pLog, pVariables, NULL); // ignore errors. | 305 | LoggingSetPackageVariable(pPackage, NULL, FALSE, pLog, pVariables, NULL); // ignore errors. |
303 | } | 306 | } |
304 | 307 | ||
305 | LExit: | 308 | LExit: |
@@ -493,6 +496,10 @@ extern "C" HRESULT ExeEngineRunProcess( | |||
493 | ExitWithLastError(hr, "Failed to CreateProcess on path: %ls", wzExecutablePath); | 496 | ExitWithLastError(hr, "Failed to CreateProcess on path: %ls", wzExecutablePath); |
494 | } | 497 | } |
495 | 498 | ||
499 | message.type = GENERIC_EXECUTE_MESSAGE_PROCESS_STARTED; | ||
500 | message.dwUIHint = MB_OK; | ||
501 | pfnGenericMessageHandler(&message, pvContext); | ||
502 | |||
496 | if (fFireAndForget) | 503 | if (fFireAndForget) |
497 | { | 504 | { |
498 | ::WaitForInputIdle(pi.hProcess, 5000); | 505 | ::WaitForInputIdle(pi.hProcess, 5000); |
@@ -504,6 +511,7 @@ extern "C" HRESULT ExeEngineRunProcess( | |||
504 | // Wait for the executable process while sending fake progress to allow cancel. | 511 | // Wait for the executable process while sending fake progress to allow cancel. |
505 | do | 512 | do |
506 | { | 513 | { |
514 | memset(&message, 0, sizeof(message)); | ||
507 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; | 515 | message.type = GENERIC_EXECUTE_MESSAGE_PROGRESS; |
508 | message.dwUIHint = MB_OKCANCEL; | 516 | message.dwUIHint = MB_OKCANCEL; |
509 | message.progress.dwPercentage = 50; | 517 | message.progress.dwPercentage = 50; |
@@ -546,6 +554,11 @@ extern "C" HRESULT ExeEngineRunProcess( | |||
546 | } | 554 | } |
547 | } while (HRESULT_FROM_WIN32(WAIT_TIMEOUT) == hr); | 555 | } while (HRESULT_FROM_WIN32(WAIT_TIMEOUT) == hr); |
548 | 556 | ||
557 | memset(&message, 0, sizeof(message)); | ||
558 | message.type = GENERIC_EXECUTE_MESSAGE_PROCESS_COMPLETED; | ||
559 | message.dwUIHint = MB_OK; | ||
560 | pfnGenericMessageHandler(&message, pvContext); | ||
561 | |||
549 | if (fDelayedCancel) | 562 | if (fDelayedCancel) |
550 | { | 563 | { |
551 | ExitWithRootFailure(hr, HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), "Bootstrapper application cancelled during package process progress, exit code: 0x%x", *pdwExitCode); | 564 | ExitWithRootFailure(hr, HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), "Bootstrapper application cancelled during package process progress, exit code: 0x%x", *pdwExitCode); |