Damjan Jovanovic : user32: Handle NULL rectangles in WM_NCCALCSIZE.

Alexandre Julliard julliard at winehq.org
Tue Nov 18 09:27:19 CST 2008


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

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Sat Nov 15 18:15:04 2008 +0200

user32: Handle NULL rectangles in WM_NCCALCSIZE.

---

 dlls/user32/nonclient.c |    3 +++
 dlls/user32/tests/win.c |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index 3fa870e..708ed80 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -417,6 +417,9 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, RECT *winRect )
     LONG style = GetWindowLongW( hwnd, GWL_STYLE );
     LONG exStyle = GetWindowLongW( hwnd, GWL_EXSTYLE );
 
+    if (winRect == NULL)
+        return 0;
+
     if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW;
     if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW;
 
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 827d0e3..f0e143a 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -781,6 +781,7 @@ static void test_nonclient_area(HWND hwnd)
     RECT rc_window, rc_client, rc;
     BOOL menu;
     BOOL is_win9x = GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == 0;
+    LRESULT ret;
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
     exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
@@ -809,6 +810,10 @@ static void test_nonclient_area(HWND hwnd)
     trace("calc client: (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
     ok(EqualRect(&rc, &rc_client), "client rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d\n", style, exstyle, menu);
 
+    /* NULL rectangle shouldn't crash */
+    ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, 0);
+    ok(ret == 0, "NULL rectangle returned %ld instead of 0\n", ret);
+
     /* Win9x doesn't like WM_NCCALCSIZE with synthetic data and crashes */;
     if (is_win9x)
 	return;




More information about the wine-cvs mailing list