This fixes SetWindowLongPtr on WoW64. On 32-bit, we have
``` #define SetWindowLongPtrA SetWindowLongA #define SetWindowLongPtrW SetWindowLongW ```
meaning that on WoW64, all pointers passed would be padded with `0xffffffff` (because they are treated as LONG), and this is the cause of many of the failing WoW64 tests. This fixes that behavior. I'm not sure if this is the right place to fix it though.
-- v6: wow64win: Always use NtUserSetWindowLongPtr() for GWLP_HINSTANCE and GWLP_WNDPROC.
From: Sven Baars sbaars@codeweavers.com
--- dlls/user32/tests/win.c | 9 +++++++++ dlls/wow64win/user.c | 7 +++++++ 2 files changed, 16 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 31d14480861..a3216da9f46 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -7293,6 +7293,15 @@ static void test_SetWindowLong(void) "SetWindowLongPtr on invalid window proc shouldn't have changed the value returned by GetWindowLongPtr, instead of changing it to 0x%Ix\n", retval); ok(IsWindowUnicode(hwndMain), "hwndMain should now be Unicode\n");
+ /* Make sure nothing changes if we set the same proc */ + retval = SetWindowLongPtrW(hwndMain, GWLP_WNDPROC, (LONG_PTR)old_window_procW); + todo_wine + ok((WNDPROC)retval == main_window_procA, "unexpected proc 0x%Ix\n", retval); + retval = GetWindowLongPtrW(hwndMain, GWLP_WNDPROC); + ok((WNDPROC)retval == old_window_procW, "unexpected proc 0x%Ix\n", retval); + retval = GetWindowLongPtrA(hwndMain, GWLP_WNDPROC); + ok((WNDPROC)retval == main_window_procA, "unexpected proc 0x%Ix\n", retval); + /* set it back to ANSI */ SetWindowLongPtrA(hwndMain, GWLP_WNDPROC, 0); } diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 8065a05f44a..602ccfa79b9 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3832,6 +3832,13 @@ NTSTATUS WINAPI wow64_NtUserSetWindowLong( UINT *args ) LONG newval = get_ulong( &args ); BOOL ansi = get_ulong( &args );
+ switch (offset) + { + case GWLP_HINSTANCE: + case GWLP_WNDPROC: + return NtUserSetWindowLongPtr( hwnd, offset, (ULONG)newval, ansi ); + } + return NtUserSetWindowLong( hwnd, offset, newval, ansi ); }
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=134827
Your paranoid android.
=== w1064_2qxl (64 bit report) ===
user32: win.c:4580: Test failed: hwnd 00000000000301B2/00000000000301B2 message 0200 win.c:4584: Test failed: hwnd 00000000000301B2/00000000000301B2 message 0201 win.c:4593: Test failed: hwnd 0000000000210284/0000000000210284 message 0202 win.c:4596: Test failed: hwnd 0000000000210284/0000000000210284 message 0201
=== w10pro64 (64 bit report) ===
user32: win.c:3817: Test failed: GetForegroundWindow returned 000000000002029E win.c:3749: Test failed: SetForegroundWindow failed, error 0 win.c:3752: Test failed: GetForegroundWindow returned 000000000002029E win.c:3789: Test failed: GetForegroundWindow returned 000000000002029E win.c:3874: Test failed: GetActiveWindow() = 000000000005004E win.c:3878: Test failed: GetFocus() = 0000000000000000 win.c:3881: Test failed: GetFocus() = 0000000000000000
This merge request was approved by Jacek Caban.