Added sanity check to WINPROC_CallWndProc

Jukka Heinonen jhei at iki.fi
Sun Jul 15 03:20:14 CDT 2001


DeusEx causes Wine to crash (segmentation fault) because
it calls CallWindowProc and passes null in HWND parameter.
While I suspect that this is because some Wine function
that should return a valid HWND is returning a null pointer,
the crashing can be fixed simply by adding a sanity check to
WINPROC_CallWndProc.

After this patch, both DeusEx installer and DeusEx dialog for 
choosing rendering engine work. However, DeusEx still crashes
later because DeusEx for some reason generates a division by zero
FP exception. DeusEx handler for this exception calls __CxxFrameHandler
which is not implemented by Wine and thus exception handling ends into
infinite recursion. Luckily stack overflow makes Wine to crash :)

Changelog:
  WINPROC_CallWndProc now checks for null HWND.

Index: winproc.c
===================================================================
RCS file: /home/wine/wine/windows/winproc.c,v
retrieving revision 1.68
diff -u -r1.68 winproc.c
--- winproc.c   2001/06/20 23:16:34     1.68
+++ winproc.c   2001/07/15 08:02:11
@@ -162,6 +162,12 @@
     LRESULT retvalue;
     int iWndsLocks;
 
+    if(hwnd == 0) {
+      ERR_(win)( "(hwnd=%08x,msg=%s,wp=%08x,lp=%08lx) - HWND is null pointer!\n",
+                 hwnd, SPY_GetMsgName(msg), wParam, lParam );
+      return 0;
+    }
+
     if (TRACE_ON(relay))
         DPRINTF( "%08lx:Call window proc %p (hwnd=%08x,msg=%s,wp=%08x,lp=%08lx)\n",
                  GetCurrentThreadId(), proc, hwnd, SPY_GetMsgName(msg), wParam, lParam );

-- 
Jukka Heinonen <http://www.iki.fi/jhei/>




More information about the wine-patches mailing list