[PATCH] winedbg: Check for visible Window Station before displaying crash dialog

André Hentschel nerv at dawncrow.de
Fri Jul 13 12:49:40 CDT 2018


Signed-off-by: André Hentschel <nerv at dawncrow.de>

For https://bugs.winehq.org/show_bug.cgi?id=35928

---
 programs/winedbg/crashdlg.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/programs/winedbg/crashdlg.c b/programs/winedbg/crashdlg.c
index a925378..cda2642 100644
--- a/programs/winedbg/crashdlg.c
+++ b/programs/winedbg/crashdlg.c
@@ -48,6 +48,20 @@ int msgbox_res_id(HWND hwnd, UINT textid, UINT captionid, UINT type)
     return IDCANCEL;
 }
 
+static BOOL is_visible(void)
+{
+    USEROBJECTFLAGS flags;
+    HWINSTA winstation;
+
+    if (!(winstation = GetProcessWindowStation()))
+        return FALSE;
+
+    if (!(GetUserObjectInformationA(winstation, UOI_FLAGS, &flags, sizeof(flags), NULL)))
+        return FALSE;
+
+    return flags.dwFlags & WSF_VISIBLE;
+}
+
 static WCHAR *get_program_name(HANDLE hProcess)
 {
     WCHAR image_name[MAX_PATH];
@@ -362,7 +376,7 @@ int display_crash_dialog(void)
     /* dbg_curr_process->handle is not set */
     HANDLE hProcess;
 
-    if (!DBG_IVAR(ShowCrashDialog))
+    if (!DBG_IVAR(ShowCrashDialog) || !is_visible())
         return TRUE;
 
     hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dbg_curr_pid);
-- 
2.7.4




More information about the wine-devel mailing list