ReactOS  0.4.15-dev-5089-g555bec6
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"
 

Function Documentation

◆ dojump()

void dojump ( jmp_buf  JumpBuffer,
PLONG  Counter 
)

Definition at line 11 of file seh0025.c.

11  {
12  try {
13  try {
14  /* set counter = 2 */
15  (*Counter) += 1;
16  RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
17  }
18  finally {
19  /* set counter = 3 */
20  (*Counter) += 1;
21  }
22  endtry
23  }
24  finally {
25  /* set counter = 4 */
26  (*Counter) += 1;
27  /* end unwinding with longjump */
28  longjmp(JumpBuffer, 1);
29  }
30  endtry
31 }
#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 33 of file seh0025.c.

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

Variable Documentation

◆ test

char test[] = "SEH0025.c"

Definition at line 9 of file seh0025.c.