//
// __acrt_lowio_ensure_fh_exists from 0x1801360bc to 0x180136164 (168 bytes)
//
// 4 xrefs:
// > initialize_inherited_file_handles_nolock @ 0x180136681
// > __acrt_initialize_lowio @ 0x180136838
// > ??> @ 0x1802034c4
// > ??> @ 0x1802034d0
//
// 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_lowio_ensure_fh_exists(unsigned int a1)
{
unsigned int v3; // edi
__int64 v4; // rbx
int v5; // eax
char *handle_array; // rax
if ( a1 < 0x2000 )
{
v3 = 0;
sub_1801346AC(7);
v4 = 0;
v5 = dword_1801F5560;
while ( (int)a1 >= v5 )
{
if ( !qword_1801F5160[v4] )
{
handle_array = _acrt_lowio_create_handle_array();
qword_1801F5160[v4] = (__int64)handle_array;
if ( !handle_array )
{
v3 = 12;
break;
}
v5 = dword_1801F5560 + 64;
dword_1801F5560 += 64;
}
++v4;
}
sub_180134700(7);
return v3;
}
else
{
*errno() = 9;
invalid_parameter_noinfo();
return 9;
}
}