From 61f2cc45c275ce493ec7f53e6f22fb8cda89db31 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Sun, 6 Nov 2011 15:17:18 +0100 Subject: [PATCH] Command-line signal handling for Windows --- src/porting.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/porting.cpp b/src/porting.cpp index f349c0ce..f3a0ab07 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -75,10 +75,45 @@ void signal_handler_init(void) } #else // _WIN32 + #include + #include + + BOOL WINAPI event_handler(DWORD sig) + { + switch(sig) + { + case CTRL_C_EVENT: + case CTRL_CLOSE_EVENT: + case CTRL_LOGOFF_EVENT: + case CTRL_SHUTDOWN_EVENT: + + if(g_killed == false) + { + dstream<