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[] = "SEH0014.c";
9 int perfect;
10 
11 void rtlRaiseExceptin(DWORD Status) {
12   RaiseException(Status, 0, /*no flags*/ 0, 0);
13   return;
14 }
15 
16 int main() {
17   LONG Counter;
18 
19   Counter = 0;
20 
21   try {
22     try {
23       rtlRaiseExceptin(EXCEPTION_ACCESS_VIOLATION);
24     }
25     except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
26     /* handler should get executed setting counter to 1 */
27     {
28       Counter += 1;
29       goto t9; /* executes finally before goto */
30     }
31     endtry
32   }
33   finally
34   /* should set counter to 2 */
35   {
36     Counter += 1;
37   }
38   endtry
39 
40 t9:
41   ;
42 
43   if (Counter != 2) {
44     printf("TEST 14 FAILED. Counter = %d\n\r", Counter);
45     return -1;
46   }
47 
48   return 0;
49 }
50