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[] = "SEH0008.c";
9 int perfect;
10 
11 void rtlRaiseStatus(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     Counter += 1;
23     /* raise exception */
24     RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, /*no flags*/ 0, 0);
25   }
26   except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
27   /*
28    * if correct exeception (EXECIUTE HANDLER (1) else
29    * CONTINUE SEARCH (0)).        this test should execute handler
30    */
31   {
32     Counter += 1;
33   }
34   endtry
35 
36   if (Counter != 2) {
37     printf("TEST 8 FAILED. Counter = %d\n\r", Counter);
38     return -1;
39   }
40 
41   return 0;
42 }
43