1 /* 2 * PROJECT: ReactOS C runtime library 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: lib/sdk/crt/stdlib/abort.c 5 * PURPOSE: abort implementation 6 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) 7 */ 8 9 #include "precomp.h" 10 #include <signal.h> 11 12 unsigned int __abort_behavior = _WRITE_ABORT_MSG | _CALL_REPORTFAULT; 13 14 static const char abort_msg[] = 15 "This application has requested the Runtime to terminate in an unusual way.\n" 16 "Please contact the application's support team for more information.\0"; 17 18 /*! 19 * \brief Aborts the program. 20 * 21 * \note The function does not return. 22 */ 23 void 24 __cdecl abort(void)25abort ( 26 void) 27 { 28 /* Check if a message should be output */ 29 if (__abort_behavior & _WRITE_ABORT_MSG) 30 { 31 /* Check if we should display a message box */ 32 if (((msvcrt_error_mode == _OUT_TO_DEFAULT) && (__app_type == _GUI_APP)) || 33 (msvcrt_error_mode == _OUT_TO_MSGBOX)) 34 { 35 /* Output a message box */ 36 __crt_MessageBoxA(abort_msg, MB_OK | MB_ICONERROR); 37 } 38 else 39 { 40 /* Print message to stderr */ 41 fprintf(stderr, "%s\n", abort_msg); 42 } 43 } 44 45 /* Check if faultrep handler should be called */ 46 if (__abort_behavior & _CALL_REPORTFAULT) 47 { 48 /// \todo unimplemented 49 (void)0; 50 } 51 52 raise(SIGABRT); 53 _exit(3); 54 } 55 56