From dcbc830fec12f4de0dd759d0ca7e780173d82716 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 18 Feb 2016 10:22:29 +0800
Subject: user32: MessageBox should be topmost when MB_SYSTEMMODAL style is
 set.

---
 dlls/user32/msgbox.c       | 4 ++--
 dlls/user32/tests/dialog.c | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/msgbox.c b/dlls/user32/msgbox.c
index 2ba98c9..e5dc120 100644
--- a/dlls/user32/msgbox.c
+++ b/dlls/user32/msgbox.c
@@ -313,8 +313,8 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
     }
 
     /*handle modal message boxes*/
-    if (((lpmb->dwStyle & MB_TASKMODAL) && (lpmb->hwndOwner==NULL)) || (lpmb->dwStyle & MB_SYSTEMMODAL))
-        SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+    if (lpmb->dwStyle & MB_SYSTEMMODAL)
+        SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
 
     HeapFree( GetProcessHeap(), 0, buffer );
 }
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index e80b581..24a549f 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1551,7 +1551,6 @@ static void test_MessageBox(void)
 
         hwnd = wait_for_window(params.caption);
         ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-        todo_wine_if(test[i].ex_style == WS_EX_TOPMOST)
         ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
 
         PostMessageA(hwnd, WM_COMMAND, IDCANCEL, 0);
@@ -1573,7 +1572,6 @@ static void test_MessageBox(void)
 
         hwnd = wait_for_window(params.caption);
         ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
-        todo_wine_if(test[i].ex_style == WS_EX_TOPMOST)
         ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
 
         PostMessageA(hwnd, WM_COMMAND, IDCANCEL, 0);
-- 
2.7.1

