user32: Fix behavior of GetWindowInfo(0, NULL).

Windows doesn't do a NULL check on the WINDOWINFO pointer.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Brendan Shanks 2019-09-23 10:41:07 -07:00 committed by Alexandre Julliard
parent 38dd9faf96
commit c8dbb0c4c1
2 changed files with 7 additions and 3 deletions

View File

@ -1007,7 +1007,7 @@ static void test_window_info(const char *hook, HWND hwnd)
if (0) { /* crashes on XP, 2003 */
SetLastError(0xdeadbeef);
ok(!pGetWindowInfo(0, NULL), "GetWindowInfo should fail\n");
todo_wine ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE,
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE,
"got error %d expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
}

View File

@ -3845,9 +3845,13 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size )
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo( HWND hwnd, PWINDOWINFO pwi)
{
if (!pwi) return FALSE;
if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &pwi->rcWindow, &pwi->rcClient )) return FALSE;
RECT rcWindow, rcClient;
if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &rcWindow, &rcClient )) return FALSE;
if (!pwi) return FALSE;
pwi->rcWindow = rcWindow;
pwi->rcClient = rcClient;
pwi->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
pwi->dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
pwi->dwWindowStatus = ((GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0);