//
// initialize_environment_by_cloning_nolock from 0x1801321ac to 0x18013227d (209 bytes)
//
// 2 xrefs:
// > unknown_libname_64 @ 0x180132392
// > ??> @ 0x180202fa8
//
// 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 initialize_environment_by_cloning_nolock()
{
__int64 *v0; // rdi
__int64 result; // rax
int v2; // eax
int v3; // esi
void *v4; // rax
void *v5; // rbx
v0 = (__int64 *)qword_1801F4D00;
if ( !qword_1801F4D00 )
return 0xFFFFFFFFLL;
while ( 1 )
{
result = *v0;
if ( !*v0 )
break;
v2 = _acrt_WideCharToMultiByte(0, 0, result, -1, 0, 0, 0, 0);
v3 = v2;
if ( !v2 )
return 0xFFFFFFFFLL;
v4 = calloc_base(v2, 1u);
v5 = v4;
if ( !v4 || !(unsigned int)_acrt_WideCharToMultiByte(0, 0, *v0, -1, (_DWORD)v4, v3, 0, 0) )
{
free_base(v5);
return 0xFFFFFFFFLL;
}
common_set_variable_in_environment_nolock(v5);
free_base(nullptr);
++v0;
}
return result;
}