[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 2/2] conhost: Ignore CONTROL_C_EXIT exceptions in Unix mode.
From:       Jacek Caban <jacek () codeweavers ! com>
Date:       2020-12-29 22:05:45
Message-ID: 1323b895-018e-7d71-d08b-38892d8d7983 () codeweavers ! com
[Download RAW message or body]

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50304
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
---
  programs/conhost/conhost.c | 10 ++++++++++
  1 file changed, 10 insertions(+)



["0002-conhost-Ignore-CONTROL_C_EXIT-exceptions-in-Unix-mode.txt" (text/x-patch)]

diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c
index 4b156f21ea3..3e41577a44b 100644
--- a/programs/conhost/conhost.c
+++ b/programs/conhost/conhost.c
@@ -2674,6 +2674,14 @@ static int main_loop( struct console *console, HANDLE signal )
     return 0;
 }
 
+static LONG WINAPI handle_ctrl_c( EXCEPTION_POINTERS *eptr )
+{
+    if (eptr->ExceptionRecord->ExceptionCode != CONTROL_C_EXIT) return EXCEPTION_CONTINUE_SEARCH;
+    /* In Unix mode, ignore ctrl c exceptions. Signals are sent it to clients as well and we will
+     * terminate the usual way if they don't handle it. */
+    return EXCEPTION_CONTINUE_EXECUTION;
+}
+
 int __cdecl wmain(int argc, WCHAR *argv[])
 {
     int headless = 0, i, width = 0, height = 0;
@@ -2763,5 +2771,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
         ShowWindow( console.win, (si.dwFlags & STARTF_USESHOWWINDOW) ? si.wShowWindow : SW_SHOW );
     }
 
+    if (console.is_unix) RtlAddVectoredExceptionHandler( FALSE, handle_ctrl_c );
+
     return main_loop( &console, signal );
 }



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic