mirror of
https://github.com/reactos/wine.git
synced 2025-02-20 21:03:39 +00:00
user32: Add an invalid window check to SetFocus.
This commit is contained in:
parent
94ffc49e02
commit
d09e973f7d
@ -259,6 +259,11 @@ HWND WINAPI SetFocus( HWND hwnd )
|
||||
{
|
||||
/* Check if we can set the focus to this window */
|
||||
hwnd = WIN_GetFullHandle( hwnd );
|
||||
if (!IsWindow( hwnd ))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
|
||||
return 0;
|
||||
}
|
||||
if (hwnd == previous) return previous; /* nothing to do */
|
||||
for (;;)
|
||||
{
|
||||
|
@ -13573,10 +13573,9 @@ static void test_SetFocus(void)
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
old_focus = SetFocus((HWND)0xdeadbeef);
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg);
|
||||
ok_sequence(WmEmptySeq, "SetFocus on an invalid window", TRUE);
|
||||
ok_sequence(WmEmptySeq, "SetFocus on an invalid window", FALSE);
|
||||
ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
|
||||
ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
|
||||
ok(GetFocus() == parent, "expected focus %p, got %p\n", parent, GetFocus());
|
||||
|
Loading…
x
Reference in New Issue
Block a user