ReactOS
0.4.16-dev-320-g3bd9ddc
seh0026.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
#include <setjmp.h>
7
8
#include "
seh.h
"
9
10
char
test
[] =
"SEH0026.c"
;
11
12
void
dojump
(
jmp_buf
JumpBuffer,
PLONG
Counter
) {
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
}
32
33
int
main
() {
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
}
except
#define except(x)
Definition:
btrfs_drv.h:136
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
dojump
void dojump(jmp_buf JumpBuffer, PLONG Counter)
Definition:
seh0026.c:12
test
char test[]
Definition:
seh0026.c:10
main
int main()
Definition:
seh0026.c:33
seh.h
endtry
#define endtry
Definition:
seh.h:24
Counter
static LARGE_INTEGER Counter
Definition:
clock.c:43
PLONG
int32_t * PLONG
Definition:
typedefs.h:58
jmp_buf
_JBTYPE jmp_buf[_JBLEN]
Definition:
setjmp.h:186
EXCEPTION_INT_OVERFLOW
#define EXCEPTION_INT_OVERFLOW
Definition:
winbase.h:350
modules
rostests
apitests
compiler
ms
seh
seh0026.c
Generated on Thu Dec 5 2024 06:13:17 for ReactOS by
1.9.6