[PATCH 2/2] user32: Prevent resetting WS_MINIMIZE through SetWindowLong.

Józef Kucia jkucia at codeweavers.com
Wed Aug 17 06:56:09 CDT 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---

Fixes https://bugs.winehq.org/show_bug.cgi?id=41109

---
 dlls/user32/tests/win.c | 9 ++-------
 dlls/user32/win.c       | 2 ++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index f7ed6d5..2ba5f76 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -6281,7 +6281,6 @@ static LRESULT WINAPI check_style_wnd_proc(HWND hwnd, UINT message, WPARAM wPara
     {
         ok(got->styleOld == expected[1].styleOld, "expected old style %#x, got %#x\n",
             expected[1].styleOld, got->styleOld);
-        todo_wine_if(expected[0].styleOld & WS_MINIMIZE)
         ok(got->styleNew == expected[1].styleNew, "expected new style %#x, got %#x\n",
             expected[1].styleNew, got->styleNew);
     }
@@ -6330,13 +6329,9 @@ static void test_set_window_style(void)
 
     for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
     {
-        BOOL todo = FALSE;
         expected_style = tests[i].style;
-        if ((tests[i].creation_style & WS_MINIMIZE) && !(tests[i].style & WS_MINIMIZE))
-        {
-            todo = TRUE;
+        if (tests[i].creation_style & WS_MINIMIZE)
             expected_style |= WS_MINIMIZE;
-        }
 
         expected_stylestruct[0].styleOld = tests[i].creation_style;
         expected_stylestruct[0].styleNew = tests[i].style;
@@ -6352,7 +6347,7 @@ static void test_set_window_style(void)
         ok(old_style == tests[i].creation_style, "expected old style %#x, got %#x\n",
             tests[i].creation_style, old_style);
         new_style = GetWindowLongA(hwnd, GWL_STYLE);
-        todo_wine_if(todo) ok(new_style == expected_style, "expected new style %#x, got %#x\n",
+        ok(new_style == expected_style, "expected new style %#x, got %#x\n",
             expected_style, new_style);
 
         SetWindowLongPtrA(hwnd, GWLP_USERDATA, 0);
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index f69297c..8ece6a1 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2367,6 +2367,8 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B
         newval = style.styleNew;
         /* WS_CLIPSIBLINGS can't be reset on top-level windows */
         if (wndPtr->parent == GetDesktopWindow()) newval |= WS_CLIPSIBLINGS;
+        /* WS_MINIMIZE can't be reset */
+        if (wndPtr->dwStyle & WS_MINIMIZE) newval |= WS_MINIMIZE;
         /* FIXME: changing WS_DLGFRAME | WS_THICKFRAME is supposed to change
            WS_EX_WINDOWEDGE too */
         break;
-- 
2.7.3




More information about the wine-patches mailing list