ReactOS
0.4.16-dev-334-g4d9f67c
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
8
char
test
[] =
"SEH0009.c"
;
9
10
void
AccessViolation
(
PLONG
BlackHole,
PLONG
BadAddress) {
11
*BlackHole += *BadAddress;
12
return
;
13
}
14
15
int
main
() {
16
PLONG
BadAddress;
17
PLONG
BlackHole;
18
LONG
Counter
;
19
20
BadAddress = (
PLONG
)((
PVOID
)0);
21
BlackHole = &
Counter
;
22
23
Counter
= 0;
24
25
try
{
26
Counter
+= 1;
27
AccessViolation
(BlackHole, BadAddress);
28
}
29
except
((
GetExceptionCode
() ==
STATUS_ACCESS_VIOLATION
) ? 1 : 0)
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
}
except
#define except(x)
Definition:
btrfs_drv.h:136
printf
#define printf
Definition:
freeldr.h:97
GetExceptionCode
#define GetExceptionCode
Definition:
excpt.h:83
void
Definition:
nsiface.idl:2307
STATUS_ACCESS_VIOLATION
#define STATUS_ACCESS_VIOLATION
Definition:
ntstatus.h:242
LONG
long LONG
Definition:
pedump.c:60
AccessViolation
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition:
seh0009.c:10
test
char test[]
Definition:
seh0009.c:8
main
int main()
Definition:
seh0009.c:15
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
modules
rostests
apitests
compiler
ms
seh
seh0009.c
Generated on Mon Dec 9 2024 06:06:46 for ReactOS by
1.9.6