1 // Licensed under the Apache License, Version 2.0 2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 4 // All files in the project carrying such notice may not be copied, modified, or distributed 5 // except according to those terms. 6 //! ApiSet Contract for api-ms-win-core-errorhandling-l1 7 use shared::basetsd::ULONG_PTR; 8 use shared::minwindef::{BOOL, DWORD, LPDWORD, UINT, ULONG}; 9 use um::winnt::{ 10 EXCEPTION_POINTERS, LONG, LPCSTR, LPCWSTR, PCONTEXT, PEXCEPTION_RECORD, 11 PVECTORED_EXCEPTION_HANDLER, PVOID, 12 }; 13 FN!{stdcall PTOP_LEVEL_EXCEPTION_FILTER( 14 ExceptionInfo: *mut EXCEPTION_POINTERS, 15 ) -> LONG} 16 pub type LPTOP_LEVEL_EXCEPTION_FILTER = PTOP_LEVEL_EXCEPTION_FILTER; 17 extern "system" { RaiseException( dwExceptionCode: DWORD, dwExceptionFlags: DWORD, nNumberOfArguments: DWORD, lpArguments: *const ULONG_PTR, )18 pub fn RaiseException( 19 dwExceptionCode: DWORD, 20 dwExceptionFlags: DWORD, 21 nNumberOfArguments: DWORD, 22 lpArguments: *const ULONG_PTR, 23 ); UnhandledExceptionFilter( ExceptionInfo: *mut EXCEPTION_POINTERS, ) -> LONG24 pub fn UnhandledExceptionFilter( 25 ExceptionInfo: *mut EXCEPTION_POINTERS, 26 ) -> LONG; SetUnhandledExceptionFilter( lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER, ) -> LPTOP_LEVEL_EXCEPTION_FILTER27 pub fn SetUnhandledExceptionFilter( 28 lpTopLevelExceptionFilter: LPTOP_LEVEL_EXCEPTION_FILTER, 29 ) -> LPTOP_LEVEL_EXCEPTION_FILTER; GetLastError() -> DWORD30 pub fn GetLastError() -> DWORD; SetLastError( dwErrCode: DWORD, )31 pub fn SetLastError( 32 dwErrCode: DWORD, 33 ); GetErrorMode() -> UINT34 pub fn GetErrorMode() -> UINT; SetErrorMode( uMode: UINT, ) -> UINT35 pub fn SetErrorMode( 36 uMode: UINT, 37 ) -> UINT; AddVectoredExceptionHandler( First: ULONG, Handler: PVECTORED_EXCEPTION_HANDLER, ) -> PVOID38 pub fn AddVectoredExceptionHandler( 39 First: ULONG, 40 Handler: PVECTORED_EXCEPTION_HANDLER, 41 ) -> PVOID; RemoveVectoredExceptionHandler( Handle: PVOID, ) -> ULONG42 pub fn RemoveVectoredExceptionHandler( 43 Handle: PVOID, 44 ) -> ULONG; AddVectoredContinueHandler( First: ULONG, Handler: PVECTORED_EXCEPTION_HANDLER, ) -> PVOID45 pub fn AddVectoredContinueHandler( 46 First: ULONG, 47 Handler: PVECTORED_EXCEPTION_HANDLER, 48 ) -> PVOID; RemoveVectoredContinueHandler( Handle: PVOID, ) -> ULONG49 pub fn RemoveVectoredContinueHandler( 50 Handle: PVOID, 51 ) -> ULONG; 52 } 53 // RestoreLastError 54 extern "system" { RaiseFailFastException( pExceptionRecord: PEXCEPTION_RECORD, pContextRecord: PCONTEXT, dwFlags: DWORD, )55 pub fn RaiseFailFastException( 56 pExceptionRecord: PEXCEPTION_RECORD, 57 pContextRecord: PCONTEXT, 58 dwFlags: DWORD, 59 ); FatalAppExitA( uAction: UINT, lpMessageText: LPCSTR, )60 pub fn FatalAppExitA( 61 uAction: UINT, 62 lpMessageText: LPCSTR, 63 ); FatalAppExitW( uAction: UINT, lpMessageText: LPCWSTR, )64 pub fn FatalAppExitW( 65 uAction: UINT, 66 lpMessageText: LPCWSTR, 67 ); GetThreadErrorMode() -> DWORD68 pub fn GetThreadErrorMode() -> DWORD; SetThreadErrorMode( dwNewMode: DWORD, lpOldMode: LPDWORD, ) -> BOOL69 pub fn SetThreadErrorMode( 70 dwNewMode: DWORD, 71 lpOldMode: LPDWORD, 72 ) -> BOOL; 73 } 74 // What library provides this function? 75 // TerminateProcessOnMemoryExhaustion 76