Add more exception handling stuff to sys/windows

This commit is contained in:
gingerBill
2020-06-26 20:42:17 +01:00
parent b5f9c95ce7
commit 53e1512978
2 changed files with 19 additions and 3 deletions
+5 -1
View File
@@ -26,10 +26,14 @@ foreign kernel32 {
SetHandleInformation :: proc(hObject: HANDLE,
dwMask: DWORD,
dwFlags: DWORD) -> BOOL ---
AddVectoredExceptionHandler :: proc(FirstHandler: ULONG, VectoredHandler: PVECTORED_EXCEPTION_HANDLER) -> LPVOID ---
AddVectoredContinueHandler :: proc(FirstHandler: ULONG, VectoredHandler: PVECTORED_EXCEPTION_HANDLER) -> LPVOID ---
RemoveVectoredExceptionHandler :: proc(Handle: LPVOID) -> DWORD ---
RemoveVectoredContinueHandler :: proc(Handle: LPVOID) -> DWORD ---
RaiseException :: proc(dwExceptionCode, dwExceptionFlags, nNumberOfArguments: DWORD, lpArguments: ^ULONG_PTR) -> ! ---
CreateHardLinkW :: proc(lpSymlinkFileName: LPCWSTR,
lpTargetFileName: LPCWSTR,
lpSecurityAttributes: LPSECURITY_ATTRIBUTES) -> BOOL ---
@@ -39,7 +43,6 @@ foreign kernel32 {
lpFileInformation: LPVOID,
dwBufferSize: DWORD) -> BOOL ---
GetCurrentProcessId :: proc() -> DWORD ---
InitializeCriticalSection :: proc(CriticalSection: ^CRITICAL_SECTION) ---
InitializeCriticalSectionAndSpinCount :: proc(CriticalSection: ^CRITICAL_SECTION, dwSpinCount: DWORD) -> BOOL ---
EnterCriticalSection :: proc(CriticalSection: ^CRITICAL_SECTION) ---
@@ -53,6 +56,7 @@ foreign kernel32 {
GetCommandLineW :: proc() -> LPCWSTR ---
GetTempPathW :: proc(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD ---
GetCurrentProcess :: proc() -> HANDLE ---
GetCurrentProcessId :: proc() -> DWORD ---
GetCurrentThread :: proc() -> HANDLE ---
GetCurrentThreadId :: proc() -> DWORD ---
GetStdHandle :: proc(which: DWORD) -> HANDLE ---
+14 -2
View File
@@ -319,7 +319,6 @@ FILE_TYPE_CHAR :: 0x0002;
FILE_TYPE_PIPE :: 0x0003;
when size_of(uintptr) == 4 {
WSADATA :: struct {
wVersion: WORD,
@@ -606,10 +605,23 @@ timeval :: struct {
tv_usec: c_long,
}
EXCEPTION_CONTINUE_SEARCH: LONG : 0;
EXCEPTION_STACK_OVERFLOW: DWORD : 0xc00000fd;
EXCEPTION_CONTINUE_EXECUTION: LONG : -1;
EXCEPTION_EXECUTE_HANDLER: LONG : 1;
EXCEPTION_MAXIMUM_PARAMETERS :: 15;
EXCEPTION_DATATYPE_MISALIGNMENT :: 0x80000002;
EXCEPTION_ACCESS_VIOLATION :: 0xC0000005;
EXCEPTION_ILLEGAL_INSTRUCTION :: 0xC000001D;
EXCEPTION_ARRAY_BOUNDS_EXCEEDED :: 0xC000008C;
EXCEPTION_INT_DIVIDE_BY_ZERO :: 0xC0000094;
EXCEPTION_INT_OVERFLOW :: 0xC0000095;
EXCEPTION_STACK_OVERFLOW :: 0xC00000FD;
STATUS_PRIVILEGED_INSTRUCTION :: 0xC0000096;
EXCEPTION_RECORD :: struct {
ExceptionCode: DWORD,
ExceptionFlags: DWORD,