//
// dllmain_crt_process_detach from 0x180120bf4 to 0x180120c78 (132 bytes)
//
// 4 xrefs:
// > ??> @ 0x180120bf3
// > dllmain_crt_dispatch @ 0x180120ad7
// > dllmain_dispatch @ 0x180120d29
// > ??> @ 0x180202588
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 10:54:52 +0000
//
__int64 __fastcall dllmain_crt_process_detach(__crt_bool a1)
{
char v3; // bl
__int64 v4; // rcx
__int64 v5; // rcx
BOOL v6; // ebx
unsigned int v7; // edx
HINSTANCE v8; // rcx
void *const v9; // r8
if ( dword_1801F4A2C <= 0 )
return 0;
--dword_1801F4A2C;
v3 = _scrt_acquire_startup_lock();
if ( dword_1801F4998 == 2 )
{
_scrt_dllmain_uninitialize_c();
sub_180123D98(v4);
sub_180123E0C(v5);
dword_1801F4998 = 0;
_scrt_release_startup_lock(v3);
v6 = _scrt_uninitialize_crt(a1, 0) != 0;
_scrt_dllmain_uninitialize_critical();
return v6;
}
else
{
_scrt_fastfail(7);
__debugbreak();
return dllmain_dispatch(v8, v7, v9);
}
}