diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-03 17:09:50 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-04 22:16:10 -0600 |
| commit | c6c17104b50936432a3fe9ca214ba9a3dfa32780 (patch) | |
| tree | 7ad23896fd7e1768a5f81ebb4dc2abe99718eadb /src/engine/engine.cpp | |
| parent | fd8c2b0899bfbce07386af245c04eb21dc01cbdf (diff) | |
| download | wix-c6c17104b50936432a3fe9ca214ba9a3dfa32780.tar.gz wix-c6c17104b50936432a3fe9ca214ba9a3dfa32780.tar.bz2 wix-c6c17104b50936432a3fe9ca214ba9a3dfa32780.zip | |
Automatically uninstall the bundle after Quit if eligible.
For now, the requirements are:
* The bundle is installed and
* The bundle is per-user or has already elevated and
* No non-permanent packages are installed and
* No non-permanent packages are cached and
* No related bundle would run by default during uninstall and
* The bundle didn't Uninstall/Cache/Install/Modify/Repair and
* The BA didn't opt out of this behavior
Diffstat (limited to 'src/engine/engine.cpp')
| -rw-r--r-- | src/engine/engine.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index e3ace592..bc27cb14 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp | |||
| @@ -39,7 +39,8 @@ static HRESULT RunRunOnce( | |||
| 39 | ); | 39 | ); |
| 40 | static HRESULT RunApplication( | 40 | static HRESULT RunApplication( |
| 41 | __in BURN_ENGINE_STATE* pEngineState, | 41 | __in BURN_ENGINE_STATE* pEngineState, |
| 42 | __out BOOL* pfReloadApp | 42 | __out BOOL* pfReloadApp, |
| 43 | __out BOOL* pfSkipCleanup | ||
| 43 | ); | 44 | ); |
| 44 | static HRESULT ProcessMessage( | 45 | static HRESULT ProcessMessage( |
| 45 | __in BURN_ENGINE_STATE* pEngineState, | 46 | __in BURN_ENGINE_STATE* pEngineState, |
| @@ -529,6 +530,7 @@ static HRESULT RunNormal( | |||
| 529 | HANDLE hPipesCreatedEvent = NULL; | 530 | HANDLE hPipesCreatedEvent = NULL; |
| 530 | BOOL fContinueExecution = TRUE; | 531 | BOOL fContinueExecution = TRUE; |
| 531 | BOOL fReloadApp = FALSE; | 532 | BOOL fReloadApp = FALSE; |
| 533 | BOOL fSkipCleanup = FALSE; | ||
| 532 | BURN_EXTENSION_ENGINE_CONTEXT extensionEngineContext = { }; | 534 | BURN_EXTENSION_ENGINE_CONTEXT extensionEngineContext = { }; |
| 533 | 535 | ||
| 534 | // Initialize logging. | 536 | // Initialize logging. |
| @@ -584,11 +586,18 @@ static HRESULT RunNormal( | |||
| 584 | do | 586 | do |
| 585 | { | 587 | { |
| 586 | fReloadApp = FALSE; | 588 | fReloadApp = FALSE; |
| 589 | pEngineState->fQuit = FALSE; | ||
| 587 | 590 | ||
| 588 | hr = RunApplication(pEngineState, &fReloadApp); | 591 | hr = RunApplication(pEngineState, &fReloadApp, &fSkipCleanup); |
| 589 | ExitOnFailure(hr, "Failed while running "); | 592 | ExitOnFailure(hr, "Failed while running "); |
| 590 | } while (fReloadApp); | 593 | } while (fReloadApp); |
| 591 | 594 | ||
| 595 | if (!fSkipCleanup) | ||
| 596 | { | ||
| 597 | hr = CoreCleanup(pEngineState); | ||
| 598 | ExitOnFailure(hr, "Failed to cleanup before shutting down"); | ||
| 599 | } | ||
| 600 | |||
| 592 | LExit: | 601 | LExit: |
| 593 | BurnExtensionUnload(&pEngineState->extensions); | 602 | BurnExtensionUnload(&pEngineState->extensions); |
| 594 | 603 | ||
| @@ -732,7 +741,8 @@ LExit: | |||
| 732 | 741 | ||
| 733 | static HRESULT RunApplication( | 742 | static HRESULT RunApplication( |
| 734 | __in BURN_ENGINE_STATE* pEngineState, | 743 | __in BURN_ENGINE_STATE* pEngineState, |
| 735 | __out BOOL* pfReloadApp | 744 | __out BOOL* pfReloadApp, |
| 745 | __out BOOL* pfSkipCleanup | ||
| 736 | ) | 746 | ) |
| 737 | { | 747 | { |
| 738 | HRESULT hr = S_OK; | 748 | HRESULT hr = S_OK; |
| @@ -787,6 +797,11 @@ LExit: | |||
| 787 | LogId(REPORT_STANDARD, MSG_BA_REQUESTED_RELOAD); | 797 | LogId(REPORT_STANDARD, MSG_BA_REQUESTED_RELOAD); |
| 788 | *pfReloadApp = TRUE; | 798 | *pfReloadApp = TRUE; |
| 789 | } | 799 | } |
| 800 | else if (BOOTSTRAPPER_SHUTDOWN_ACTION_SKIP_CLEANUP == shutdownAction) | ||
| 801 | { | ||
| 802 | LogId(REPORT_STANDARD, MSG_BA_REQUESTED_SKIP_CLEANUP); | ||
| 803 | *pfSkipCleanup = TRUE; | ||
| 804 | } | ||
| 790 | } | 805 | } |
| 791 | 806 | ||
| 792 | // Unload BA. | 807 | // Unload BA. |
