From 13e4451970e200181e0f3a9d011b2d8382311461 Mon Sep 17 00:00:00 2001 From: Whindmar Saksit Date: Fri, 3 May 2024 19:53:31 +0200 Subject: [PATCH] No need to retry HRESULTs --- sdk/include/reactos/shellutils.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sdk/include/reactos/shellutils.h b/sdk/include/reactos/shellutils.h index 44ed5a88130..a15d5ed100c 100644 --- a/sdk/include/reactos/shellutils.h +++ b/sdk/include/reactos/shellutils.h @@ -92,24 +92,17 @@ static inline UINT SHELL_ErrorBoxHelper(HWND hwndOwner, UINT Error) { WCHAR buf[400]; - UINT cch, msgId, u32_errstr = 2; + UINT cch, u32_errstr = 2; if (!IsWindowVisible(hwndOwner)) hwndOwner = NULL; if (Error == ERROR_SUCCESS) Error = ERROR_INTERNAL_ERROR; - msgId = Error; -retry: cch = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, msgId, 0, buf, _countof(buf), NULL); + NULL, Error, 0, buf, _countof(buf), NULL); if (!cch) { - if (HIWORD(msgId) == HIWORD(HRESULT_FROM_WIN32(1))) - { - msgId = HRESULT_CODE(msgId); // Extract ERROR_ from HRESULT_FROM_WIN32 - goto retry; // and try again. - } cch = LoadStringW(LoadLibraryW(L"USER32"), u32_errstr, buf, _countof(buf)); wsprintfW(buf + cch, L"\n\n%#x (%d)", Error, Error); } @@ -120,7 +113,7 @@ retry: template static UINT SHELL_ErrorBox(H hwndOwner, UINT Error = GetLastError()) { - return SHELL_ErrorBoxHelper(hwndOwner, Error); + return SHELL_ErrorBoxHelper(const_cast(hwndOwner), Error); } #endif