ReactOS  0.4.13-dev-100-gc8611ae
xcptfil.c File Reference
#include <precomp.h>
#include "internal/wine/msvcrt.h"
#include "internal/wine/cppexcept.h"
Include dependency graph for xcptfil.c:

Go to the source code of this file.

Typedefs

typedef void(* sighandler_t) (int)
 

Functions

int CDECL _XcptFilter (NTSTATUS ExceptionCode, struct _EXCEPTION_POINTERS *except)
 

Variables

static sighandler_t sighandlers [NSIG] = { SIG_DFL }
 
struct {
   NTSTATUS   status
 
   int   signal
 
float_exception_map []
 

Typedef Documentation

◆ sighandler_t

typedef void(* sighandler_t) (int)

Definition at line 5 of file xcptfil.c.

Function Documentation

◆ _XcptFilter()

int CDECL _XcptFilter ( NTSTATUS  ExceptionCode,
struct _EXCEPTION_POINTERS except 
)

Definition at line 27 of file xcptfil.c.

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 }
static sighandler_t sighandlers[NSIG]
Definition: xcptfil.c:6
#define EXCEPTION_FLT_UNDERFLOW
Definition: winbase.h:319
#define EXCEPTION_ACCESS_VIOLATION
Definition: winbase.h:308
#define SIGILL
Definition: signal.h:25
#define _FPE_INVALID
Definition: float.h:87
#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
long LONG
Definition: pedump.c:60
#define EXCEPTION_FLT_DIVIDE_BY_ZERO
Definition: winbase.h:314
#define SIGFPE
Definition: signal.h:30
int ret
#define EXCEPTION_FLT_DENORMAL_OPERAND
Definition: winbase.h:313
#define except(x)
Definition: btrfs_drv.h:127
#define SIGSEGV
Definition: signal.h:33
#define EXCEPTION_FLT_OVERFLOW
Definition: winbase.h:317
#define EXCEPTION_FLT_STACK_CHECK
Definition: winbase.h:318
#define EXCEPTION_ILLEGAL_INSTRUCTION
Definition: winbase.h:324
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
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:87
Definition: ps.c:97

Referenced by __CppXcptFilter().

Variable Documentation

◆ float_exception_map

const { ... } float_exception_map[]
Initial value:
= {
}
#define EXCEPTION_FLT_UNDERFLOW
Definition: winbase.h:319
#define _FPE_ZERODIVIDE
Definition: float.h:89
#define _FPE_STACKOVERFLOW
Definition: float.h:95
#define _FPE_INVALID
Definition: float.h:87
#define _FPE_OVERFLOW
Definition: float.h:90
#define EXCEPTION_FLT_INVALID_OPERATION
Definition: winbase.h:316
#define _FPE_INEXACT
Definition: float.h:92
#define EXCEPTION_FLT_DIVIDE_BY_ZERO
Definition: winbase.h:314
#define EXCEPTION_FLT_DENORMAL_OPERAND
Definition: winbase.h:313
#define _FPE_UNDERFLOW
Definition: float.h:91
#define EXCEPTION_FLT_OVERFLOW
Definition: winbase.h:317
#define EXCEPTION_FLT_STACK_CHECK
Definition: winbase.h:318
#define _FPE_DENORMAL
Definition: float.h:88
#define EXCEPTION_FLT_INEXACT_RESULT
Definition: winbase.h:315

Referenced by _XcptFilter().

◆ sighandlers

sighandler_t sighandlers[NSIG] = { SIG_DFL }
static

Definition at line 6 of file xcptfil.c.

Referenced by _XcptFilter().

◆ signal

◆ status

Definition at line 11 of file xcptfil.c.