summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2016-05-09 21:50:56 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2016-05-09 21:50:56 +0200
commita050be5b6a689ce85fb7c21c66e024fe9733a289 (patch)
treed96ae71c544e233162f0a0c3aeb5f01da7d4a541
parent12bd6e893c91430fdbdf8a27087d4a792b04eef9 (diff)
parent5ef167c1399499cf12d5800855cbe80f5b2439b6 (diff)
Merge branch 'dbus-1.10'
-rw-r--r--test/test-segfault.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test-segfault.c b/test/test-segfault.c
index c062ce1c..7e2e82a1 100644
--- a/test/test-segfault.c
+++ b/test/test-segfault.c
@@ -13,11 +13,36 @@
#include <sys/prctl.h>
#endif
+#ifdef DBUS_WIN
+#include <windows.h>
+
+int
+exception_handler(LPEXCEPTION_POINTERS p);
+
+/* Explicit Windows exception handlers needed to supress OS popups */
+int
+exception_handler(LPEXCEPTION_POINTERS p)
+{
+ fprintf(stderr, "test-segfault: raised fatal exception as intended\n");
+ ExitProcess(0xc0000005);
+}
+#endif
+
int
main (int argc, char **argv)
{
char *p;
+#ifdef DBUS_WIN
+ /* Disable Windows popup dialog when an app crashes so that app quits
+ * immediately with error code instead of waiting for user to dismiss
+ * the dialog. */
+ DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
+ SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX);
+ /* Disable "just in time" debugger */
+ SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)&exception_handler);
+#endif
+
#if HAVE_SETRLIMIT
/* No core dumps please, we know we crashed. */
struct rlimit r = { 0, };