ReactOS  0.4.15-dev-5089-g555bec6
seh0026.c File Reference
#include <windows.h>
#include <setjmp.h>
#include "seh.h"
Include dependency graph for seh0026.c:

Go to the source code of this file.

Functions

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

Variables

char test [] = "SEH0026.c"
 

Function Documentation

◆ dojump()

void dojump ( jmp_buf  JumpBuffer,
PLONG  Counter 
)

Definition at line 12 of file seh0026.c.

12  {
13  try {
14  try {
15  /* set Counter = 1 */
16  *Counter += 1;
17  RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
18  }
19  finally {
20  /* set counter = 2 */
21  *Counter += 1;
22  }
23  endtry
24  }
25  finally {
26  /* set counter = 3 */
27  *Counter += 1;
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
static LARGE_INTEGER Counter
Definition: clock.c:43

Referenced by main().

◆ main()

int main ( void  )

Definition at line 33 of file seh0026.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  try {
44  *(volatile LONG*)&Counter += 1;
45  dojump(JumpBuffer, &Counter);
46  }
47  finally { *(volatile LONG*)&Counter += 1; }
48  endtry
49  }
50  finally {
51  *(volatile LONG*)&Counter += 1;
52  longjmp(JumpBuffer, 1);
53  }
54  endtry
55  }
56  finally { *(volatile LONG*)&Counter += 1; }
57  endtry
58  }
59  except(1)
60  /* EXECUTE HANDLER after unwinding */
61  {
62  *(volatile LONG*)&Counter += 1;
63  }
64  endtry
65  } else {
66  /* set Counter = 4 */ //
67  *(volatile LONG*)&Counter += 1;
68  }
69 
70  if (Counter != 8) {
71  printf("TEST 26 FAILED. Counter = %d\n\r", Counter);
72  return -1;
73  }
74 
75  return 0;
76 }
#define endtry
Definition: seh.h:24
void dojump(jmp_buf JumpBuffer, PLONG Counter)
Definition: seh0026.c:12
long LONG
Definition: pedump.c:60
#define printf
Definition: freeldr.h:94
#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[] = "SEH0026.c"

Definition at line 10 of file seh0026.c.