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[] = "SEH0012.c";
9*fe36f081STimo Kreuzer 
rtlRaiseException(DWORD Status)10*fe36f081STimo Kreuzer void rtlRaiseException(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     rtlRaiseException(EXCEPTION_ACCESS_VIOLATION);
22*fe36f081STimo Kreuzer   }
23*fe36f081STimo Kreuzer   except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
24*fe36f081STimo Kreuzer   /* excpetion handler should get executed */
25*fe36f081STimo Kreuzer   {
26*fe36f081STimo Kreuzer     Counter += 1;
27*fe36f081STimo Kreuzer     try {
28*fe36f081STimo Kreuzer       rtlRaiseException(EXCEPTION_CONTINUE_SEARCH);
29*fe36f081STimo Kreuzer     }
30*fe36f081STimo Kreuzer     except((GetExceptionCode() == EXCEPTION_CONTINUE_SEARCH) ? 1 : 0)
31*fe36f081STimo Kreuzer     /* excpetion handler should get executed */
32*fe36f081STimo Kreuzer     {
33*fe36f081STimo Kreuzer       if (Counter != 1) {
34*fe36f081STimo Kreuzer         printf("TEST 12 FAILED. Counter = %d\n\r", Counter);
35*fe36f081STimo Kreuzer         return -1;
36*fe36f081STimo Kreuzer       }
37*fe36f081STimo Kreuzer       Counter += 1;
38*fe36f081STimo Kreuzer     }
39*fe36f081STimo Kreuzer     endtry
40*fe36f081STimo Kreuzer   }
41*fe36f081STimo Kreuzer   endtry
42*fe36f081STimo Kreuzer 
43*fe36f081STimo Kreuzer   if (Counter != 2) {
44*fe36f081STimo Kreuzer     printf("TEST 12 FAILED. Counter = %d\n\r", Counter);
45*fe36f081STimo Kreuzer     return -1;
46*fe36f081STimo Kreuzer   }
47*fe36f081STimo Kreuzer 
48*fe36f081STimo Kreuzer   return 0;
49*fe36f081STimo Kreuzer }
50