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 <setjmp.h> 7 #include "seh.h" 8 9 char test[] = "SEH0021.c"; 10 int perfect; 11 12 int main() { 13 jmp_buf JumpBuffer; 14 LONG Counter; 15 16 Counter = 0; 17 18 if (_setjmp(JumpBuffer) == 0) { 19 try { 20 /* set counter = 1 */ 21 //(volatile LONG) Counter += 1; 22 *(volatile LONG*)&Counter += 1; 23 } 24 finally { 25 /* set counter = 2 */ 26 //(volatile LONG) Counter += 1; 27 *(volatile LONG*)&Counter += 1; 28 longjmp(JumpBuffer, 1); 29 } 30 endtry 31 } else { 32 /* set counter = 3 */ 33 //(volatile LONG) Counter += 1; 34 *(volatile LONG*)&Counter += 1; 35 } 36 37 if (Counter != 3) { 38 printf("TEST 21 FAILED. Counter = %d\n\r", Counter); 39 return -1; 40 } 41 42 return 0; 43 } 44