//
// __acrt_wcs_to_mbs_cp<__crt_win32_buffer_no_resizing> from 0x180134a0c to 0x180134b1d (273 bytes)
//
// 2 xrefs:
// > __acrt_GetModuleFileNameA @ 0x180139309
// > ??> @ 0x1802032b4
//
// 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:00 +0000
//
__int64 __fastcall __acrt_wcs_to_mbs_cp<__crt_win32_buffer_no_resizing>(_WORD *a1, __int64 a2, int a3)
{
unsigned int v3; // ebx
int v6; // esi
int v7; // eax
DWORD LastError; // eax
unsigned __int64 v9; // rcx
int v10; // eax
v3 = 0;
v6 = (int)a1;
if ( !a1 )
{
if ( *(_BYTE *)(a2 + 40) )
*(_BYTE *)(a2 + 40) = 0;
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 0;
goto LABEL_5;
}
if ( *a1 )
{
v7 = _acrt_WideCharToMultiByte(a3, 0, (_DWORD)a1, -1, 0, 0, 0, 0);
if ( v7 )
{
v9 = *(_QWORD *)(a2 + 24);
if ( v7 > v9 )
{
if ( *(_BYTE *)(a2 + 40) )
*(_BYTE *)(a2 + 40) = 0;
goto LABEL_10;
}
v10 = _acrt_WideCharToMultiByte(a3, 0, v6, -1, *(_QWORD *)(a2 + 16), v9, 0, 0);
if ( v10 )
{
*(_QWORD *)(a2 + 32) = v10 - 1LL;
return v3;
}
}
LastError = GetLastError();
_acrt_errno_map_os_error(LastError);
return (unsigned int)*errno();
}
if ( !*(_QWORD *)(a2 + 24) )
{
if ( *(_BYTE *)(a2 + 40) )
*(_BYTE *)(a2 + 40) = 0;
LABEL_10:
*errno() = 34;
*(_BYTE *)(a2 + 40) = 0;
*(_QWORD *)(a2 + 24) = 0;
return 34;
}
**(_BYTE **)(a2 + 16) = 0;
LABEL_5:
*(_QWORD *)(a2 + 32) = 0;
return v3;
}