//
// common_end_thread from 0x1801309ec to 0x180130a4d (97 bytes)
//
// 2 xrefs:
// > _endthreadex @ 0x180130b88
// > ??> @ 0x180202e64
//
// 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
//
void __fastcall __noreturn common_end_thread(DWORD dwExitCode)
{
__int64 v2; // rax
__int64 v3; // rbx
char *v4; // rcx
HMODULE v5; // rcx
v2 = _acrt_getptd_noexit();
if ( v2 )
{
v3 = *(_QWORD *)(v2 + 960);
if ( v3 )
{
if ( *(_BYTE *)(v3 + 32) )
_acrt_RoUninitialize();
v4 = *(char **)(v3 + 16);
if ( (unsigned __int64)(v4 - 1) <= 0xFFFFFFFFFFFFFFFDuLL )
CloseHandle(v4);
v5 = *(HMODULE *)(v3 + 24);
if ( (unsigned __int64)v5 - 1 <= 0xFFFFFFFFFFFFFFFDuLL )
FreeLibraryAndExitThread(v5, dwExitCode);
}
}
ExitThread(dwExitCode);
}