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[] = "SEH0010.c"; 9 int perfect; 10 11 void rtlRaiseExcpt(DWORD Status) { 12 RaiseException(Status, 0, /*no flags*/ 0, 0); 13 return; 14 } 15 16 void tfRaiseExcpt(DWORD Status, PLONG Counter) { 17 try { 18 rtlRaiseExcpt(Status); 19 } 20 finally { 21 if (abnormal_termination() != 0) 22 /* 23 * not abnormal termination 24 * counter should eqaul 99 25 */ 26 { 27 *Counter = 99; 28 } else { 29 *Counter = 100; 30 } 31 } 32 endtry 33 return; 34 } 35 36 int main() { 37 LONG Counter; 38 39 Counter = 0; 40 41 try { 42 tfRaiseExcpt(STATUS_ACCESS_VIOLATION, &Counter); 43 } 44 except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0) 45 /* exception raised was 0xC0000005L, and execute handler */ 46 { 47 Counter -= 1; 48 } 49 endtry 50 51 if (Counter != 98) { 52 printf("TEST 10 FAILED. Counter = %d\n\r", Counter); 53 return -1; 54 } 55 56 return 0; 57 } 58