KERNEL/tests: don't set NULL console

Saulius Krasuckas saulius2 at
Fri Oct 21 13:43:20 CDT 2005

It seems win9x puts NULL address into the chain of handlers without any 

I found no other way to detect win9x-ness other than GetVersion().  As 
this test doesn't crash when runned inside the MSVC debugger, so I suspect 
we could catch this case by using our own exception handler, but AJ told 
me tests exception handling will be hard to implement to compile in Wine.

Log message:
	Saulius Krasuckas <saulius.krasuckas at>
	Don't set NULL console signal handler on Win9x, as any signal 
	generates an unhandled exception then.

Index: dlls/kernel/tests/console.c
RCS file: /home/wine/wine/dlls/kernel/tests/console.c,v
retrieving revision 1.10
diff -p -u -r1.10 console.c
--- dlls/kernel/tests/console.c	28 Jan 2005 14:02:52 -0000	1.10
+++ dlls/kernel/tests/console.c	21 Oct 2005 13:36:43 -0000
@@ -537,10 +537,14 @@ static void testCtrlHandler(void)
     ok(WaitForSingleObject(mch_event, 3000) == WAIT_OBJECT_0, "event sending didn't work\n");
+    /* Turning off ctrl-c handling doesn't work on win9x such way ... */
     ok(SetConsoleCtrlHandler(NULL, TRUE), "Couldn't turn off ctrl-c handling\n");
     mch_event = CreateEventA(NULL, TRUE, FALSE, NULL);
     mch_count = 0;
-    ok(GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0), "Couldn't send ctrl-c event\n");
+    if(!(GetVersion() & 80000000))
+        /* ... and next line leads to an unhandled exception on 9x.  Avoid it on 9x. */
+        ok(GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0), "Couldn't send ctrl-c event\n");
     ok(WaitForSingleObject(mch_event, 3000) == WAIT_TIMEOUT && mch_count == 0, "Event shouldn't have been sent\n");
     ok(SetConsoleCtrlHandler(mch, FALSE), "Couldn't remove handler\n");

More information about the wine-patches mailing list