This change has been in Proton to fix a bug in the DayZ launcher.
The launcher is a .NET application that, best I can tell, contains marshaling code that calls SetWindowPlacement incorrectly. This results in undefined memory being passed in and broken values returned by GetWindowPlacement. I think the value passed in must be broken on Windows, but as the tests show, Windows rejects SetWindowPlacement calls that don't have length set correctly (but not GetWindowPlacement, as zeroing the structure to give it an invalid length in `other_process_proc` shows).
From: Esme Povirk esme@codeweavers.com
--- dlls/user32/tests/win.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index b86a9b05e61..0d04c26f6a8 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12498,6 +12498,17 @@ static void test_window_placement(void) GetWindowRect(hwnd, &rect); ok(EqualRect(&rect, &orig), "got window rect %s\n", wine_dbgstr_rect(&rect));
+ ret = SetWindowPlacement(hwnd, &wp); + ok(ret, "failed to set window placement, error %u\n", GetLastError()); + + wp.length = 0; + SetLastError(0xdeadbeef); + ret = SetWindowPlacement(hwnd, &wp); +todo_wine { + ok(!ret, "SetWindowPlacement should have failed\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError()); +} + DestroyWindow(hwnd); }
@@ -12657,7 +12668,7 @@ static void test_arrange_iconic_windows(void) static void other_process_proc(HWND hwnd) { HANDLE window_ready_event, test_done_event; - WINDOWPLACEMENT wp; + WINDOWPLACEMENT wp = {0}; DWORD ret;
window_ready_event = OpenEventA(EVENT_ALL_ACCESS, FALSE, "test_opw_window");
From: Esme Povirk esme@codeweavers.com
--- dlls/user32/tests/win.c | 2 -- dlls/win32u/window.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 0d04c26f6a8..93211744327 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12504,10 +12504,8 @@ static void test_window_placement(void) wp.length = 0; SetLastError(0xdeadbeef); ret = SetWindowPlacement(hwnd, &wp); -todo_wine { ok(!ret, "SetWindowPlacement should have failed\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError()); -}
DestroyWindow(hwnd); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index d7263875b17..5b87dcdf465 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2567,6 +2567,11 @@ BOOL WINAPI NtUserSetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *wpl ) { UINT flags = PLACE_MAX | PLACE_RECT; if (!wpl) return FALSE; + if (wpl->length != sizeof(*wpl)) + { + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); + return FALSE; + } if (wpl->flags & WPF_SETMINPOSITION) flags |= PLACE_MIN; return set_window_placement( hwnd, wpl, flags ); }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125061
Your paranoid android.
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24758. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24758. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24758.
Looks like there are some format warnings in the build which will have to be fixed before review.