ReactOS  0.4.15-dev-3439-g2693a26
seh0028.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[] = "SEH0028.c";
9 int perfect;
10 
11 void addtwo(long First, long Second, long *Place) {
12  RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
13  /* not executed due to exception being raised */
14  *Place = First + Second;
15  return;
16 }
17 
18 int main() {
19  LONG Counter;
20 
21  Counter = 0;
22 
23  try {
24  /* set counter = 1 */
25  Counter += 1;
26  addtwo(0x7fff0000, 0x10000, &Counter);
27  }
29  /* 1==EXECUTE HANDLER after unwinding */
30  {
31  /* set counter = 2 */
32  Counter += 1;
33  }
34  endtry
35 
36  if (Counter != 2) {
37  printf("TEST 28 FAILED. Counter = %d\n\r", Counter);
38  return -1;
39  }
40 
41  return 0;
42 }
int main()
Definition: seh0028.c:18
#define endtry
Definition: seh.h:24
WCHAR Second[]
Definition: FormatMessage.c:12
int perfect
Definition: seh0028.c:9
#define EXCEPTION_INT_OVERFLOW
Definition: winbase.h:321
char test[]
Definition: seh0028.c:8
WCHAR First[]
Definition: FormatMessage.c:11
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
long LONG
Definition: pedump.c:60
void addtwo(long First, long Second, long *Place)
Definition: seh0028.c:11
#define except(x)
Definition: btrfs_drv.h:139
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
#define GetExceptionCode()
Definition: seh.h:27
#define printf
Definition: config.h:203