diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-08-25 15:08:34 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-08-26 10:03:37 -0500 |
commit | 4f5de06073ad664f60ac775da5de8c0fa1de4923 (patch) | |
tree | 62e6d71d1e0039bdabecd785d07f9f10d023771e /src/burn | |
parent | a37208d9a26ec7886870cc17f0726676a285bf7f (diff) | |
download | wix-4f5de06073ad664f60ac775da5de8c0fa1de4923.tar.gz wix-4f5de06073ad664f60ac775da5de8c0fa1de4923.tar.bz2 wix-4f5de06073ad664f60ac775da5de8c0fa1de4923.zip |
Process and return the failed version of reboot exit codes in Burn.
(ERROR_FAIL_REBOOT_REQUIRED and ERROR_FAIL_REBOOT_INITIATED)
Fixes 6762
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/engine/engine.cpp | 2 | ||||
-rw-r--r-- | src/burn/engine/exeengine.cpp | 28 | ||||
-rw-r--r-- | src/burn/engine/logging.cpp | 4 | ||||
-rw-r--r-- | src/burn/engine/package.h | 2 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/ExitCodeTest.cpp | 20 |
5 files changed, 55 insertions, 1 deletions
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index daaf51dc..aefba98b 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
@@ -294,7 +294,7 @@ LExit: | |||
294 | LogId(REPORT_STANDARD, MSG_RESTART_ABORTED, LoggingRelationTypeToString(engineState.command.relationType)); | 294 | LogId(REPORT_STANDARD, MSG_RESTART_ABORTED, LoggingRelationTypeToString(engineState.command.relationType)); |
295 | 295 | ||
296 | fRestart = FALSE; | 296 | fRestart = FALSE; |
297 | hr = HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED); | 297 | hr = SUCCEEDED(hr) ? HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED) : HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED); |
298 | } | 298 | } |
299 | 299 | ||
300 | UninitializeEngineState(&engineState); | 300 | UninitializeEngineState(&engineState); |
diff --git a/src/burn/engine/exeengine.cpp b/src/burn/engine/exeengine.cpp index 3cb9c72a..6d326a5a 100644 --- a/src/burn/engine/exeengine.cpp +++ b/src/burn/engine/exeengine.cpp | |||
@@ -992,6 +992,16 @@ extern "C" HRESULT ExeEngineHandleExitCode( | |||
992 | { | 992 | { |
993 | typeCode = BURN_EXE_EXIT_CODE_TYPE_FORCE_REBOOT; | 993 | typeCode = BURN_EXE_EXIT_CODE_TYPE_FORCE_REBOOT; |
994 | } | 994 | } |
995 | else if (ERROR_FAIL_REBOOT_REQUIRED == dwExitCode || | ||
996 | HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED) == static_cast<HRESULT>(dwExitCode)) | ||
997 | { | ||
998 | typeCode = BURN_EXE_EXIT_CODE_TYPE_ERROR_SCHEDULE_REBOOT; | ||
999 | } | ||
1000 | else if (ERROR_FAIL_REBOOT_INITIATED == dwExitCode || | ||
1001 | HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED) == static_cast<HRESULT>(dwExitCode)) | ||
1002 | { | ||
1003 | typeCode = BURN_EXE_EXIT_CODE_TYPE_ERROR_FORCE_REBOOT; | ||
1004 | } | ||
995 | else | 1005 | else |
996 | { | 1006 | { |
997 | typeCode = BURN_EXE_EXIT_CODE_TYPE_ERROR; | 1007 | typeCode = BURN_EXE_EXIT_CODE_TYPE_ERROR; |
@@ -1024,6 +1034,24 @@ extern "C" HRESULT ExeEngineHandleExitCode( | |||
1024 | hr = S_OK; | 1034 | hr = S_OK; |
1025 | break; | 1035 | break; |
1026 | 1036 | ||
1037 | case BURN_EXE_EXIT_CODE_TYPE_ERROR_SCHEDULE_REBOOT: | ||
1038 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_REQUIRED; | ||
1039 | hr = HRESULT_FROM_WIN32(dwExitCode); | ||
1040 | if (SUCCEEDED(hr)) | ||
1041 | { | ||
1042 | hr = HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED); | ||
1043 | } | ||
1044 | break; | ||
1045 | |||
1046 | case BURN_EXE_EXIT_CODE_TYPE_ERROR_FORCE_REBOOT: | ||
1047 | *pRestart = BOOTSTRAPPER_APPLY_RESTART_INITIATED; | ||
1048 | hr = HRESULT_FROM_WIN32(dwExitCode); | ||
1049 | if (SUCCEEDED(hr)) | ||
1050 | { | ||
1051 | hr = HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED); | ||
1052 | } | ||
1053 | break; | ||
1054 | |||
1027 | default: | 1055 | default: |
1028 | hr = E_UNEXPECTED; | 1056 | hr = E_UNEXPECTED; |
1029 | break; | 1057 | break; |
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp index 38c9d2d5..a16e82b0 100644 --- a/src/burn/engine/logging.cpp +++ b/src/burn/engine/logging.cpp | |||
@@ -545,6 +545,10 @@ extern "C" LPCSTR LoggingExitCodeTypeToString( | |||
545 | return "ScheduleReboot"; | 545 | return "ScheduleReboot"; |
546 | case BURN_EXE_EXIT_CODE_TYPE_FORCE_REBOOT: | 546 | case BURN_EXE_EXIT_CODE_TYPE_FORCE_REBOOT: |
547 | return "ForceReboot"; | 547 | return "ForceReboot"; |
548 | case BURN_EXE_EXIT_CODE_TYPE_ERROR_SCHEDULE_REBOOT: | ||
549 | return "ErrorScheduleReboot"; | ||
550 | case BURN_EXE_EXIT_CODE_TYPE_ERROR_FORCE_REBOOT: | ||
551 | return "ErrorForceReboot"; | ||
548 | default: | 552 | default: |
549 | return "Invalid"; | 553 | return "Invalid"; |
550 | } | 554 | } |
diff --git a/src/burn/engine/package.h b/src/burn/engine/package.h index e45c775d..bdebd5b6 100644 --- a/src/burn/engine/package.h +++ b/src/burn/engine/package.h | |||
@@ -37,6 +37,8 @@ enum BURN_EXE_EXIT_CODE_TYPE | |||
37 | BURN_EXE_EXIT_CODE_TYPE_ERROR, | 37 | BURN_EXE_EXIT_CODE_TYPE_ERROR, |
38 | BURN_EXE_EXIT_CODE_TYPE_SCHEDULE_REBOOT, | 38 | BURN_EXE_EXIT_CODE_TYPE_SCHEDULE_REBOOT, |
39 | BURN_EXE_EXIT_CODE_TYPE_FORCE_REBOOT, | 39 | BURN_EXE_EXIT_CODE_TYPE_FORCE_REBOOT, |
40 | BURN_EXE_EXIT_CODE_TYPE_ERROR_SCHEDULE_REBOOT, | ||
41 | BURN_EXE_EXIT_CODE_TYPE_ERROR_FORCE_REBOOT, | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | enum BURN_EXE_PROTOCOL_TYPE | 44 | enum BURN_EXE_PROTOCOL_TYPE |
diff --git a/src/burn/test/BurnUnitTest/ExitCodeTest.cpp b/src/burn/test/BurnUnitTest/ExitCodeTest.cpp index 2c32c6ab..d7d91d06 100644 --- a/src/burn/test/BurnUnitTest/ExitCodeTest.cpp +++ b/src/burn/test/BurnUnitTest/ExitCodeTest.cpp | |||
@@ -82,16 +82,28 @@ static void LoadEngineState( | |||
82 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), S_OK, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Standard" }, | 82 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), S_OK, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Standard" }, |
83 | { ERROR_SUCCESS_REBOOT_INITIATED, S_OK, BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Standard" }, | 83 | { ERROR_SUCCESS_REBOOT_INITIATED, S_OK, BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Standard" }, |
84 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), S_OK, BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Standard" }, | 84 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), S_OK, BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Standard" }, |
85 | { ERROR_FAIL_REBOOT_REQUIRED, HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Standard" }, | ||
86 | { (DWORD)HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED), HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Standard" }, | ||
87 | { ERROR_FAIL_REBOOT_INITIATED, HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Standard" }, | ||
88 | { (DWORD)HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED), HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Standard" }, | ||
85 | { 0, E_FAIL, BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 89 | { 0, E_FAIL, BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
86 | { 1, S_OK, BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 90 | { 1, S_OK, BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
87 | { 3, S_OK, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Custom" }, | 91 | { 3, S_OK, BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Custom" }, |
88 | { 4, S_OK, BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Custom" }, | 92 | { 4, S_OK, BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Custom" }, |
93 | { 5, HRESULT_FROM_WIN32(5), BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Custom" }, | ||
94 | { (DWORD)HRESULT_FROM_WIN32(5), HRESULT_FROM_WIN32(5), BOOTSTRAPPER_APPLY_RESTART_REQUIRED, L"Custom" }, | ||
95 | { 6, HRESULT_FROM_WIN32(6), BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Custom" }, | ||
96 | { (DWORD)HRESULT_FROM_WIN32(6), HRESULT_FROM_WIN32(6), BOOTSTRAPPER_APPLY_RESTART_INITIATED, L"Custom" }, | ||
89 | { ERROR_SUCCESS_REBOOT_REQUIRED, HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 97 | { ERROR_SUCCESS_REBOOT_REQUIRED, HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
90 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 98 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
91 | { ERROR_SUCCESS_RESTART_REQUIRED, HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 99 | { ERROR_SUCCESS_RESTART_REQUIRED, HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
92 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 100 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), HRESULT_FROM_WIN32(ERROR_SUCCESS_RESTART_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
93 | { ERROR_SUCCESS_REBOOT_INITIATED, HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 101 | { ERROR_SUCCESS_REBOOT_INITIATED, HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
94 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | 102 | { (DWORD)HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, |
103 | { ERROR_FAIL_REBOOT_REQUIRED, HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | ||
104 | { (DWORD)HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED), HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | ||
105 | { ERROR_FAIL_REBOOT_INITIATED, HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | ||
106 | { (DWORD)HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED), HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_INITIATED), BOOTSTRAPPER_APPLY_RESTART_NONE, L"Custom" }, | ||
95 | }; | 107 | }; |
96 | 108 | ||
97 | engineState.sczBundleEngineWorkingPath = L"tests\\ignore\\this\\path\\to\\burn.exe"; | 109 | engineState.sczBundleEngineWorkingPath = L"tests\\ignore\\this\\path\\to\\burn.exe"; |
@@ -321,12 +333,20 @@ static void LoadEngineState( | |||
321 | L" <ExitCode Code='0' Type='2' />" | 333 | L" <ExitCode Code='0' Type='2' />" |
322 | L" <ExitCode Code='3' Type='3' />" | 334 | L" <ExitCode Code='3' Type='3' />" |
323 | L" <ExitCode Code='4' Type='4' />" | 335 | L" <ExitCode Code='4' Type='4' />" |
336 | L" <ExitCode Code='5' Type='5' />" | ||
337 | L" <ExitCode Code='-2147024891' Type='5' />" | ||
338 | L" <ExitCode Code='6' Type='6' />" | ||
339 | L" <ExitCode Code='-2147024890' Type='6' />" | ||
324 | L" <ExitCode Code='3010' Type='2' />" | 340 | L" <ExitCode Code='3010' Type='2' />" |
325 | L" <ExitCode Code='-2147021886' Type='2' />" | 341 | L" <ExitCode Code='-2147021886' Type='2' />" |
326 | L" <ExitCode Code='3011' Type='2' />" | 342 | L" <ExitCode Code='3011' Type='2' />" |
327 | L" <ExitCode Code='-2147021885' Type='2' />" | 343 | L" <ExitCode Code='-2147021885' Type='2' />" |
328 | L" <ExitCode Code='1641' Type='2' />" | 344 | L" <ExitCode Code='1641' Type='2' />" |
329 | L" <ExitCode Code='-2147023255' Type='2' />" | 345 | L" <ExitCode Code='-2147023255' Type='2' />" |
346 | L" <ExitCode Code='3017' Type='2' />" | ||
347 | L" <ExitCode Code='-2147021879' Type='2' />" | ||
348 | L" <ExitCode Code='3018' Type='2' />" | ||
349 | L" <ExitCode Code='-2147021878' Type='2' />" | ||
330 | L" <ExitCode Code='*' Type='1' />" | 350 | L" <ExitCode Code='*' Type='1' />" |
331 | L" <PayloadRef Id='test.exe' />" | 351 | L" <PayloadRef Id='test.exe' />" |
332 | L" </ExePackage>" | 352 | L" </ExePackage>" |