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[] = "SEH0028.c"; 9 int perfect; 10 11 void addtwo(long First, long Second, long *Place) { 12 RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0); 13 /* not executed due to exception being raised */ 14 *Place = First + Second; 15 return; 16 } 17 18 int main() { 19 LONG Counter; 20 21 Counter = 0; 22 23 try { 24 /* set counter = 1 */ 25 Counter += 1; 26 addtwo(0x7fff0000, 0x10000, &Counter); 27 } 28 except((GetExceptionCode() == (STATUS_INTEGER_OVERFLOW)) ? 1 : 0) 29 /* 1==EXECUTE HANDLER after unwinding */ 30 { 31 /* set counter = 2 */ 32 Counter += 1; 33 } 34 endtry 35 36 if (Counter != 2) { 37 printf("TEST 28 FAILED. Counter = %d\n\r", Counter); 38 return -1; 39 } 40 41 return 0; 42 } 43