From: Stefan Dösinger <stefan@codeweavers.com> Something restores it at least once on Win26H1. I don't think it is the ddraw restore timer because WS_EX_TOPMOST is restored too. --- dlls/ddraw/tests/ddraw1.c | 18 ++++++++++++++---- dlls/ddraw/tests/ddraw2.c | 18 ++++++++++++++---- dlls/ddraw/tests/ddraw4.c | 18 ++++++++++++++---- dlls/ddraw/tests/ddraw7.c | 18 ++++++++++++++---- 4 files changed, 56 insertions(+), 16 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index dc5a09b671e..2e2f7e62483 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2664,6 +2664,7 @@ static void test_window_style(void) RECT fullscreen_rect, r; HWND window, window2; IDirectDraw *ddraw; + unsigned int i; HRESULT hr; ULONG ref; BOOL ret; @@ -2874,10 +2875,19 @@ static void test_window_style(void) ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); - ret = ShowWindow(window, SW_HIDE); - ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); - ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + for (i = 0; i < 5; ++i) + { + /* Try a few times to hide the window. Something in Win11 26H1 shows it again and makes it + * topmost. This is in addition to the ddraw periodic check below, which only makes it + * topmost but not visible */ + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + if (!(tmp & WS_VISIBLE)) + break; + Sleep(100); + } + ok(i < 5, "Failed to hide the window.\n"); tmp = GetWindowLongA(window, GWL_STYLE); ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 77db18c2795..114b297d239 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2745,6 +2745,7 @@ static void test_window_style(void) RECT fullscreen_rect, r; HWND window, window2; IDirectDraw2 *ddraw; + unsigned int i; HRESULT hr; ULONG ref; BOOL ret; @@ -2955,10 +2956,19 @@ static void test_window_style(void) ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); - ret = ShowWindow(window, SW_HIDE); - ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); - ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + for (i = 0; i < 5; ++i) + { + /* Try a few times to hide the window. Something in Win11 26H1 shows it again and makes it + * topmost. This is in addition to the ddraw periodic check below, which only makes it + * topmost but not visible */ + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + if (!(tmp & WS_VISIBLE)) + break; + Sleep(100); + } + ok(i < 5, "Failed to hide the window.\n"); tmp = GetWindowLongA(window, GWL_STYLE); ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 3eb55fc6342..285b36f54c6 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2985,6 +2985,7 @@ static void test_window_style(void) RECT fullscreen_rect, r; HWND window, window2; IDirectDraw4 *ddraw; + unsigned int i; HRESULT hr; ULONG ref; BOOL ret; @@ -3195,10 +3196,19 @@ static void test_window_style(void) ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); - ret = ShowWindow(window, SW_HIDE); - ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); - ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + for (i = 0; i < 5; ++i) + { + /* Try a few times to hide the window. Something in Win11 26H1 shows it again and makes it + * topmost. This is in addition to the ddraw periodic check below, which only makes it + * topmost but not visible */ + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + if (!(tmp & WS_VISIBLE)) + break; + Sleep(100); + } + ok(i < 5, "Failed to hide the window.\n"); tmp = GetWindowLongA(window, GWL_STYLE); ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 46bb0b8d922..e8487283ead 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2747,6 +2747,7 @@ static void test_window_style(void) RECT fullscreen_rect, r; HWND window, window2; IDirectDraw7 *ddraw; + unsigned int i; HRESULT hr; ULONG ref; BOOL ret; @@ -2957,10 +2958,19 @@ static void test_window_style(void) ok(tmp & WS_VISIBLE, "Expected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp & WS_EX_TOPMOST, "Expected WS_EX_TOPMOST.\n"); - ret = ShowWindow(window, SW_HIDE); - ok(ret, "ShowWindow failed, error %#lx.\n", GetLastError()); - ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + for (i = 0; i < 5; ++i) + { + /* Try a few times to hide the window. Something in Win11 26H1 shows it again and makes it + * topmost. This is in addition to the ddraw periodic check below, which only makes it + * topmost but not visible */ + ret = SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW); + ok(ret, "SetWindowPos failed, error %#lx.\n", GetLastError()); + tmp = GetWindowLongA(window, GWL_STYLE); + if (!(tmp & WS_VISIBLE)) + break; + Sleep(100); + } + ok(i < 5, "Failed to hide the window.\n"); tmp = GetWindowLongA(window, GWL_STYLE); ok(!(tmp & WS_VISIBLE), "Got unexpected WS_VISIBLE.\n"); tmp = GetWindowLongA(window, GWL_EXSTYLE); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10477