//
// __dcrt_get_wide_environment_from_os from 0x18013ad08 to 0x18013ada7 (159 bytes)
//
// 2 xrefs:
// > common_initialize_environment_nolock @ 0x180131eb9
// > ??> @ 0x1802038c0
//
// 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:55:02 +0000
//
void *_dcrt_get_wide_environment_from_os()
{
LPWCH EnvironmentStringsW; // rax
void *v1; // rsi
LPWCH v2; // rbx
char *v3; // rbp
__int64 v4; // rax
size_t v5; // rbp
void *v6; // rax
void *v7; // rdi
EnvironmentStringsW = GetEnvironmentStringsW();
v1 = nullptr;
v2 = EnvironmentStringsW;
if ( EnvironmentStringsW )
{
v3 = (char *)EnvironmentStringsW;
if ( *EnvironmentStringsW )
{
do
{
v4 = -1;
do
++v4;
while ( *(_WORD *)&v3[2 * v4] );
v3 += 2 * v4 + 2;
}
while ( *(_WORD *)v3 );
}
v5 = 2 * ((v3 - (char *)v2 + 2) >> 1);
v6 = malloc_base(v5);
v7 = v6;
if ( v6 )
{
memmove(v6, v2, v5);
v1 = v7;
}
free_base(nullptr);
FreeEnvironmentStringsW(v2);
}
return v1;
}