ReactOS 0.4.15-dev-8428-g6910fa6
seh0027.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[] = "SEH0027.c";
9
11 RaiseException(Status, 0, /*no flags*/ 0, 0);
12 return;
13}
14
16 PEXCEPTION_RECORD ExceptionRecord;
17
18 ExceptionRecord = ExceptionPointers->ExceptionRecord;
19 if ((ExceptionRecord->ExceptionCode == (STATUS_INTEGER_OVERFLOW)) &&
20 ((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
21 /* set counter = 23 */
22 *Counter += 17;
24 } else if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
25 ((ExceptionRecord->ExceptionFlags & 0x10) != 0)) {
26 /* set counter = 42 */
27 *Counter += 19;
28 /* return COTINUE SEARCH */
29 return 0;
30 }
31 /* never gets here due to exception being rasied */
32 *Counter += 23;
33 return 1;
34}
35
37 try {
38 /* set counter = 6 */
39 *Counter += 5;
40 RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
41 }
43 endtry
44 /* set counter = 59 */
45 *Counter += 9;
46 return;
47}
48
50 PEXCEPTION_RECORD ExceptionRecord;
51
52 ExceptionRecord = ExceptionPointers->ExceptionRecord;
53 if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
54 ((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
55 /* set counter = 53 */
56 *Counter += 11;
57 return 1;
58 } else {
59 *Counter += 13;
60 return 0;
61 }
62}
63
64int main() {
66
67 Counter = 0;
68
69 try {
70 try {
71 /* set counter = 1 */
72 Counter += 1;
74 }
76 /* set counter = 55 */
77 Counter += 2;
78 }
79 endtry
80 }
81 except(1) { Counter += 3; }
82 endtry
83
84 if (Counter != 55) {
85 printf("TEST 27 FAILED. Counter = %d\n\r", Counter);
86 return -1;
87 }
88
89 return 0;
90}
#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_EXECUTE_HANDLER
Definition: excpt.h:85
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
long LONG
Definition: pedump.c:60
ULONG except3(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter)
Definition: seh0027.c:15
void except1(PLONG Counter)
Definition: seh0027.c:36
ULONG except2(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter)
Definition: seh0027.c:49
char test[]
Definition: seh0027.c:8
int main()
Definition: seh0027.c:64
void rtlRaiseStatus(DWORD Status)
Definition: seh0027.c:10
#define endtry
Definition: seh.h:24
#define GetExceptionInformation()
Definition: seh.h:26
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
DWORD ExceptionCode
Definition: compat.h:208
DWORD ExceptionFlags
Definition: compat.h:209
static LARGE_INTEGER Counter
Definition: clock.c:43
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define EXCEPTION_INT_OVERFLOW
Definition: winbase.h:324