diff options
author | nd101 <Fong@nd.com.cn> | 2019-07-05 15:35:18 +0800 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-07-10 04:45:27 +0200 |
commit | 3811e9b80bbd4f1598ab8958a8bf050262170265 (patch) | |
tree | 84930aa6812f2bfa484366006080abd2a8af7013 /setup_native | |
parent | 2f2f4767089512c34514896bc37823f9310e9dd4 (diff) |
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 <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'setup_native')
-rw-r--r-- | setup_native/source/win32/customactions/inst_msu/inst_msu.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
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<HRESULT>(nExitCode)) + HRESULT hr = static_cast<HRESULT>(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; |