Alexandre Julliard : user32: Propagate the LoadImage flags into the low-level loader functions.

Alexandre Julliard julliard at winehq.org
Fri Jan 28 12:30:14 CST 2011


Module: wine
Branch: master
Commit: ab4a5a327d5ddc6c97c79733fd1060c7e023856c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab4a5a327d5ddc6c97c79733fd1060c7e023856c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jan 28 12:42:56 2011 +0100

user32: Propagate the LoadImage flags into the low-level loader functions.

---

 dlls/user32/cursoricon.c |   51 +++++++++++++++++++++++----------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index fcb5d75..dd5d1bb 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -413,7 +413,7 @@ typedef BOOL (*fnGetCIEntry)( LPCVOID dir, int n,
  * Find the icon closest to the requested size and bit depth.
  */
 static int CURSORICON_FindBestIcon( LPCVOID dir, fnGetCIEntry get_entry,
-                                    int width, int height, int depth )
+                                    int width, int height, int depth, UINT loadflags )
 {
     int i, cx, cy, bits, bestEntry = -1;
     UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
@@ -475,7 +475,7 @@ static BOOL CURSORICON_GetResIconEntry( LPCVOID dir, int n,
  * FIXME: parameter 'color' ignored.
  */
 static int CURSORICON_FindBestCursor( LPCVOID dir, fnGetCIEntry get_entry,
-                                      int width, int height, int depth )
+                                      int width, int height, int depth, UINT loadflags )
 {
     int i, maxwidth, maxheight, cx, cy, bits, bestEntry = -1;
 
@@ -530,22 +530,24 @@ static BOOL CURSORICON_GetResCursorEntry( LPCVOID dir, int n,
 }
 
 static const CURSORICONDIRENTRY *CURSORICON_FindBestIconRes( const CURSORICONDIR * dir,
-                                      int width, int height, int depth )
+                                                             int width, int height, int depth,
+                                                             UINT loadflags )
 {
     int n;
 
     n = CURSORICON_FindBestIcon( dir, CURSORICON_GetResIconEntry,
-                                 width, height, depth );
+                                 width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
 }
 
 static const CURSORICONDIRENTRY *CURSORICON_FindBestCursorRes( const CURSORICONDIR *dir,
-                                      int width, int height, int depth )
+                                                               int width, int height, int depth,
+                                                               UINT loadflags )
 {
     int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetResCursorEntry,
-                                   width, height, depth );
+                                       width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
@@ -570,20 +572,22 @@ static BOOL CURSORICON_GetFileEntry( LPCVOID dir, int n,
 }
 
 static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestCursorFile( const CURSORICONFILEDIR *dir,
-                                      int width, int height, int depth )
+                                                                    int width, int height, int depth,
+                                                                    UINT loadflags )
 {
-    int n = CURSORICON_FindBestCursor( (LPCVOID) dir, CURSORICON_GetFileEntry,
-                                       width, height, depth );
+    int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetFileEntry,
+                                       width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
 }
 
 static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestIconFile( const CURSORICONFILEDIR *dir,
-                                      int width, int height, int depth )
+                                                                  int width, int height, int depth,
+                                                                  UINT loadflags )
 {
-    int n = CURSORICON_FindBestIcon((LPCVOID) dir, CURSORICON_GetFileEntry,
-                                     width, height, depth );
+    int n = CURSORICON_FindBestIcon( dir, CURSORICON_GetFileEntry,
+                                     width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
@@ -945,7 +949,7 @@ static void riff_find_chunk( DWORD chunk_id, DWORD chunk_type, const riff_chunk_
  *            \- CHUNK:icon
  */
 static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
-    INT width, INT height, INT depth )
+                                             INT width, INT height, INT depth, UINT loadflags )
 {
     struct cursoricon_object *info;
     ani_header header = {0};
@@ -1003,7 +1007,7 @@ static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
         const BITMAPINFO *bmi;
 
         entry = CURSORICON_FindBestIconFile((const CURSORICONFILEDIR *) icon_data,
-            width, height, depth );
+                                            width, height, depth, loadflags );
 
         bmi = (const BITMAPINFO *) (icon_data + entry->dwDIBOffset);
         info->hotspot.x = entry->xHotspot;
@@ -1131,8 +1135,7 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
     /* Check for .ani. */
     if (memcmp( bits, "RIFF", 4 ) == 0)
     {
-        hIcon = CURSORICON_CreateIconFromANI( bits, filesize, width, height,
-            depth );
+        hIcon = CURSORICON_CreateIconFromANI( bits, filesize, width, height, depth, loadflags );
         goto end;
     }
 
@@ -1144,9 +1147,9 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
         goto end;
 
     if ( fCursor )
-        entry = CURSORICON_FindBestCursorFile( dir, width, height, depth );
+        entry = CURSORICON_FindBestCursorFile( dir, width, height, depth, loadflags );
     else
-        entry = CURSORICON_FindBestIconFile( dir, width, height, depth );
+        entry = CURSORICON_FindBestIconFile( dir, width, height, depth, loadflags );
 
     if ( !entry )
         goto end;
@@ -1207,9 +1210,9 @@ static HICON CURSORICON_Load(HINSTANCE hInstance, LPCWSTR name,
     if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
     if (!(dir = LockResource( handle ))) return 0;
     if (fCursor)
-        dirEntry = CURSORICON_FindBestCursorRes( dir, width, height, depth );
+        dirEntry = CURSORICON_FindBestCursorRes( dir, width, height, depth, loadflags );
     else
-        dirEntry = CURSORICON_FindBestIconRes( dir, width, height, depth );
+        dirEntry = CURSORICON_FindBestIconRes( dir, width, height, depth, loadflags );
     if (!dirEntry) return 0;
     wResId = dirEntry->wResId;
     FreeResource( handle );
@@ -1548,9 +1551,9 @@ INT WINAPI LookupIconIdFromDirectoryEx( LPBYTE xdir, BOOL bIcon,
         ReleaseDC(0, hdc);
 
         if( bIcon )
-            entry = CURSORICON_FindBestIconRes( dir, width, height, depth );
+            entry = CURSORICON_FindBestIconRes( dir, width, height, depth, LR_DEFAULTSIZE );
         else
-            entry = CURSORICON_FindBestCursorRes( dir, width, height, depth );
+            entry = CURSORICON_FindBestCursorRes( dir, width, height, depth, LR_DEFAULTSIZE );
 
         if( entry ) retVal = entry->wResId;
     }
@@ -1563,9 +1566,7 @@ INT WINAPI LookupIconIdFromDirectoryEx( LPBYTE xdir, BOOL bIcon,
  */
 INT WINAPI LookupIconIdFromDirectory( LPBYTE dir, BOOL bIcon )
 {
-    return LookupIconIdFromDirectoryEx( dir, bIcon,
-           bIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR),
-           bIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR), bIcon ? 0 : LR_MONOCHROME );
+    return LookupIconIdFromDirectoryEx( dir, bIcon, 0, 0, bIcon ? 0 : LR_MONOCHROME );
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list