ReactOS
0.4.16-dev-237-gd6eebaa
abort.c
Go to the documentation of this file.
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
23
void
24
__cdecl
25
abort
(
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
{
49
(
void
)0;
50
}
51
52
raise
(
SIGABRT
);
53
_exit
(3);
54
}
55
_exit
void _exit(int exitcode)
Definition:
_exit.c:25
__abort_behavior
unsigned int __abort_behavior
Definition:
abort.c:12
abort
void __cdecl abort(void)
Aborts the program.
Definition:
abort.c:25
abort_msg
static const char abort_msg[]
Definition:
abort.c:14
__cdecl
#define __cdecl
Definition:
accygwin.h:79
raise
int __cdecl raise(int _SigNum)
Definition:
signal.c:71
SIGABRT
#define SIGABRT
Definition:
signal.h:28
stderr
#define stderr
Definition:
stdio.h:100
fprintf
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_CALL_REPORTFAULT
#define _CALL_REPORTFAULT
Definition:
stdlib.h:116
_OUT_TO_MSGBOX
#define _OUT_TO_MSGBOX
Definition:
stdlib.h:112
_OUT_TO_DEFAULT
#define _OUT_TO_DEFAULT
Definition:
stdlib.h:110
_WRITE_ABORT_MSG
#define _WRITE_ABORT_MSG
Definition:
stdlib.h:115
void
Definition:
nsiface.idl:2307
_GUI_APP
#define _GUI_APP
Definition:
internal.h:146
__crt_MessageBoxA
int __cdecl __crt_MessageBoxA(_In_opt_ const char *pszText, _In_ unsigned int uType)
Definition:
__crt_MessageBoxA.c:22
msvcrt_error_mode
int msvcrt_error_mode
Definition:
errno.c:113
__app_type
int __app_type
Definition:
environ.c:30
MB_ICONERROR
#define MB_ICONERROR
Definition:
winuser.h:790
MB_OK
#define MB_OK
Definition:
winuser.h:793
sdk
lib
crt
stdlib
abort.c
Generated on Mon Nov 4 2024 06:13:28 for ReactOS by
1.9.6