diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-06 17:09:47 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-06 17:29:29 -0600 |
commit | 5fc93f9399795156b4a1fbde5f410ca01d94d609 (patch) | |
tree | 2fd3f9c33c472d4a2150807807e522833acdbac5 | |
parent | d5c041befbb60e7bfce14af2eaf1e8c686524209 (diff) | |
download | wix-5fc93f9399795156b4a1fbde5f410ca01d94d609.tar.gz wix-5fc93f9399795156b4a1fbde5f410ca01d94d609.tar.bz2 wix-5fc93f9399795156b4a1fbde5f410ca01d94d609.zip |
Cleanup should always be attempted, and add some logging for it.
Continuation of #6297
-rw-r--r-- | src/engine/core.cpp | 23 | ||||
-rw-r--r-- | src/engine/core.h | 2 | ||||
-rw-r--r-- | src/engine/engine.cpp | 5 | ||||
-rw-r--r-- | src/engine/engine.mc | 30 |
4 files changed, 47 insertions, 13 deletions
diff --git a/src/engine/core.cpp b/src/engine/core.cpp index 644752ff..6b32931d 100644 --- a/src/engine/core.cpp +++ b/src/engine/core.cpp | |||
@@ -1061,7 +1061,7 @@ LExit: | |||
1061 | return hr; | 1061 | return hr; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | extern "C" HRESULT CoreCleanup( | 1064 | extern "C" void CoreCleanup( |
1065 | __in BURN_ENGINE_STATE* pEngineState | 1065 | __in BURN_ENGINE_STATE* pEngineState |
1066 | ) | 1066 | ) |
1067 | { | 1067 | { |
@@ -1069,6 +1069,14 @@ extern "C" HRESULT CoreCleanup( | |||
1069 | LONGLONG llValue = 0; | 1069 | LONGLONG llValue = 0; |
1070 | BOOL fNeedsElevation = pEngineState->registration.fPerMachine && INVALID_HANDLE_VALUE == pEngineState->companionConnection.hPipe; | 1070 | BOOL fNeedsElevation = pEngineState->registration.fPerMachine && INVALID_HANDLE_VALUE == pEngineState->companionConnection.hPipe; |
1071 | 1071 | ||
1072 | LogId(REPORT_STANDARD, MSG_CLEANUP_BEGIN); | ||
1073 | |||
1074 | if (pEngineState->fApplied && BOOTSTRAPPER_ACTION_LAYOUT < pEngineState->plan.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > pEngineState->plan.action) | ||
1075 | { | ||
1076 | LogId(REPORT_STANDARD, MSG_CLEANUP_SKIPPED_APPLY); | ||
1077 | ExitFunction(); | ||
1078 | } | ||
1079 | |||
1072 | if (fNeedsElevation) | 1080 | if (fNeedsElevation) |
1073 | { | 1081 | { |
1074 | hr = VariableGetNumeric(&pEngineState->variables, BURN_BUNDLE_ELEVATED, &llValue); | 1082 | hr = VariableGetNumeric(&pEngineState->variables, BURN_BUNDLE_ELEVATED, &llValue); |
@@ -1078,12 +1086,11 @@ extern "C" HRESULT CoreCleanup( | |||
1078 | { | 1086 | { |
1079 | fNeedsElevation = FALSE; | 1087 | fNeedsElevation = FALSE; |
1080 | } | 1088 | } |
1081 | } | 1089 | else |
1082 | 1090 | { | |
1083 | if (pEngineState->fApplied && BOOTSTRAPPER_ACTION_LAYOUT < pEngineState->plan.action && BOOTSTRAPPER_ACTION_UPDATE_REPLACE > pEngineState->plan.action || | 1091 | LogId(REPORT_STANDARD, MSG_CLEANUP_SKIPPED_ELEVATION_REQUIRED); |
1084 | fNeedsElevation) | 1092 | ExitFunction(); |
1085 | { | 1093 | } |
1086 | ExitFunction(); | ||
1087 | } | 1094 | } |
1088 | 1095 | ||
1089 | if (!pEngineState->fDetected) | 1096 | if (!pEngineState->fDetected) |
@@ -1104,7 +1111,7 @@ extern "C" HRESULT CoreCleanup( | |||
1104 | ExitOnFailure(hr, "Apply during cleanup failed"); | 1111 | ExitOnFailure(hr, "Apply during cleanup failed"); |
1105 | 1112 | ||
1106 | LExit: | 1113 | LExit: |
1107 | return hr; | 1114 | LogId(REPORT_STANDARD, MSG_CLEANUP_COMPLETE, hr); |
1108 | } | 1115 | } |
1109 | 1116 | ||
1110 | // internal helper functions | 1117 | // internal helper functions |
diff --git a/src/engine/core.h b/src/engine/core.h index 47cfd559..f23738c3 100644 --- a/src/engine/core.h +++ b/src/engine/core.h | |||
@@ -204,7 +204,7 @@ HRESULT CoreAppendFileHandleSelfToCommandLine( | |||
204 | __deref_inout_z LPWSTR* psczCommandLine, | 204 | __deref_inout_z LPWSTR* psczCommandLine, |
205 | __deref_inout_z_opt LPWSTR* psczObfuscatedCommandLine | 205 | __deref_inout_z_opt LPWSTR* psczObfuscatedCommandLine |
206 | ); | 206 | ); |
207 | HRESULT CoreCleanup( | 207 | void CoreCleanup( |
208 | __in BURN_ENGINE_STATE* pEngineState | 208 | __in BURN_ENGINE_STATE* pEngineState |
209 | ); | 209 | ); |
210 | 210 | ||
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 98c98661..7e6e2922 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp | |||
@@ -592,13 +592,12 @@ static HRESULT RunNormal( | |||
592 | ExitOnFailure(hr, "Failed while running "); | 592 | ExitOnFailure(hr, "Failed while running "); |
593 | } while (fReloadApp); | 593 | } while (fReloadApp); |
594 | 594 | ||
595 | LExit: | ||
595 | if (!fSkipCleanup) | 596 | if (!fSkipCleanup) |
596 | { | 597 | { |
597 | hr = CoreCleanup(pEngineState); | 598 | CoreCleanup(pEngineState); |
598 | ExitOnFailure(hr, "Failed to cleanup before shutting down"); | ||
599 | } | 599 | } |
600 | 600 | ||
601 | LExit: | ||
602 | BurnExtensionUnload(&pEngineState->extensions); | 601 | BurnExtensionUnload(&pEngineState->extensions); |
603 | 602 | ||
604 | // If the message window is still around, close it. | 603 | // If the message window is still around, close it. |
diff --git a/src/engine/engine.mc b/src/engine/engine.mc index c90f08e3..8e0a8a66 100644 --- a/src/engine/engine.mc +++ b/src/engine/engine.mc | |||
@@ -967,7 +967,35 @@ MessageId=501 | |||
967 | Severity=Warning | 967 | Severity=Warning |
968 | SymbolicName=MSG_STATE_NOT_SAVED | 968 | SymbolicName=MSG_STATE_NOT_SAVED |
969 | Language=English | 969 | Language=English |
970 | The state file could not be saved. Continuing... | 970 | The state file could not be saved, error: %1!ls!. Continuing... |
971 | . | ||
972 | |||
973 | MessageId=502 | ||
974 | Severity=Success | ||
975 | SymbolicName=MSG_CLEANUP_BEGIN | ||
976 | Language=English | ||
977 | Cleanup begin. | ||
978 | . | ||
979 | |||
980 | MessageId=503 | ||
981 | Severity=Success | ||
982 | SymbolicName=MSG_CLEANUP_SKIPPED_APPLY | ||
983 | Language=English | ||
984 | Cleanup not required due to running Apply. | ||
985 | . | ||
986 | |||
987 | MessageId=504 | ||
988 | Severity=Success | ||
989 | SymbolicName=MSG_CLEANUP_SKIPPED_ELEVATION_REQUIRED | ||
990 | Language=English | ||
991 | Cleanup check skipped since this per-machine bundle would require elevation. | ||
992 | . | ||
993 | |||
994 | MessageId=599 | ||
995 | Severity=Success | ||
996 | SymbolicName=MSG_CLEANUP_COMPLETE | ||
997 | Language=English | ||
998 | Cleanup complete, result: 0x%1!x! | ||
971 | . | 999 | . |
972 | 1000 | ||
973 | MessageId=600 | 1001 | MessageId=600 |