user32: UpdateWindow doesn't accept a NULL hwnd.

This commit is contained in:
Louis Lenders 2010-09-28 18:56:40 +02:00 committed by Alexandre Julliard
parent 1f93a47667
commit 6e4e8fb07f
2 changed files with 16 additions and 0 deletions

View File

@ -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 );
}

View File

@ -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 );