[PATCH (try 2) 3/3] user32: Load hIconSmIntern from the best-matching resource.

Alex Henrie alexhenrie24 at gmail.com
Wed May 13 01:33:13 CDT 2015


If hIconSm is null, "the system searches the icon resource specified by
the hIcon member for an icon of the appropriate size to use as the small
icon." In other words, the 16x16 icon is used for the window instead of
downscaling the 32x32 icon to 16x16.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633577%28v=vs.85%29.aspx

This patch is part 2 of the fix for
https://bugs.winehq.org/show_bug.cgi?id=29337
---
 dlls/user32/class.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/class.c b/dlls/user32/class.c
index 531c2e3..2c94367 100644
--- a/dlls/user32/class.c
+++ b/dlls/user32/class.c
@@ -599,7 +599,8 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
     classPtr->hIconSmIntern = wc->hIcon && !wc->hIconSm ?
                                             CopyImage( wc->hIcon, IMAGE_ICON,
                                                 GetSystemMetrics( SM_CXSMICON ),
-                                                GetSystemMetrics( SM_CYSMICON ), 0 ) : NULL;
+                                                GetSystemMetrics( SM_CYSMICON ),
+                                                LR_COPYFROMRESOURCE ) : NULL;
     classPtr->hCursor       = wc->hCursor;
     classPtr->hbrBackground = wc->hbrBackground;
     classPtr->winproc       = WINPROC_AllocProc( wc->lpfnWndProc, FALSE );
@@ -643,7 +644,8 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
     classPtr->hIconSmIntern = wc->hIcon && !wc->hIconSm ?
                                             CopyImage( wc->hIcon, IMAGE_ICON,
                                                 GetSystemMetrics( SM_CXSMICON ),
-                                                GetSystemMetrics( SM_CYSMICON ), 0 ) : NULL;
+                                                GetSystemMetrics( SM_CYSMICON ),
+                                                LR_COPYFROMRESOURCE ) : NULL;
     classPtr->hCursor       = wc->hCursor;
     classPtr->hbrBackground = wc->hbrBackground;
     classPtr->winproc       = WINPROC_AllocProc( wc->lpfnWndProc, TRUE );
@@ -981,7 +983,8 @@ static ULONG_PTR CLASS_SetClassLong( HWND hwnd, INT offset, LONG_PTR newval,
         }
         if (newval && !class->hIconSm)
             class->hIconSmIntern = CopyImage( (HICON)newval, IMAGE_ICON,
-                      GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
+                      GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
+                      LR_COPYFROMRESOURCE );
         class->hIcon = (HICON)newval;
         break;
     case GCLP_HICONSM:
@@ -989,7 +992,8 @@ static ULONG_PTR CLASS_SetClassLong( HWND hwnd, INT offset, LONG_PTR newval,
         if (retval && !newval)
             class->hIconSmIntern = class->hIcon ? CopyImage( class->hIcon, IMAGE_ICON,
                                                 GetSystemMetrics( SM_CXSMICON ),
-                                                GetSystemMetrics( SM_CYSMICON ), 0 ) : NULL;
+                                                GetSystemMetrics( SM_CYSMICON ),
+                                                LR_COPYFROMRESOURCE ) : NULL;
         else if (!retval && newval && class->hIconSmIntern)
         {
             DestroyIcon(class->hIconSmIntern);
-- 
2.4.0




More information about the wine-patches mailing list