//
// initialize_stdio_handles_nolock from 0x180136718 to 0x180136824 (268 bytes)
//
// 2 xrefs:
// > __acrt_initialize_lowio @ 0x180136846
// > ??> @ 0x180203524
//
// 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 initialize_stdio_handles_nolock()
{
int v0; // esi
__int64 v1; // r14
__int64 v2; // rcx
__int64 v3; // rbx
__int64 v4; // rdi
DWORD v5; // ecx
HANDLE StdHandle; // rax
HANDLE v7; // rbp
DWORD FileType; // eax
v0 = 0;
v1 = 0;
do
{
v2 = v0 & 0x3F;
v3 = 9 * v2;
v4 = qword_1801F5160[(__int64)v0 >> 6];
if ( *(_QWORD *)(v4 + 72 * v2 + 40) == -2 || *(_QWORD *)(v4 + 72 * v2 + 40) == -1 )
{
*(_BYTE *)(v4 + 72 * v2 + 56) = -127;
if ( v0 )
{
if ( v0 == 1 )
v5 = -11;
else
v5 = -12;
}
else
{
v5 = -10;
}
StdHandle = GetStdHandle(v5);
v7 = StdHandle;
if ( (unsigned __int64)StdHandle + 1 <= 1 )
FileType = 0;
else
FileType = GetFileType(StdHandle);
if ( FileType )
{
*(_QWORD *)(v4 + 8 * v3 + 40) = v7;
if ( (unsigned __int8)FileType == 2 )
{
*(_BYTE *)(v4 + 8 * v3 + 56) |= 0x40u;
}
else if ( (unsigned __int8)FileType == 3 )
{
*(_BYTE *)(v4 + 8 * v3 + 56) |= 8u;
}
}
else
{
*(_BYTE *)(v4 + 8 * v3 + 56) |= 0x40u;
*(_QWORD *)(v4 + 8 * v3 + 40) = -2;
if ( Block )
*(_DWORD *)(*(_QWORD *)((char *)Block + v1) + 24LL) = -2;
}
}
else
{
*(_BYTE *)(v4 + 72 * v2 + 56) |= 0x80u;
}
++v0;
v1 += 8;
}
while ( v0 != 3 );
}