ReactOS 0.4.16-dev-178-g8ba6102
seh0013.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 <setjmp.h>
6#include <windows.h>
7#include "seh.h"
8
9char test[] = "SEH0013.c";
10
12 RaiseException(Status, 0, /*no flags*/ 0, 0);
13 return;
14}
15
16void AccessViolation(PLONG BlackHole, PLONG BadAddress) {
17 *BlackHole += *BadAddress;
18 return;
19}
20
21int main() {
22 PLONG BadAddress;
23 PCHAR BadByte;
24 PLONG BlackHole;
25 ULONG Index2 = 1;
27
28 BadAddress = (PLONG)((PVOID)0);
29 BadByte = (PCHAR)((PVOID)0);
30 BadByte += 1;
31 BlackHole = &Counter;
32
33 Counter = 0;
34
35 try {
36 AccessViolation(BlackHole, BadAddress);
37 }
39 /*
40 * exception handler should gete executed
41 * setting Counter to 1
42 */
43 {
44 Counter += 1;
45 try {
47 }
49 /* exception handler should get executed */
50 {
51 if (Counter != 1) {
52 printf("TEST 13 FAILED. Counter = %d\n\r", Counter);
53 return -1;
54 }
55 /* set's counter to 2 */
56 Counter += 1;
57 }
58 endtry
59 }
60 endtry
61
62 if (Counter != 2) {
63 printf("TEST 13 FAILED. Counter= %d\n\r", Counter);
64 return -1;
65 }
66
67 return 0;
68}
#define except(x)
Definition: btrfs_drv.h:136
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define PCHAR
Definition: match.c:90
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
long LONG
Definition: pedump.c:60
void rtlRaiseException(DWORD Status)
Definition: seh0013.c:11
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition: seh0013.c:16
char test[]
Definition: seh0013.c:9
int main()
Definition: seh0013.c:21
#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
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51