ctrl_event_handler

This commit is contained in:
Viktor Szakats 2026-06-16 13:45:03 +02:00
parent aa7634ae01
commit 68d35b45c6
No known key found for this signature in database

View file

@ -441,7 +441,15 @@ static void exit_signal_handler(int signum)
static BOOL WINAPI ctrl_event_handler(DWORD dwCtrlType)
{
int signum = 0;
#ifdef DEBUG_WIN32_CALLBACKS
logmsg("ctrl_event_handler: %lu", dwCtrlType);
#else
static const char msgbegin[] = "ctrl_event_handler: begin\n";
static const char msgend[] = "ctrl_event_handler: end\n";
HANDLE out = GetStdHandle(STD_ERROR_HANDLE);
DWORD dwWritten;
WriteFile(out, msgbegin, sizeof(msgbegin) - 1, &dwWritten, NULL);
#endif
switch(dwCtrlType) {
#ifdef SIGINT
case CTRL_C_EVENT:
@ -462,7 +470,11 @@ static BOOL WINAPI ctrl_event_handler(DWORD dwCtrlType)
return FALSE;
}
if(signum) {
#ifdef DEBUG_WIN32_CALLBACKS
logmsg("ctrl_event_handler: %lu -> %d", dwCtrlType, signum);
#else
WriteFile(out, msgend, sizeof(msgend) - 1, &dwWritten, NULL);
#endif
raise(signum);
}
return TRUE;