Paul Gofman : winex11.drv: Treat invalid icon as no icon in fetch_icon_data().
Alexandre Julliard
julliard at winehq.org
Mon Apr 25 16:30:32 CDT 2022
Module: wine
Branch: master
Commit: 3eb944c0a7a1b4857cb0b74d04a8450b636c98de
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3eb944c0a7a1b4857cb0b74d04a8450b636c98de
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Fri Apr 22 18:53:56 2022 +0300
winex11.drv: Treat invalid icon as no icon in fetch_icon_data().
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winex11.drv/window.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 48500284b68..4cf771a998f 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -598,6 +598,11 @@ failed:
}
+static HICON get_icon_info( HICON icon, ICONINFO *ii )
+{
+ return icon && NtUserGetIconInfo( icon, ii, NULL, NULL, NULL, 0 ) ? icon : NULL;
+}
+
/***********************************************************************
* fetch_icon_data
*/
@@ -612,21 +617,24 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small )
if (!icon_big)
{
- icon_big = (HICON)send_message( hwnd, WM_GETICON, ICON_BIG, 0 );
- if (!icon_big) icon_big = (HICON)NtUserGetClassLongPtrW( hwnd, GCLP_HICON );
- if (!icon_big) icon_big = LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
+ icon_big = get_icon_info( (HICON)send_message( hwnd, WM_GETICON, ICON_BIG, 0 ), &ii );
+ if (!icon_big)
+ icon_big = get_icon_info( (HICON)NtUserGetClassLongPtrW( hwnd, GCLP_HICON ), &ii );
+ if (!icon_big)
+ icon_big = get_icon_info( LoadIconW( 0, (LPWSTR)IDI_WINLOGO ), &ii);
}
if (!icon_small)
{
- icon_small = (HICON)send_message( hwnd, WM_GETICON, ICON_SMALL, 0 );
- if (!icon_small) icon_small = (HICON)NtUserGetClassLongPtrW( hwnd, GCLP_HICONSM );
+ icon_small = get_icon_info( (HICON)send_message( hwnd, WM_GETICON, ICON_SMALL, 0 ), &ii_small );
+ if (!icon_small)
+ icon_small = get_icon_info( (HICON)NtUserGetClassLongPtrW( hwnd, GCLP_HICONSM ), &ii_small );
}
- if (!NtUserGetIconInfo( icon_big, &ii, NULL, NULL, NULL, 0 )) return;
+ if (!icon_big) return;
hDC = NtGdiCreateCompatibleDC(0);
bits = get_bitmap_argb( hDC, ii.hbmColor, ii.hbmMask, &size );
- if (bits && NtUserGetIconInfo( icon_small, &ii_small, NULL, NULL, NULL, 0 ))
+ if (bits && icon_small)
{
unsigned int size_small;
unsigned long *bits_small, *new;
More information about the wine-cvs
mailing list