// // FindHandler<__FrameHandler3> from 0x180125d18 to 0x1801261dd (1221 bytes) // // 2 xrefs: // > __InternalCxxFrameHandler<__FrameHandler3> @ 0x180126744 // > @ 0x1802028d0 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // __int64 __fastcall FindHandler<__FrameHandler3>( struct EHExceptionRecord *a1, unsigned __int64 *a2, struct _CONTEXT *a3, struct _xDISPATCHER_CONTEXT *a4, struct _s_FuncInfo *a5, char a6, int a7, __int64 a8) { unsigned __int64 *v8; // r12 __ehstate_t HandlerSearchState; // eax __int64 dispESTypeList; // rcx int v13; // r14d __int64 result; // rax __int64 v15; // rcx __int64 v16; // rcx __int64 v17; // rcx const struct _s_ESTypeList *v18; // r15 __int64 v19; // rcx unsigned int v20; // r13d __int64 v21; // r9 unsigned int v22; // r12d __int64 v23; // rax __int64 v24; // r8 __m128i v25; // xmm0 __int64 v26; // rdx unsigned __int64 v27; // r15 __int64 ThrowImageBase; // rax ThrowInfo *pThrowInfo; // rcx __int64 v30; // rax ThrowInfo *v31; // r8 __int64 ImageBase; // rax const struct _s_ESTypeList *v33; // rdx unsigned __int64 *EstablisherFrame; // rax __int64 v35; // rcx int v36; // [rsp+50h] [rbp-B0h] char v37; // [rsp+60h] [rbp-A0h] int v38; // [rsp+64h] [rbp-9Ch] int *v40; // [rsp+70h] [rbp-90h] __int64 v41; // [rsp+78h] [rbp-88h] unsigned __int64 v43; // [rsp+88h] [rbp-78h] BYREF __int64 v44; // [rsp+90h] [rbp-70h] int v45[2]; // [rsp+98h] [rbp-68h] __int64 v46[2]; // [rsp+A0h] [rbp-60h] BYREF int v47; // [rsp+B0h] [rbp-50h] _QWORD v48[2]; // [rsp+B8h] [rbp-48h] BYREF __int128 v49; // [rsp+C8h] [rbp-38h] __int128 v50; // [rsp+D8h] [rbp-28h] BYREF unsigned int v51; // [rsp+F0h] [rbp-10h] struct _s_HandlerType pExceptionObject; // [rsp+F8h] [rbp-8h] BYREF v8 = a2; *(_QWORD *)v45 = a8; v37 = 0; HandlerSearchState = __FrameHandler3::GetHandlerSearchState(a2, a4, a5); v13 = HandlerSearchState; if ( HandlerSearchState < -1 || HandlerSearchState >= a5->maxState ) goto LABEL_53; if ( a1->ExceptionCode == -529697949 && a1->NumberParameters == 4 && a1->params.magicNumber - 429065504 <= 2 && !a1->params.pThrowInfo ) { result = _vcrt_getptd(dispESTypeList); if ( !*(_QWORD *)(result + 32) ) return result; a1 = *(struct EHExceptionRecord **)(_vcrt_getptd(v15) + 32); v37 = 1; a3 = *(struct _CONTEXT **)(_vcrt_getptd(v16) + 40); SetThrowImageBase((__int64)a1->params.pThrowImageBase); if ( a1->ExceptionCode == -529697949 && a1->NumberParameters == 4 && a1->params.magicNumber - 429065504 <= 2 && !a1->params.pThrowInfo ) { goto LABEL_53; } if ( *(_QWORD *)(_vcrt_getptd(v17) + 56) ) { v18 = *(const struct _s_ESTypeList **)(_vcrt_getptd(dispESTypeList) + 56); *(_QWORD *)(_vcrt_getptd(v19) + 56) = 0; if ( !IsInExceptionSpec(a1, v18) ) { if ( Is_bad_exception_allowed(v18) ) { _DestructExceptionObject((__int64)a1); sub_1801267AC(&pExceptionObject); throw (std::bad_exception *)&pExceptionObject; } terminate(); } } } v48[1] = a4->ImageBase; v48[0] = a5; if ( a1->ExceptionCode == -529697949 && a1->NumberParameters == 4 && a1->params.magicNumber - 429065504 <= 2 ) { v20 = 0; if ( a5->nTryBlocks ) { __FrameHandler3::GetRangeOfTrysToCheck(&v50, (__int64)v48, v13, a4, a5); v49 = v50; if ( DWORD2(v50) < v51 ) { v21 = v50; v22 = DWORD2(v49); v41 = v50; do { v23 = *(_QWORD *)(v21 + 8); v24 = *(int *)(*(_QWORD *)v49 + 16LL) + 20LL * v22; v25 = *(__m128i *)(v24 + v23); dispESTypeList = *(int *)(v24 + v23 + 16); v47 = *(_DWORD *)(v24 + v23 + 16); *(__m128i *)v46 = v25; if ( _mm_cvtsi128_si32(v25) <= v13 && v13 <= SHIDWORD(v46[0]) ) { v26 = a4->ImageBase + dispESTypeList; v27 = HIDWORD(v46[1]); v44 = v26; if ( HIDWORD(v46[1]) ) { while ( 1 ) { pExceptionObject = *(struct _s_HandlerType *)(v26 + 20LL * v20); ThrowImageBase = GetThrowImageBase(5LL * v20); pThrowInfo = a1->params.pThrowInfo; v40 = (int *)(pThrowInfo->pCatchableTypeArray + ThrowImageBase + 4); dispESTypeList = *(unsigned int *)(GetThrowImageBase((__int64)pThrowInfo) + pThrowInfo->pCatchableTypeArray); v38 = dispESTypeList; if ( (int)dispESTypeList > 0 ) break; LABEL_28: if ( ++v20 == (_DWORD)v27 ) goto LABEL_31; v26 = v44; } while ( 1 ) { v30 = GetThrowImageBase(dispESTypeList); v31 = a1->params.pThrowInfo; v43 = *v40 + v30; if ( (unsigned int)TypeMatchHelper<__FrameHandler3>(&pExceptionObject, v43, v31) ) break; ++v40; if ( --v38 <= 0 ) goto LABEL_28; } LOBYTE(v36) = v37; CatchIt<__FrameHandler3>(a1, a2, a3, a4, a5, &pExceptionObject, v43, (int *)v46, a7, v45[0], v36, a6); LABEL_31: v21 = v41; } v20 = 0; } ++v22; } while ( v22 < v51 ); v8 = a2; } } if ( (*(_DWORD *)a5 & 0x1FFFFFFFu) >= 0x19930521 ) { if ( a5->dispESTypeList && (ImageBase = GetImageBase(dispESTypeList), dispESTypeList = a5->dispESTypeList, dispESTypeList + ImageBase) || (a5->EHFlags & 4) != 0 && !__FrameHandler3::ExecutionInCatch(a4, a5) ) { if ( (a5->EHFlags & 4) != 0 ) { *(_QWORD *)(_vcrt_getptd(dispESTypeList) + 32) = a1; *(_QWORD *)(_vcrt_getptd(v35) + 40) = a3; terminate(); } if ( a5->dispESTypeList ) v33 = (const struct _s_ESTypeList *)(a5->dispESTypeList + GetImageBase(dispESTypeList)); else v33 = nullptr; if ( !IsInExceptionSpec(a1, v33) ) { EstablisherFrame = _GetEstablisherFrame(v8, a4, a5, &v43); __FrameHandler3::UnwindNestedFrames( (void **)v8, a1, a3, EstablisherFrame, nullptr, a5, -1, -1, nullptr, a4, a6); } } } } else if ( a5->nTryBlocks ) { if ( a6 ) goto LABEL_53; FindHandlerForForeignException<__FrameHandler3>(a1, a5, v13, a7, a8); } result = _vcrt_getptd(dispESTypeList); if ( *(_QWORD *)(result + 56) ) LABEL_53: abort(); return result; }