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[] = "SEH0006.c";
9 int perfect;
10 
11 int main() {
12   LONG Counter;
13 
14   Counter = 0;
15 
16   try {
17     try {
18       Counter += 1;
19       RaiseException(EXCEPTION_INT_OVERFLOW, 0, /* no flags */
20                      0, NULL);
21       // RtlRaiseException(&ExceptionRecord);
22     }
23     finally {
24       if (abnormal_termination() != 0)
25       /*
26        * an exception is not an abnormal termination
27        * therefore thi should get executed
28        */
29       {
30         Counter += 1;
31       }
32     }
33     endtry
34   }
35   except(Counter)
36   /* counter should equal "EXECUTE HANDLER" */
37   {
38     if (Counter == 2)
39     /*
40      * counter should equal two and therefore
41      * execute this code
42      */
43     {
44       Counter += 1;
45     }
46   }
47   endtry
48 
49   if (Counter != 3) {
50     printf("TEST 6 FAILED. Counter = %d\n\r", Counter);
51     return -1;
52   }
53 
54   return 0;
55 }
56