Louis Lenders : user32: UpdateWindow doesn't accept a NULL hwnd.

Alexandre Julliard julliard at winehq.org
Wed Sep 29 12:00:16 CDT 2010


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

Author: Louis Lenders <xerox_xerox2000 at yahoo.co.uk>
Date:   Tue Sep 28 18:56:40 2010 +0200

user32: UpdateWindow doesn't accept a NULL hwnd.

---

 dlls/user32/painting.c  |    6 ++++++
 dlls/user32/tests/msg.c |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 9f02a03..e7ce2ec 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -1202,6 +1202,12 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
  */
 BOOL WINAPI UpdateWindow( HWND hwnd )
 {
+    if (!hwnd)
+    {
+        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
+        return FALSE;
+    }
+
     return RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN );
 }
 
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 6717e2e..76d46d0 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -6161,6 +6161,16 @@ static void test_paint_messages(void)
     flush_events();
     ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
 
+    trace("testing UpdateWindow(NULL)\n");
+    SetLastError(0xdeadbeef);
+    ok(!UpdateWindow(NULL), "UpdateWindow(NULL) should fail\n");
+    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE ||
+       broken( GetLastError() == 0xdeadbeef ) /* win9x */,
+       "wrong error code %d\n", GetLastError());
+    check_update_rgn( hwnd, 0 );
+    flush_events();
+    ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
+
     /* now with frame */
     SetRectRgn( hrgn, -5, -5, 20, 20 );
 




More information about the wine-cvs mailing list