diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-08 10:39:03 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-08 10:39:03 +0200 |
| commit | 85e6efdf16ad075f92a61ce59afa50634ccadeee (patch) | |
| tree | 5f9da20641ebb1a8774e880d2dd88394fd5c8d4f | |
| parent | 6b89ff43eaa621aa4bdb859e367b6d85ea96676e (diff) | |
Ctrl-C handler on Windows.
| -rw-r--r-- | core/sys/win32/kernel32.odin | 2 | ||||
| -rw-r--r-- | core/sys/windows/kernel32.odin | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/core/sys/win32/kernel32.odin b/core/sys/win32/kernel32.odin index 709964fb4..ca6122690 100644 --- a/core/sys/win32/kernel32.odin +++ b/core/sys/win32/kernel32.odin @@ -234,4 +234,4 @@ PAGE_WRITECOPY :: 0x08 PAGE_EXECUTE :: 0x10 PAGE_EXECUTE_READ :: 0x20 PAGE_EXECUTE_READWRITE :: 0x40 -PAGE_EXECUTE_WRITECOPY :: 0x80 +PAGE_EXECUTE_WRITECOPY :: 0x80
\ No newline at end of file diff --git a/core/sys/windows/kernel32.odin b/core/sys/windows/kernel32.odin index cb90f71da..6ac0fccf2 100644 --- a/core/sys/windows/kernel32.odin +++ b/core/sys/windows/kernel32.odin @@ -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, +}
\ No newline at end of file |