ReactOS
0.4.15-dev-8636-g945e856
seh0018.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 "
seh.h
"
7
8
char
test
[] =
"SEH0018.c"
;
9
10
void
rtlRaiseException
(
DWORD
Status
) {
11
RaiseException
(
Status
, 0,
/*no flags*/
0, 0);
12
return
;
13
}
14
15
void
eret
(
DWORD
Status
,
PLONG
Counter
) {
16
try
{
17
try
{
18
rtlRaiseException
(
Status
);
19
}
20
except
((((
DWORD
)
GetExceptionCode
()) ==
Status
) ? 1 : 0)
21
/* exeption handler should get executed */
22
{
23
/* set counter = 2 */
24
*
Counter
+= 1;
25
return
;
26
}
27
endtry
28
}
29
finally
{
30
/* set counter = 3 */
31
*
Counter
+= 1;
32
}
33
endtry
34
35
return
;
36
}
37
38
int
main
() {
39
40
LONG
Counter
;
41
42
Counter
= 0;
43
44
try
{
45
/* set counter = 1 */
46
Counter
+= 1;
47
eret
(
EXCEPTION_ACCESS_VIOLATION
, &
Counter
);
48
}
49
finally
{
50
/* set counter = 4 */
51
Counter
+= 1;
52
}
53
endtry
54
55
if
(
Counter
!= 4) {
56
printf
(
"TEST 18 FAILED. Counter = %d\n\r"
,
Counter
);
57
return
-1;
58
}
59
60
return
0;
61
}
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
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
printf
#define printf
Definition:
freeldr.h:97
Status
Status
Definition:
gdiplustypes.h:25
LONG
long LONG
Definition:
pedump.c:60
eret
void eret(DWORD Status, PLONG Counter)
Definition:
seh0018.c:15
rtlRaiseException
void rtlRaiseException(DWORD Status)
Definition:
seh0018.c:10
test
char test[]
Definition:
seh0018.c:8
main
int main()
Definition:
seh0018.c:38
seh.h
endtry
#define endtry
Definition:
seh.h:24
GetExceptionCode
#define GetExceptionCode()
Definition:
seh.h:27
Counter
static LARGE_INTEGER Counter
Definition:
clock.c:43
PLONG
int32_t * PLONG
Definition:
typedefs.h:58
EXCEPTION_ACCESS_VIOLATION
#define EXCEPTION_ACCESS_VIOLATION
Definition:
winbase.h:311
modules
rostests
apitests
compiler
ms
seh
seh0018.c
Generated on Tue Sep 10 2024 06:06:43 for ReactOS by
1.9.6