From d3ec7cdd4821ae3372d58466900e4518c982a360 Mon Sep 17 00:00:00 2001 From: Julen Urizar Compains Date: Mon, 7 Oct 2024 12:46:02 +0200 Subject: [PATCH] [USER32] Hackfix for CORE-17902 - The cursoricon (copyimage) that returns NULL to render - LR_COPYFROMRESOURCE (#6886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [USER32] Hackfix for CORE-17902 - The cursoricon (copyimage) that returns NULL to render - LR_COPYFROMRESOURCE --------- Co-authored-by: Hermès BÉLUSCA - MAÏTO --- win32ss/user/user32/windows/cursoricon.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/win32ss/user/user32/windows/cursoricon.c b/win32ss/user/user32/windows/cursoricon.c index 586deb7a728..53c98456e81 100644 --- a/win32ss/user/user32/windows/cursoricon.c +++ b/win32ss/user/user32/windows/cursoricon.c @@ -2044,7 +2044,15 @@ HANDLE WINAPI CopyImage( return BITMAP_CopyImage(hImage, cxDesired, cyDesired, fuFlags); case IMAGE_CURSOR: case IMAGE_ICON: - return CURSORICON_CopyImage(hImage, uType == IMAGE_ICON, cxDesired, cyDesired, fuFlags); + /* HACK: Copying bitmaps with LR_COPYFROMRESOURCE flag fails. CORE-17902. + * This is a way to return the original bit map if we need + * the icons to show up. We need a simpler test. */ + { + HANDLE handle = CURSORICON_CopyImage(hImage, uType == IMAGE_ICON, cxDesired, cyDesired, fuFlags); + if (!handle && (fuFlags & (LR_COPYFROMRESOURCE|LR_COPYRETURNORG))) + handle = CURSORICON_CopyImage(hImage, uType == IMAGE_ICON, cxDesired, cyDesired, (fuFlags & ~LR_COPYFROMRESOURCE)); + return handle; + } default: SetLastError(ERROR_INVALID_PARAMETER); break;