//
// __acrt_GetModuleFileNameA from 0x180139218 to 0x180139336 (286 bytes)
//
// 2 xrefs:
// > _configure_narrow_argv @ 0x180131d01
// > ??> @ 0x1802037a0
//
// 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 __fastcall _acrt_GetModuleFileNameA(HMODULE a1, __int64 a2, unsigned int a3)
{
__int64 v3; // rdi
DWORD LastError; // eax
int v7; // r8d
_QWORD v8[3]; // [rsp+20h] [rbp-E0h] BYREF
char v9; // [rsp+38h] [rbp-C8h]
_QWORD v10[4]; // [rsp+40h] [rbp-C0h] BYREF
__int64 v11; // [rsp+60h] [rbp-A0h]
char v12; // [rsp+68h] [rbp-98h]
WCHAR Filename[264]; // [rsp+70h] [rbp-90h] BYREF
v3 = a3;
if ( GetModuleFileNameW(a1, Filename, 0x105u) )
{
v11 = 0;
v10[0] = a2;
v10[1] = v3;
v10[3] = v3;
v10[2] = a2;
v12 = 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_wcs_to_mbs_cp<__crt_win32_buffer_no_resizing>(Filename, (__int64)v10, v7);
return (unsigned int)v11;
}
else
{
LastError = GetLastError();
_acrt_errno_map_os_error(LastError);
return 0;
}
}