//
// tzset_env_copy_to_tzname from 0x18013cc48 to 0x18013cd29 (225 bytes)
//
// 3 xrefs:
// > tzset_from_environment_nolock @ 0x18013ce68
// > tzset_from_environment_nolock @ 0x18013cf74
// > ??> @ 0x180203a40
//
// 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
//
void __fastcall tzset_env_copy_to_tzname(const wchar_t *Source, wchar_t *const Destination, char *const a3, rsize_t a4)
{
int v6; // ebx
UINT v7; // ecx
_QWORD v8[3]; // [rsp+40h] [rbp-28h] BYREF
char v9; // [rsp+58h] [rbp-10h]
v6 = a4;
if ( wcsncpy_s(Destination, 0x40u, Source, a4) )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
_LocaleUpdate::_LocaleUpdate((_LocaleUpdate *)v8, nullptr);
v7 = 65001;
if ( *(_DWORD *)(v8[1] + 12LL) == 65001 )
{
if ( v9 )
*(_DWORD *)(v8[0] + 936LL) &= ~2u;
}
else if ( (unsigned int)_acrt_AreFileApisANSI() )
{
if ( v9 )
*(_DWORD *)(v8[0] + 936LL) &= ~2u;
v7 = 0;
}
else
{
if ( v9 )
*(_DWORD *)(v8[0] + 936LL) &= ~2u;
v7 = 1;
}
_acrt_WideCharToMultiByte(v7, 0, Destination, v6, a3, 63, nullptr, nullptr);
}