ReactOS  0.4.15-dev-3331-g8ebe441
terminate.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <eh.h>
Include dependency graph for terminate.cpp:

Go to the source code of this file.

Classes

struct  C< T1, T2 >
 

Functions

int Test ()
 
void Bar (void)
 
void Test2 (void)
 
void __cdecl Terminate2 (void)
 
void __cdecl Terminate1 (void)
 
int main (void)
 

Variables

int FGenSEHException
 

Function Documentation

◆ Bar()

◆ main()

int main ( void  )

Definition at line 100 of file terminate.cpp.

101 {
102  int i;
103 
104  // First check that we don't terminate on an SEH exception
105  FGenSEHException = 1;
106  __try
107  {
108  i = Test();
109  }
110  __except (1)
111  {
112  printf("caught SEH exception in %s\n", __FUNCTION__);
113  }
114 
115  // Now set our own terminate handler and throw a C++ EH exception
117  FGenSEHException = 0;
118  i = Test();
119 
120  // Should never get here
121  printf("termination handler not called\n");
122  return i;
123 }
void __cdecl Terminate1(void)
Definition: terminate.cpp:90
int FGenSEHException
Definition: terminate.cpp:21
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
_CRTIMP terminate_function __cdecl set_terminate(terminate_function _NewPtFunc)
int Test()
Definition: terminate.cpp:43
#define __FUNCTION__
Definition: types.h:112
#define printf
Definition: config.h:203

◆ Terminate1()

void __cdecl Terminate1 ( void  )

Definition at line 90 of file terminate.cpp.

91 {
92  printf("termination handler (%s) called\n", __FUNCTION__);
93 
94  // Set a new handler and run a second C++ EH test case.
96  Test2();
97  exit(0);
98 }
void __cdecl Terminate2(void)
Definition: terminate.cpp:84
void Test2(void)
Definition: terminate.cpp:76
_CRTIMP terminate_function __cdecl set_terminate(terminate_function _NewPtFunc)
void exit(int exitcode)
Definition: _exit.c:33
#define __FUNCTION__
Definition: types.h:112
#define printf
Definition: config.h:203

Referenced by main().

◆ Terminate2()

void __cdecl Terminate2 ( void  )

Definition at line 84 of file terminate.cpp.

85 {
86  printf("termination handler (%s) called\n", __FUNCTION__);
87  exit(0);
88 }
void exit(int exitcode)
Definition: _exit.c:33
#define __FUNCTION__
Definition: types.h:112
#define printf
Definition: config.h:203

Referenced by Terminate1().

◆ Test()

int Test ( )

Definition at line 43 of file terminate.cpp.

44 {
45  try
46  {
47  C c;
48  throw 1;
49  }
50  catch (int)
51  {
52  printf("Destructor was not invoked \n");
53  }
54  catch (char)
55  {
56  printf("Destructor exited using an exception\n");
57  }
58 #if 0
59  catch (...)
60  {
61  printf("Throw caught by wrong handler\n");
62  }
63 #endif
64 
65  printf("terminate() was not called\n");
66 
67  return 1;
68 }
Definition: terminate.cpp:23
#define c
Definition: ke_i.h:80
#define printf
Definition: config.h:203

Referenced by main().

◆ Test2()

void Test2 ( void  )

Definition at line 76 of file terminate.cpp.

77 {
78  printf("in %s\n", __FUNCTION__);
79  C c;
80  Bar();
81  return;
82 }
Definition: terminate.cpp:23
void Bar(void)
Definition: terminate.cpp:70
#define c
Definition: ke_i.h:80
#define __FUNCTION__
Definition: types.h:112
#define printf
Definition: config.h:203

Referenced by MainWndProc(), SymlinkCreateTests(), and Terminate1().

Variable Documentation

◆ FGenSEHException

int FGenSEHException

Definition at line 21 of file terminate.cpp.

Referenced by main(), and C< T1, T2 >::~C().