voidFuncOStimpy1(){//1. Do any processing here....
__try {//2. Call another functionFuncORen1();//Code here never executes.}__except(/*6. Evaluate filter. */EXCEPTION_EXECUTE_HANDLER){//8. After the unwind, the exception handler executes.MessageBox(...);}//9. Exception handled--continue exection....}voidFuncORen1(){
DWORD dwTemp =0;//3. Do any processing here....
__try {//4. Request permission to access protected data.WaitForSingleObject(g_hSem, INFINITE);//5. Modify the data.//An exception is generated here.
g_dwProtectedData =5/ dwTemp;}
__finally {//7. Global unwind occurs because filter evaluated//to EXCEPTION_EXECUTE_HANDLER//Allow others to use protected data.ReleaseSemaphore(g_hSem,1,NULL);}//Continue processing--never executes.}