ReactOS
0.4.16-dev-122-g325d74c
seh0024.c
Go to the documentation of this file.
1
// Copyright (c) Microsoft. All rights reserved.
2
// Licensed under the MIT license. See LICENSE file in the project root for
3
// full license information.
4
5
#include <windows.h>
6
7
#if defined(_M_MRX000) || defined(_M_PPC) || defined(_ALPHA)
8
#include <
setjmpex.h
>
9
#else
10
#include <setjmp.h>
11
#endif
12
13
#define faill()
14
#define startest()
15
#define finish()
16
17
#include "
seh.h
"
18
19
char
test
[] =
"SEH0024.c"
;
20
21
int
main
() {
22
jmp_buf
JumpBuffer;
23
LONG
Counter
;
24
25
Counter
= 0;
26
27
#if defined(_M_MRX000) || defined(_M_PPC) || defined(_ALPHA)
28
if
(
setjmp
(JumpBuffer) == 0)
29
#else
30
if
(_setjmp(JumpBuffer) == 0)
31
#endif
32
33
{
34
try
{
35
try
{
36
try
{
37
try
{
38
/* set counter = 1 */
39
//(volatile LONG) Counter += 1;
40
*(
volatile
LONG
*)&
Counter
+= 1;
41
RaiseException
(
EXCEPTION_INT_OVERFLOW
, 0,
/*no flags*/
0, 0);
42
}
43
finally
{
44
/* set counter = 2 */
45
//(volatile LONG) Counter += 1;
46
*(
volatile
LONG
*)&
Counter
+= 1;
47
}
48
endtry
49
}
50
finally
{
51
/* set counter = 3 */
52
//(volatile LONG) Counter += 1;
53
*(
volatile
LONG
*)&
Counter
+= 1;
54
/* end unwinding wiht long jump */
55
longjmp(JumpBuffer, 1);
56
}
57
endtry
58
}
59
finally
{
60
/* never gets here due to longjump ending unwinding */
61
//(volatile LONG) Counter += 1;
62
*(
volatile
LONG
*)&
Counter
+= 1;
63
}
64
endtry
65
}
66
except
(1)
67
/* handle exception after unwinding */
68
{
69
/* sets counter = 4 */
70
//(volatile LONG) Counter += 1;
71
*(
volatile
LONG
*)&
Counter
+= 1;
72
}
73
endtry
74
}
else
{
75
/* sets counter = 5 */
76
//(volatile LONG) Counter += 1;
77
*(
volatile
LONG
*)&
Counter
+= 1;
78
}
79
80
if
(
Counter
!= 5) {
81
printf
(
"TEST 24 FAILED. Counter = %d\n\r"
,
Counter
);
82
return
-1;
83
}
84
85
return
0;
86
}
except
#define except(x)
Definition:
btrfs_drv.h:136
setjmp
#define setjmp
Definition:
setjmp.h:209
jmp_buf
_JBTYPE jmp_buf[_JBLEN]
Definition:
setjmp.h:186
RaiseException
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition:
except.c:700
printf
#define printf
Definition:
freeldr.h:97
LONG
long LONG
Definition:
pedump.c:60
test
char test[]
Definition:
seh0024.c:19
main
int main()
Definition:
seh0024.c:21
seh.h
endtry
#define endtry
Definition:
seh.h:24
setjmpex.h
Counter
static LARGE_INTEGER Counter
Definition:
clock.c:43
EXCEPTION_INT_OVERFLOW
#define EXCEPTION_INT_OVERFLOW
Definition:
winbase.h:324
modules
rostests
apitests
compiler
ms
seh
seh0024.c
Generated on Sat Oct 12 2024 06:06:36 for ReactOS by
1.9.6