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