Windows doesn't do a NULL check on the WINDOWINFO pointer.
Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- dlls/user32/tests/win.c | 2 +- dlls/user32/win.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 6b600cb1bc..784849b2ba 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -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()); }
diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 3582262b7d..11c3cc2362 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3845,9 +3845,12 @@ UINT WINAPI GetWindowModuleFileNameW( HWND hwnd, LPWSTR module, UINT size ) */ BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo( HWND hwnd, PWINDOWINFO pwi) { + RECT rcWindow, rcClient; + if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &rcWindow, &rcClient )) return FALSE; if (!pwi) return FALSE; - if (!WIN_GetRectangles( hwnd, COORDS_SCREEN, &pwi->rcWindow, &pwi->rcClient )) return FALSE;
+ CopyRect(&pwi->rcWindow, &rcWindow); + CopyRect(&pwi->rcClient, &rcClient); pwi->dwStyle = GetWindowLongW(hwnd, GWL_STYLE); pwi->dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE); pwi->dwWindowStatus = ((GetActiveWindow() == hwnd) ? WS_ACTIVECAPTION : 0);