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