//
// initialize_environment_by_cloning_nolock from 0x180132280 to 0x180132331 (177 bytes)
//
// 2 xrefs:
// > unknown_libname_65 @ 0x1801323ce
// > ??> @ 0x180202fb4
//
// 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
void *v3; // rbx
v0 = (__int64 *)qword_1801F4CF8;
if ( !qword_1801F4CF8 )
return 0xFFFFFFFFLL;
while ( 1 )
{
result = *v0;
if ( !*v0 )
break;
v2 = _acrt_MultiByteToWideChar(0, 0, result);
if ( !v2 )
return 0xFFFFFFFFLL;
v3 = calloc_base(v2, 2u);
if ( !v3 || !(unsigned int)_acrt_MultiByteToWideChar(0, 0, *v0) )
{
free_base(v3);
return 0xFFFFFFFFLL;
}
common_set_variable_in_environment_nolock((wchar_t *)v3);
free_base(nullptr);
++v0;
}
return result;
}