Crash in latest version

Gerard Patel gerard.patel at
Tue Aug 28 19:11:29 CDT 2001

At 10:34 PM 28/08/2001 +0200, you wrote:

>Notice the change in the hwnd

Windows handles are now generated on the server.

This is a historical moment, btw :-)
Now Wine has all the architectural features of Win 95

Not everything is implemented, FindWindow does
not yet work across processes for example.
But it's an important step nonetheless.

Alexandre Julliard has implemented the 'generation' feature
of handles. The higher part of a 32 bit handle is used for
a counter that is incremented from a window creation to
another, avoiding the age-old problem of windows being
deleted, then braindead application trying to use their
handles, using newly created windows instead.

What this means is that any use of 16 bit code with
window handles in Wine will break as the handles
will be truncated. I already see many new crashes...

The dialog code uses a 16 bit only Api (FillWindow)

The following (and simplistic) patch should make your app
crash a bit later.


--- defdlg.c.orig       Tue Aug 21 15:09:31 2001
+++ defdlg.c    Wed Aug 29 00:07:28 2001
@@ -135,10 +135,18 @@
 static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
                             LPARAM lParam, DIALOGINFO *dlgInfo )
+    HBRUSH hbrush;
         case WM_ERASEBKGND:
-           FillWindow16( hwnd, hwnd, (HDC16)wParam, (HBRUSH16)CTLCOLOR_DLG );
+            hbrush = SendMessageA( hwnd, WM_CTLCOLORDLG,
+                                 wParam, (LPARAM)hwnd );
+            if (hbrush )
+            {
+                 RECT r;
+                 GetClientRect(hwnd, &r);
+                 FillRect( (HDC) wParam, &r, hbrush );
+            }
            return 1;
        case WM_NCDESTROY:

More information about the wine-devel mailing list