From 3811e9b80bbd4f1598ab8958a8bf050262170265 Mon Sep 17 00:00:00 2001 From: nd101 Date: Fri, 5 Jul 2019 15:35:18 +0800 Subject: fix HRESULT_FROM_WIN32 can not be placed inside switch for SDK8.1 For Windows SDK 8.1 HRESULT_FROM_WIN32 is defined as an inline function without the constexpr, which is required for case statement inside a switch. Change-Id: Ibb195ef900926d87ff04f82a6d73112b8858f633 Reviewed-on: https://gerrit.libreoffice.org/75111 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- .../source/win32/customactions/inst_msu/inst_msu.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'setup_native/source') diff --git a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx index 6ce517f2f863..26f7668ff069 100644 --- a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx +++ b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx @@ -604,13 +604,21 @@ extern "C" __declspec(dllexport) UINT __stdcall InstallMSU(MSIHANDLE hInstall) if (!GetExitCodeProcess(pi.hProcess, &nExitCode)) ThrowLastError("GetExitCodeProcess"); - switch (HRESULT hr = static_cast(nExitCode)) + HRESULT hr = static_cast(nExitCode); + + // HRESULT_FROM_WIN32 is defined as an inline function in SDK 8.1 without the constexpr + // And it won't work to place it inside the switch statement. + if (HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED) == hr) + { + hr = ERROR_SUCCESS_REBOOT_REQUIRED; + } + + switch (hr) { case S_OK: case WU_S_ALREADY_INSTALLED: case WU_E_NOT_APPLICABLE: // Windows could lie us about its version, etc. case ERROR_SUCCESS_REBOOT_REQUIRED: - case HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED): case WU_S_REBOOT_REQUIRED: WriteLog(hInstall, "wusa.exe succeeded with exit code", Num2Hex(nExitCode)); return ERROR_SUCCESS; -- cgit