Alexandre Julliard : winetest: Disable the crash dialog in non-interactive mode.
Alexandre Julliard
julliard at winehq.org
Tue Aug 16 15:59:47 CDT 2022
Module: wine
Branch: master
Commit: 3deabed43d73695d0829a7b7fd4cec8c516f84a3
URL: https://gitlab.winehq.org/wine/wine/-/commit/3deabed43d73695d0829a7b7fd4cec8c516f84a3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Aug 16 17:41:31 2022 +0200
winetest: Disable the crash dialog in non-interactive mode.
---
programs/winetest/main.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index 13a5c5ab294..7caa20d862a 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -362,6 +362,34 @@ static BOOL is_stub_dll(const char *filename)
return isstub;
}
+static int disable_crash_dialog(void)
+{
+ HKEY key;
+ DWORD type, data, size;
+ int ret = 0;
+
+ if (RegCreateKeyA( HKEY_CURRENT_USER, "Software\\Wine\\WineDbg", &key )) return 0;
+ size = sizeof(data);
+ if (RegQueryValueExA( key, "ShowCrashDialog", NULL, &type, (BYTE *)&data, &size )) ret = 1;
+ else if (type != REG_DWORD || data) ret = 2;
+ data = 0;
+ RegSetValueExA( key, "ShowCrashDialog", 0, REG_DWORD, (BYTE *)&data, sizeof(data) );
+ RegCloseKey( key );
+ return ret;
+}
+
+static void restore_crash_dialog( int prev )
+{
+ HKEY key;
+ DWORD data = 1;
+
+ if (!prev) return;
+ if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\WineDbg", &key )) return;
+ if (prev == 1) RegDeleteKeyValueA( key, NULL, "ShowCrashDialog" );
+ else RegSetValueExA( key, "ShowCrashDialog", 0, REG_DWORD, (BYTE *)&data, sizeof(data) );
+ RegCloseKey( key );
+}
+
static void print_version (void)
{
#ifdef __i386__
@@ -1286,6 +1314,7 @@ int __cdecl main( int argc, char *argv[] )
int reset_env = 1;
int poweroff = 0;
int interactive = 1;
+ int prev_crash_dialog = 0;
int i;
InitCommonControls();
@@ -1430,6 +1459,8 @@ int __cdecl main( int argc, char *argv[] )
if (!check_display_driver())
report (R_FATAL, "Unable to create a window, the display driver is not working.");
+
+ if (!interactive) prev_crash_dialog = disable_crash_dialog();
}
SetConsoleCtrlHandler(ctrl_handler, TRUE);
@@ -1485,6 +1516,7 @@ int __cdecl main( int argc, char *argv[] )
report (R_WARNING, "Can't remove logfile: %u", GetLastError());
} else run_tests (logname, outdir);
report (R_STATUS, "Finished - %u failures", failures);
+ if (prev_crash_dialog) restore_crash_dialog( prev_crash_dialog );
}
if (poweroff)
{
More information about the wine-cvs
mailing list