[3/6] USER: Check a file's magic, rather than relying on the fCursor parameter in CURSORICON_LoadFromFile

H. Verbeet hverbeet at gmail.com
Tue Apr 18 16:50:08 CDT 2006


Changelog:
  - Check a file's magic, rather than relying on the fCursor parameter
in CURSORICON_LoadFromFile
-------------- next part --------------
diff --git a/dlls/user/cursoricon.c b/dlls/user/cursoricon.c
index 5af21a2..64aa3cb 100644
--- a/dlls/user/cursoricon.c
+++ b/dlls/user/cursoricon.c
@@ -913,6 +913,12 @@ static HICON CURSORICON_LoadFromFile( LP
     if (!bits)
         return hIcon;
 
+    /* If the data contains the magic for an .ICO it's an .ICO,
+     * regardless of what fCursor says. */
+    if (!memcmp(bits, "\x00\x00\x01\x00", 4)) fCursor = FALSE;
+    /* Same thing for .CUR */
+    else if (!memcmp(bits, "\x00\x00\x02\x00", 4)) fCursor = TRUE;
+
     dir = (CURSORICONFILEDIR*) bits;
     if ( filesize < sizeof(*dir) )
         goto end;




More information about the wine-patches mailing list