ReactOS 0.4.15-dev-7931-gfd331f1
seh0009.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[] = "SEH0009.c";
9
10void AccessViolation(PLONG BlackHole, PLONG BadAddress) {
11 *BlackHole += *BadAddress;
12 return;
13}
14
15int main() {
16 PLONG BadAddress;
17 PLONG BlackHole;
19
20 BadAddress = (PLONG)((PVOID)0);
21 BlackHole = &Counter;
22
23 Counter = 0;
24
25 try {
26 Counter += 1;
27 AccessViolation(BlackHole, BadAddress);
28 }
30 /*
31 * should be ACCESS VIOLATOIN 0xC0000005L) causing
32 * execution of handler
33 */
34 {
35 Counter += 1;
36 }
37 endtry
38
39 if (Counter != 2) {
40 printf("TEST 9 FAILED. Counter = %d\n\r", Counter);
41 return -1;
42 }
43
44 return 0;
45}
#define except(x)
Definition: btrfs_drv.h:136
#define printf
Definition: freeldr.h:97
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
long LONG
Definition: pedump.c:60
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition: seh0009.c:10
char test[]
Definition: seh0009.c:8
int main()
Definition: seh0009.c:15
#define endtry
Definition: seh.h:24
#define GetExceptionCode()
Definition: seh.h:27
static LARGE_INTEGER Counter
Definition: clock.c:43
int32_t * PLONG
Definition: typedefs.h:58