1*fe36f081STimo Kreuzer // Copyright (c) Microsoft. All rights reserved.
2*fe36f081STimo Kreuzer // Licensed under the MIT license. See LICENSE file in the project root for
3*fe36f081STimo Kreuzer // full license information.
4*fe36f081STimo Kreuzer 
5*fe36f081STimo Kreuzer #include <windows.h>
6*fe36f081STimo Kreuzer #include "seh.h"
7*fe36f081STimo Kreuzer 
8*fe36f081STimo Kreuzer char test[] = "SEH0016.c";
9*fe36f081STimo Kreuzer 
rtlRaiseExceptin(DWORD Status)10*fe36f081STimo Kreuzer void rtlRaiseExceptin(DWORD Status) {
11*fe36f081STimo Kreuzer   RaiseException(Status, 0, /*no flags*/ 0, 0);
12*fe36f081STimo Kreuzer   return;
13*fe36f081STimo Kreuzer }
14*fe36f081STimo Kreuzer 
main()15*fe36f081STimo Kreuzer int main() {
16*fe36f081STimo Kreuzer   LONG Counter;
17*fe36f081STimo Kreuzer 
18*fe36f081STimo Kreuzer   Counter = 0;
19*fe36f081STimo Kreuzer 
20*fe36f081STimo Kreuzer   try {
21*fe36f081STimo Kreuzer     try {
22*fe36f081STimo Kreuzer       try {
23*fe36f081STimo Kreuzer         /* set counter = 1 and raise exception */
24*fe36f081STimo Kreuzer         Counter += 1;
25*fe36f081STimo Kreuzer         rtlRaiseExceptin(EXCEPTION_INT_OVERFLOW);
26*fe36f081STimo Kreuzer       }
27*fe36f081STimo Kreuzer       except(1) {
28*fe36f081STimo Kreuzer         /* set counter = 2 */
29*fe36f081STimo Kreuzer         Counter += 1;
30*fe36f081STimo Kreuzer         goto t11; /* can't jump into the body of a try/finally */
31*fe36f081STimo Kreuzer       }
32*fe36f081STimo Kreuzer       endtry
33*fe36f081STimo Kreuzer     }
34*fe36f081STimo Kreuzer     finally {
35*fe36f081STimo Kreuzer       /* set counter = 3 */
36*fe36f081STimo Kreuzer       Counter += 1;
37*fe36f081STimo Kreuzer     }
38*fe36f081STimo Kreuzer     endtry
39*fe36f081STimo Kreuzer 
40*fe36f081STimo Kreuzer   t11:
41*fe36f081STimo Kreuzer     ;
42*fe36f081STimo Kreuzer   }
43*fe36f081STimo Kreuzer   finally {
44*fe36f081STimo Kreuzer     /* set counter = 4 */
45*fe36f081STimo Kreuzer     Counter += 1;
46*fe36f081STimo Kreuzer   }
47*fe36f081STimo Kreuzer   endtry
48*fe36f081STimo Kreuzer 
49*fe36f081STimo Kreuzer   if (Counter != 4) {
50*fe36f081STimo Kreuzer     printf("TEST 16 FAILED. Counter = %d\n\r", Counter);
51*fe36f081STimo Kreuzer     return -1;
52*fe36f081STimo Kreuzer   }
53*fe36f081STimo Kreuzer 
54*fe36f081STimo Kreuzer   return 0;
55*fe36f081STimo Kreuzer }
56