ReactOS  0.4.13-dev-101-g0ca4b50
xcptfil.c
Go to the documentation of this file.
1 #include <precomp.h>
2 #include "internal/wine/msvcrt.h"
4 
5 typedef void (*sighandler_t)(int);
7 
8 /* The exception codes are actually NTSTATUS values */
9 static const struct
10 {
12  int signal;
13 } float_exception_map[] = {
21 };
22 
23 /*
24  * @implemented
25  */
26 int CDECL
28  struct _EXCEPTION_POINTERS * except)
29 {
32 
33  if (!except || !except->ExceptionRecord)
35 
36  switch (except->ExceptionRecord->ExceptionCode)
37  {
39  if ((handler = sighandlers[SIGSEGV]) != SIG_DFL)
40  {
41  if (handler != SIG_IGN)
42  {
45  }
47  }
48  break;
49  /* According to msdn,
50  * the FPE signal handler takes as a second argument the type of
51  * floating point exception.
52  */
60  if ((handler = sighandlers[SIGFPE]) != SIG_DFL)
61  {
62  if (handler != SIG_IGN)
63  {
64  unsigned int i;
65  int float_signal = _FPE_INVALID;
66 
68  for (i = 0; i < sizeof(float_exception_map) /
69  sizeof(float_exception_map[0]); i++)
70  {
72  except->ExceptionRecord->ExceptionCode)
73  {
74  float_signal = float_exception_map[i].signal;
75  break;
76  }
77  }
78  ((float_handler)handler)(SIGFPE, float_signal);
79  }
81  }
82  break;
85  if ((handler = sighandlers[SIGILL]) != SIG_DFL)
86  {
87  if (handler != SIG_IGN)
88  {
90  handler(SIGILL);
91  }
93  }
94  break;
95  }
96  return ret;
97 }
98 
static sighandler_t sighandlers[NSIG]
Definition: xcptfil.c:6
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1782
#define EXCEPTION_FLT_UNDERFLOW
Definition: winbase.h:319
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define _FPE_ZERODIVIDE
Definition: float.h:89
#define _FPE_STACKOVERFLOW
Definition: float.h:95
#define EXCEPTION_ACCESS_VIOLATION
Definition: winbase.h:308
LONG NTSTATUS
Definition: precomp.h:26
#define SIGILL
Definition: signal.h:25
#define _FPE_INVALID
Definition: float.h:87
#define _FPE_OVERFLOW
Definition: float.h:90
#define EXCEPTION_FLT_INVALID_OPERATION
Definition: winbase.h:316
void(* float_handler)(int, int)
Definition: msvcrt.h:142
#define SIG_DFL
Definition: signal.h:47
static const struct @3894 float_exception_map[]
void(* sighandler_t)(int)
Definition: xcptfil.c:5
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _FPE_INEXACT
Definition: float.h:92
#define NSIG
Definition: signal.h:20
long LONG
Definition: pedump.c:60
#define EXCEPTION_FLT_DIVIDE_BY_ZERO
Definition: winbase.h:314
#define SIGFPE
Definition: signal.h:30
int ret
int signal
Definition: xcptfil.c:12
#define EXCEPTION_FLT_DENORMAL_OPERAND
Definition: winbase.h:313
#define except(x)
Definition: btrfs_drv.h:127
#define SIGSEGV
Definition: signal.h:33
#define _FPE_UNDERFLOW
Definition: float.h:91
int CDECL _XcptFilter(NTSTATUS ExceptionCode, struct _EXCEPTION_POINTERS *except)
Definition: xcptfil.c:27
#define CDECL
Definition: compat.h:21
#define EXCEPTION_FLT_OVERFLOW
Definition: winbase.h:317
#define EXCEPTION_FLT_STACK_CHECK
Definition: winbase.h:318
NTSTATUS status
Definition: xcptfil.c:11
#define EXCEPTION_ILLEGAL_INSTRUCTION
Definition: winbase.h:324
#define _FPE_DENORMAL
Definition: float.h:88
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
#define SIG_IGN
Definition: signal.h:48
#define EXCEPTION_PRIV_INSTRUCTION
Definition: winbase.h:322
#define EXCEPTION_FLT_INEXACT_RESULT
Definition: winbase.h:315
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:87
Definition: ps.c:97