ReactOS 0.4.16-dev-329-g9223134
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}
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
#define endtry
Definition: seh.h:24
#define EXCEPTION_INT_OVERFLOW
Definition: winbase.h:350

Referenced by main().

◆ main()

int main ( void  )

Definition at line 33 of file seh0025.c.

33 {
34 jmp_buf JumpBuffer;
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 except(x)
Definition: btrfs_drv.h:136
#define printf
Definition: freeldr.h:97
long LONG
Definition: pedump.c:60
void dojump(jmp_buf JumpBuffer, PLONG Counter)
Definition: seh0025.c:11
static LARGE_INTEGER Counter
Definition: clock.c:43
_JBTYPE jmp_buf[_JBLEN]
Definition: setjmp.h:186

Variable Documentation

◆ test

char test[] = "SEH0025.c"

Definition at line 9 of file seh0025.c.