//
// dllmain_crt_process_detach from 0x18001f9b0 to 0x18001fa30 (128 bytes)
//
// 4 xrefs:
// > ??> @ 0x18001f9af
// > dllmain_crt_dispatch @ 0x18001f893
// > dllmain_dispatch @ 0x18001fae1
// > ??> @ 0x18004b25c
//
// 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 dllmain_crt_process_detach(char a1)
{
char v3; // bl
__int64 v4; // rcx
__int64 v5; // rcx
__int64 v6; // rcx
unsigned int v7; // ebx
unsigned int v8; // edx
HINSTANCE v9; // rcx
void *const v10; // r8
if ( dword_180048038 <= 0 )
return 0;
--dword_180048038;
v3 = _scrt_acquire_startup_lock();
if ( dword_180047FF0 == 2 )
{
_scrt_dllmain_uninitialize_c();
sub_180020158(v4);
sub_1800201CC(v5);
dword_180047FF0 = 0;
_scrt_release_startup_lock(v3);
LOBYTE(v6) = a1;
v7 = (unsigned __int8)_scrt_uninitialize_crt(v6, 0);
_scrt_dllmain_uninitialize_critical();
return v7;
}
else
{
_scrt_fastfail(7);
__debugbreak();
return dllmain_dispatch(v9, v8, v10);
}
}