2 * PROJECT: MSVC runtime check support library
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * PURPOSE: Provides support functions for MSVC runtime checks
5 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
10 extern _RTC_error_fnW _RTC_pErrorFuncW
;
14 _RTC_DefaultErrorFuncW(
18 const wchar_t *module
,
19 const wchar_t *format
,
24 _RTC_ErrorDescription
[] =
26 "The stack pointer was wrong after returning from a function call.", /* _RTC_CHKSTK */
27 "Data was lost when a type was converted to a smaller type.", /* _RTC_CVRT_LOSS_INFO */
28 "The stack near a local variable was corrupted.", /* _RTC_CORRUPT_STACK */
29 "An uninitialized local variable was used.", /* _RTC_UNINIT_LOCAL_USE */
30 "The stack around an alloca was corrupted.", /* _RTC_CORRUPTED_ALLOCA */
37 /* Not supported yet */
45 _RTC_ErrorNumber _Errnum
)
47 if (_Errnum
< (sizeof(_RTC_ErrorDescription
) / sizeof(_RTC_ErrorDescription
[0])))
49 return _RTC_ErrorDescription
[_Errnum
];
52 return "Invalid/Unknown error.";
58 _RTC_ErrorNumber _Errnum
,
61 /* Not supported yet */
71 /* Not supported yet */
78 _RTC_SetErrorFuncW(_RTC_error_fnW new_fn
)
80 _RTC_error_fnW old_fn
;
82 /* Get the current error func */
83 old_fn
= _RTC_pErrorFuncW
;
85 /* Set the new function or reset when 0 was passed */
86 _RTC_pErrorFuncW
= new_fn
? new_fn
: _RTC_DefaultErrorFuncW
;
88 /* Return the old error func, or 0, if none was set */
89 return old_fn
!= _RTC_DefaultErrorFuncW
? old_fn
: 0;