Ctrl-C handler on Windows.

This commit is contained in:
Jeroen van Rijn
2022-05-08 10:39:03 +02:00
parent 6b89ff43ea
commit 85e6efdf16
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -758,3 +758,18 @@ foreign kernel32 {
UnmapFlags: ULONG,
) -> BOOL ---
}
@(default_calling_convention = "std")
foreign kernel32 {
@(link_name="SetConsoleCtrlHandler") set_console_ctrl_handler :: proc(handler: Handler_Routine, add: BOOL) -> BOOL ---
}
Handler_Routine :: proc(dwCtrlType: Control_Event) -> BOOL
Control_Event :: enum DWORD {
control_c = 0,
_break = 1,
close = 2,
logoff = 5,
shutdown = 6,
}