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[] = "SEH0005.c";
9 
10 int main() {
11   PLONG BadAddress;
12   PLONG BlackHole;
13   LONG Counter;
14 
15   BadAddress = (PLONG)((PVOID)0);
16   BlackHole = &Counter;
17 
18   Counter = 0;
19 
20   try {
21     Counter += 1;
22     *BlackHole += *BadAddress;
23   }
24   except(Counter)
25   /* counter == 1 (EXECUTE HANDLER) */
26   {
27     Counter += 1;
28   }
29   endtry
30 
31   if (Counter != 2) {
32     printf("TEST 5 FAILED. Counter = %d\n\r", Counter);
33     return -1;
34   }
35 
36   return 0;
37 }
38