ReactOS  0.4.15-dev-3299-gbe8e5fc
seh0025.c File Reference
#include <windows.h>
#include <setjmp.h>
#include "seh.h"
Include dependency graph for seh0025.c:

Go to the source code of this file.

Functions

void dojump (jmp_buf JumpBuffer, PLONG Counter)
 
int main ()
 

Variables

char test [] = "SEH0025.c"
 
int perfect
 

Function Documentation

◆ dojump()

void dojump ( jmp_buf  JumpBuffer,
PLONG  Counter 
)

Definition at line 12 of file seh0025.c.

12  {
13  try {
14  try {
15  /* set counter = 2 */
16  (*Counter) += 1;
17  RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
18  }
19  finally {
20  /* set counter = 3 */
21  (*Counter) += 1;
22  }
23  endtry
24  }
25  finally {
26  /* set counter = 4 */
27  (*Counter) += 1;
28  /* end unwinding with longjump */
29  longjmp(JumpBuffer, 1);
30  }
31  endtry
32 }
#define endtry
Definition: seh.h:24
#define EXCEPTION_INT_OVERFLOW
Definition: winbase.h:321
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700

Referenced by main().

◆ main()

int main ( void  )

Definition at line 34 of file seh0025.c.

34  {
35  jmp_buf JumpBuffer;
36  LONG Counter;
37 
38  Counter = 0;
39 
40  if (_setjmp(JumpBuffer) == 0) {
41  try {
42  try {
43  try {
44  /* set counter = 1 */
45  //(volatile LONG) Counter += 1;
46  *(volatile LONG*)&Counter += 1;
47  dojump(JumpBuffer, &Counter);
48  }
49  finally {
50  /* set counter = 5 */
51  //(volatile LONG) Counter += 1;
52  *(volatile LONG*)&Counter += 1;
53  }
54  endtry
55  }
56  finally {
57  /* set counter = 6 */
58  //(volatile LONG) Counter += 1;
59  *(volatile LONG*)&Counter += 1;
60  }
61  endtry
62  }
63  except(1)
64  /*
65  * handle exception raised in function
66  * after unwinding
67  */
68  {
69  //(volatile LONG) Counter += 1;
70  *(volatile LONG*)&Counter += 1;
71  }
72  endtry
73  } else {
74  /* set counter = 7 */
75  //(volatile LONG) Counter += 1;
76  *(volatile LONG*)&Counter += 1;
77  }
78 
79  if (Counter != 7) {
80  printf("TEST 25 FAILED. Counter = %d\n\r", Counter);
81  return -1;
82  }
83 
84  return 0;
85 }
#define endtry
Definition: seh.h:24
long LONG
Definition: pedump.c:60
void dojump(jmp_buf JumpBuffer, PLONG Counter)
Definition: seh0025.c:12
#define except(x)
Definition: btrfs_drv.h:139
_JBTYPE jmp_buf[_JBLEN]
Definition: setjmp.h:160
static LARGE_INTEGER Counter
Definition: clock.c:43
#define printf
Definition: config.h:203

Variable Documentation

◆ perfect

int perfect

Definition at line 10 of file seh0025.c.

◆ test

char test[] = "SEH0025.c"

Definition at line 9 of file seh0025.c.