//
// __InternalCxxFrameHandler<__FrameHandler3> from 0x180126538 to 0x18012676f (567 bytes)
//
// 3 xrefs:
// > __CxxFrameHandler3 @ 0x18012585c
// > unknown_libname_15 @ 0x180142c26
// > ??> @ 0x1802028f4
//
// 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 __InternalCxxFrameHandler<__FrameHandler3>(
struct EHExceptionRecord *a1,
unsigned __int64 *a2,
struct _CONTEXT *a3,
struct _xDISPATCHER_CONTEXT *a4,
struct _s_FuncInfo *a5,
int a6,
__int64 a7,
unsigned __int8 a8)
{
__int64 v12; // rcx
__int64 v13; // rax
__int64 dispESTypeList; // rcx
bool v15; // zf
__ehstate_t v16; // eax
__ehstate_t pThrowImageBase; // r9d
unsigned __int64 *pExceptionObject; // rcx
__int64 ImageBase; // rax
__int64 (__fastcall *v20)(struct EHExceptionRecord *, unsigned __int64 *, struct _CONTEXT *, struct _xDISPATCHER_CONTEXT *, struct _s_FuncInfo *, int, __int64, _DWORD); // r10
_except_validate_context_record((__int64)a3);
v13 = _vcrt_getptd(v12);
dispESTypeList = 2147483689LL;
if ( *(_DWORD *)(v13 + 64) || a1->ExceptionCode == -529697949 )
goto LABEL_10;
if ( a1->ExceptionCode != -2147483607 )
{
v15 = a1->ExceptionCode == -2147483610;
LABEL_7:
if ( v15 )
goto LABEL_10;
goto LABEL_8;
}
if ( a1->NumberParameters == 15 )
{
v15 = *(_QWORD *)&a1[1].params.magicNumber == 429065504;
goto LABEL_7;
}
LABEL_8:
if ( (*(_DWORD *)a5 & 0x1FFFFFFFu) >= 0x19930522 && (a5->EHFlags & 1) != 0 )
return 1;
LABEL_10:
if ( (a1->ExceptionFlags & 0x66) != 0 )
{
if ( !a5->maxState || a6 )
return 1;
if ( (a1->ExceptionFlags & 0x20) != 0 )
{
if ( a1->ExceptionCode == -2147483610 )
{
v16 = __FrameHandler3::StateFromIp(a5, a4, a4->TargetIp);
if ( v16 >= -1 && v16 < a5->maxState )
{
pThrowImageBase = v16;
pExceptionObject = a2;
LABEL_18:
__FrameHandler3::FrameUnwindToState(pExceptionObject, a4, a5, pThrowImageBase);
return 1;
}
goto LABEL_38;
}
if ( a1->ExceptionCode == -2147483607 )
{
pThrowImageBase = (__ehstate_t)a1->params.pThrowImageBase;
if ( pThrowImageBase >= -1 && pThrowImageBase < a5->maxState )
{
pExceptionObject = (unsigned __int64 *)a1->params.pExceptionObject;
goto LABEL_18;
}
LABEL_38:
abort();
}
}
__FrameHandler3::FrameUnwindToEmptyState(a2, a4, a5);
return 1;
}
if ( a5->nTryBlocks
|| (*(_DWORD *)a5 & 0x1FFFFFFFu) >= 0x19930521
&& a5->dispESTypeList
&& (ImageBase = GetImageBase(2147483689LL), dispESTypeList = a5->dispESTypeList, dispESTypeList + ImageBase)
|| (*(_DWORD *)a5 & 0x1FFFFFFFu) >= 0x19930522 && (a5->EHFlags & 4) != 0 )
{
if ( a1->ExceptionCode == -529697949 && a1->NumberParameters >= 3 && a1->params.magicNumber > 0x19930522 )
{
if ( a1->params.pThrowInfo->pForwardCompat )
{
v20 = (__int64 (__fastcall *)(struct EHExceptionRecord *, unsigned __int64 *, struct _CONTEXT *, struct _xDISPATCHER_CONTEXT *, struct _s_FuncInfo *, int, __int64, _DWORD))(a1->params.pThrowInfo->pForwardCompat + GetThrowImageBase(dispESTypeList));
if ( v20 )
return v20(a1, a2, a3, a4, a5, a6, a7, a8);
}
}
FindHandler<__FrameHandler3>(a1, a2, a3, a4, a5, a8, a6, a7);
}
return 1;
}