https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d3ec7cdd4821ae3372d58…
commit d3ec7cdd4821ae3372d58466900e4518c982a360
Author: Julen Urizar Compains <julenuri(a)hotmail.com>
AuthorDate: Mon Oct 7 12:46:02 2024 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Oct 7 05:46:02 2024 -0500
[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(a)reactos.org>
---
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;