ReactOS 0.4.15-dev-8422-g6219a1a
seh0007.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
8char test[] = "SEH0007.c";
9
10int main() {
11 PLONG BadAddress;
12 PLONG BlackHole;
14
15 // startest();
16
17 BadAddress = (PLONG)((PVOID)0);
18 BlackHole = &Counter;
19
20 Counter = 0;
21 try {
22 try {
23 Counter += 1;
24 *BlackHole += *BadAddress;
25 }
26 finally {
27 if (abnormal_termination() != 0)
28 /*
29 * should execute handler as not abnormal
30 * termination
31 */
32 {
33 Counter += 1;
34 }
35 }
36 endtry
37 }
39 /* counter is positive == EXECUTE_HANDLER */
40 {
41 if (Counter == 2)
42 /* counter should equal 2 and execute handler */
43 {
44 Counter += 1;
45 }
46 }
47 endtry
48
49 if (Counter != 3) {
50 printf("TEST 7 FAILED. Counter = %d\n\r", Counter);
51 return -1;
52 }
53
54 return 0;
55}
#define except(x)
Definition: btrfs_drv.h:136
#define printf
Definition: freeldr.h:97
long LONG
Definition: pedump.c:60
char test[]
Definition: seh0007.c:8
int main()
Definition: seh0007.c:10
#define endtry
Definition: seh.h:24
#define abnormal_termination
Definition: seh.h:25
static LARGE_INTEGER Counter
Definition: clock.c:43
int32_t * PLONG
Definition: typedefs.h:58