Skip to content
Snippets Groups Projects
Commit c37d3e5d authored by rswindell's avatar rswindell
Browse files

Install a console control handler that always returns TRUE, this will stop a

windows close event from immediatley terminating the process (without warning).
parent d28ed5c9
No related branches found
No related tags found
No related merge requests found
......@@ -517,6 +517,11 @@ void win32_resume(void)
SetConsoleMode(h, conmode);
}
static BOOL WINAPI ControlHandler(DWORD CtrlType)
{
return TRUE;
}
int win32_initciolib(long inmode)
{
DWORD conmode;
......@@ -530,7 +535,7 @@ int win32_initciolib(long inmode)
return(0);
}
SetConsoleCtrlHandler(NULL,TRUE);
SetConsoleCtrlHandler(ControlHandler,TRUE);
if((h=GetStdHandle(STD_INPUT_HANDLE))==INVALID_HANDLE_VALUE
|| !GetConsoleMode(h, &orig_in_conmode))
return(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment