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[] = "SEH0045.c";
9 int perfect;
10 
11 int main() {
12   ULONG Index1;
13   ULONG Index2 = 1;
14   LONG Counter;
15 
16   Counter = 0;
17   Index1 = 1;
18 
19   switch (Index2) {
20   case 0:
21     /* never gets here, Index2 is 1 */
22     Counter += 100;
23     break;
24   case 1:
25     try {
26       if ((Index1 & 0x1) == 1) {
27         /* break out of switch stmt */
28         break;
29       } else {
30         Counter += 1;
31       }
32     }
33     finally {
34       /*
35        * set counter to 2 after "break"
36        * in 'case 1'
37        */
38       Counter += 2;
39     }
40     endtry
41     Counter += 3;
42   }
43 
44   if (Counter != 2) {
45     printf("TEST 45 FAILED. Counter = %d\n\r", Counter);
46     return -1;
47   }
48 
49   return 0;
50 }
51