extern "C" EXCEPTION_DISPOSITION __cdecl _CatchGuardHandler( EHExceptionRecord *pExcept, // Information for this exception CatchGuardRN *pRN, // The special marker frame void *pContext, // Context info (we don't care what's in it) void * // (ignored) ) { #if defined(ENABLE_EHTRACE) EHTracePushLevel(pRN->trace_level); #endif EHTRACE_ENTER_FMT1("pRN = 0x%p", pRN); __asm cld; // Our code-gen assumes this // // Validate our registration record, to secure against hacker attacks. // __security_check_cookie(pRN->RandomCookie ^ (UINT_PTR)pRN); EXCEPTION_DISPOSITION result = __InternalCxxFrameHandler( pExcept, pRN->pRN, pContext, nullptr, pRN->pFuncInfo, pRN->CatchDepth, (EHRegistrationNode*)pRN, FALSE ); EHTRACE_HANDLER_EXIT(result); EHTRACE_RESTORE_LEVEL(true); return result; }
// // __CxxFrameHandler - Real entry point to the runtime // extern "C" _CRTIMP EXCEPTION_DISPOSITION __CxxFrameHandler( EHExceptionRecord *pExcept, // Information for this exception EHRegistrationNode *pFrame, // Dynamic information for this frame void *pContext, // Context info DispatcherContext *pDC // More dynamic info for this frame ) { FuncInfo *pFuncInfo; EXCEPTION_DISPOSITION result; PFRAMEINFO pframeinfo; if (!(IS_UNWINDING(PER_FLAGS(pExcept))) && ((unsigned long)pContext != (unsigned long)GetRTOC()) ) { // we are calling catch from different CFM, re-initialize our globals _pFrameInfoChain =(PFRAMEINFO) pDC->pftinfo->pFrameInfo; _pftinfo->pFrameInfo = pDC->pftinfo->pFrameInfo; cNested = 0; pframeinfo = (PFRAMEINFO)_pftinfo->pFrameInfo; while (pframeinfo) { cNested++; pframeinfo = pframeinfo->pNext; } } pFuncInfo = (FuncInfo*)pDC->FunctionEntry->HandlerData; result = __InternalCxxFrameHandler( pExcept, pFrame, pContext, pDC, pFuncInfo, 0, NULL, FALSE ); return result; }
extern "C" DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSITION __cdecl __CxxFrameHandler( EHExceptionRecord *pExcept, // Information for this exception EHRegistrationNode RN, // Dynamic information for this frame CONTEXT *pContext, // Context info DispatcherContext *pDC // More dynamic info for this frame ) { FuncInfo *pFuncInfo; EXCEPTION_DISPOSITION result; EHRegistrationNode EstablisherFrame = RN; _ImageBase = pDC->ImageBase; _ThrowImageBase = (uintptr_t)pExcept->params.pThrowImageBase; pFuncInfo = (FuncInfo*)(_ImageBase +*(PULONG)pDC->HandlerData); result = __InternalCxxFrameHandler( pExcept, &EstablisherFrame, pContext, pDC, pFuncInfo, 0, nullptr, FALSE ); return result; }
// // __CxxFrameHandler2 - Remove after compiler is updated // extern "C" _VCRTIMP __declspec(naked) DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSITION __cdecl __CxxFrameHandler2( /* EAX=FuncInfo *pFuncInfo, // Static information for this frame */ EHExceptionRecord *pExcept, // Information for this exception EHRegistrationNode *pRN, // Dynamic information for this frame void *pContext, // Context info (we don't care what's in it) DispatcherContext *pDC // More dynamic info for this frame (ignored on Intel) ) { FuncInfo *pFuncInfo; EXCEPTION_DISPOSITION result; __asm { // // Standard function prolog // push ebp mov ebp, esp sub esp, __LOCAL_SIZE push ebx push esi push edi cld // A bit of paranoia -- Our code-gen assumes this // // Save the extra parameter // mov pFuncInfo, eax } EHTRACE_ENTER_FMT1("pRN = 0x%p", pRN); result = __InternalCxxFrameHandler( pExcept, pRN, pContext, pDC, pFuncInfo, 0, nullptr, FALSE ); EHTRACE_HANDLER_EXIT(result); __asm { pop edi pop esi pop ebx mov eax, result mov esp, ebp pop ebp ret 0 } }
// Call the SEH to EH translator. int __cdecl __SehTransFilter( EXCEPTION_POINTERS *ExPtrs, EHExceptionRecord *pExcept, EHRegistrationNode *pRN, CONTEXT *pContext, DispatcherContext *pDC, FuncInfo *pFuncInfo, BOOL *pResult ) { _pForeignExcept = pExcept; _ThrowImageBase = (uintptr_t)((EHExceptionRecord *)ExPtrs->ExceptionRecord)->params.pThrowImageBase; __InternalCxxFrameHandler( (EHExceptionRecord *)ExPtrs->ExceptionRecord, pRN, pContext, pDC, pFuncInfo, 0, nullptr, TRUE ); _pForeignExcept = nullptr; *pResult = TRUE; return EXCEPTION_EXECUTE_HANDLER; }