[USER32] Hackfix for CORE-17902 - The cursoricon (copyimage) that returns NULL to render - LR_COPYFROMRESOURCE (#6886)

* [USER32] Hackfix for CORE-17902 - The cursoricon (copyimage) that returns NULL to render - LR_COPYFROMRESOURCE

---------

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
This commit is contained in:
Julen Urizar Compains 2024-10-07 12:46:02 +02:00 committed by GitHub
parent 32e65f2f8d
commit d3ec7cdd48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;