Alexandre Julliard : user32: Don' t allow changing the WS_EX_TOPMOST style with SetWindowLong.

Alexandre Julliard julliard at winehq.org
Thu Nov 1 07:39:40 CDT 2007


Module: wine
Branch: master
Commit: ebc686495362525784ab26be67ae412379556439
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ebc686495362525784ab26be67ae412379556439

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 31 17:53:58 2007 +0100

user32: Don't allow changing the WS_EX_TOPMOST style with SetWindowLong.

---

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

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 548f13c..49fe766 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -993,12 +993,9 @@ static void test_shell_window(void)
     /* passes on Win XP, but not on Win98
     ok(!ret, "third call to SetShellWindow(hwnd1)\n"); */
 
-    todo_wine
-    {
-        SetWindowLong(hwnd1, GWL_EXSTYLE, GetWindowLong(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
-        ret = GetWindowLong(hwnd1,GWL_EXSTYLE)&WS_EX_TOPMOST? TRUE: FALSE;
-        ok(!ret, "SetWindowExStyle(hwnd1, WS_EX_TOPMOST)\n");
-    }
+    SetWindowLong(hwnd1, GWL_EXSTYLE, GetWindowLong(hwnd1,GWL_EXSTYLE)|WS_EX_TOPMOST);
+    ret = GetWindowLong(hwnd1,GWL_EXSTYLE)&WS_EX_TOPMOST? TRUE: FALSE;
+    ok(!ret, "SetWindowExStyle(hwnd1, WS_EX_TOPMOST)\n");
 
     ret = DestroyWindow(hwnd1);
     ok(ret, "DestroyWindow(hwnd1)\n");
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 3c077c9..c70b0ca 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1945,6 +1945,8 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B
             break;
         case GWL_EXSTYLE:
             req->flags = SET_WIN_EXSTYLE;
+            /* WS_EX_TOPMOST can only be changed through SetWindowPos */
+            newval = (newval & ~WS_EX_TOPMOST) | (wndPtr->dwExStyle & WS_EX_TOPMOST);
             req->ex_style = newval;
             break;
         case GWLP_ID:




More information about the wine-cvs mailing list