PATCH: Fix LoadCursor() under win9x

Johan Gill johane at lysator.liu.se
Fri Oct 12 08:16:04 CDT 2001


LoadCursor() should return 0 if we emulate win9x and the second parameter
is an invalid pointer.

Index: wine/windows/cursoricon.c
===================================================================
RCS file: /home/wine/wine/windows/cursoricon.c,v
retrieving revision 1.35
diff -u -r1.35 cursoricon.c
--- wine/windows/cursoricon.c   2001/10/05 19:38:14     1.35
+++ wine/windows/cursoricon.c   2001/10/12 11:54:49
@@ -1730,9 +1730,16 @@

 /***********************************************************************
  *             LoadCursorA (USER32.@)
+ *
+ * If the name parameter is a bad pointer, the win9x version of
+ * LoadCursor() returns 0. NT crashes instead.
  */
 HCURSOR WINAPI LoadCursorA(HINSTANCE hInstance, LPCSTR name)
 {
+    if (HIWORD(name))
+       if (GetVersion() & 0x80000000)  /* win9x */
+           if (IsBadReadPtr(name, 4))
+               return 0;
     return LoadImageA( hInstance, name, IMAGE_CURSOR, 0, 0,
                        LR_SHARED | LR_DEFAULTSIZE );
 }

/Johan Gill, johane at lysator.liu.se






More information about the wine-patches mailing list