aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-02-06 17:09:47 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-02-06 17:29:29 -0600
commit5fc93f9399795156b4a1fbde5f410ca01d94d609 (patch)
tree2fd3f9c33c472d4a2150807807e522833acdbac5
parentd5c041befbb60e7bfce14af2eaf1e8c686524209 (diff)
downloadwix-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.cpp23
-rw-r--r--src/engine/core.h2
-rw-r--r--src/engine/engine.cpp5
-rw-r--r--src/engine/engine.mc30
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
1064extern "C" HRESULT CoreCleanup( 1064extern "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
1106LExit: 1113LExit:
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 );
207HRESULT CoreCleanup( 207void 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
595LExit:
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
601LExit:
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
967Severity=Warning 967Severity=Warning
968SymbolicName=MSG_STATE_NOT_SAVED 968SymbolicName=MSG_STATE_NOT_SAVED
969Language=English 969Language=English
970The state file could not be saved. Continuing... 970The state file could not be saved, error: %1!ls!. Continuing...
971.
972
973MessageId=502
974Severity=Success
975SymbolicName=MSG_CLEANUP_BEGIN
976Language=English
977Cleanup begin.
978.
979
980MessageId=503
981Severity=Success
982SymbolicName=MSG_CLEANUP_SKIPPED_APPLY
983Language=English
984Cleanup not required due to running Apply.
985.
986
987MessageId=504
988Severity=Success
989SymbolicName=MSG_CLEANUP_SKIPPED_ELEVATION_REQUIRED
990Language=English
991Cleanup check skipped since this per-machine bundle would require elevation.
992.
993
994MessageId=599
995Severity=Success
996SymbolicName=MSG_CLEANUP_COMPLETE
997Language=English
998Cleanup complete, result: 0x%1!x!
971. 999.
972 1000
973MessageId=600 1001MessageId=600