//
// initialize_inherited_file_handles_nolock from 0x180136628 to 0x180136715 (237 bytes)
//
// 2 xrefs:
// > __acrt_initialize_lowio @ 0x180136841
// > ??> @ 0x180203518
//
// 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
//
void __fastcall initialize_inherited_file_handles_nolock()
{
LPBYTE v0; // rsi
__int64 v1; // rdi
HANDLE *v2; // rbx
__int64 v3; // rbp
__int64 v4; // rcx
__int64 v5; // rdx
struct _STARTUPINFOW v6; // [rsp+20h] [rbp-78h] BYREF
GetStartupInfoW(&v6);
if ( v6.cbReserved2 && v6.lpReserved2 )
{
v0 = v6.lpReserved2 + 4;
v1 = 0x2000;
v2 = (HANDLE *)&v6.lpReserved2[*(_DWORD *)v6.lpReserved2 + 4];
if ( *(int *)v6.lpReserved2 < 0x2000 )
v1 = *(unsigned int *)v6.lpReserved2;
_acrt_lowio_ensure_fh_exists(v1);
if ( (int)v1 > dword_1801F5560 )
v1 = (unsigned int)dword_1801F5560;
if ( (_DWORD)v1 )
{
v3 = 0;
do
{
if ( *v2 != (HANDLE)-1LL && *v2 != (HANDLE)-2LL && (*v0 & 1) != 0 && ((*v0 & 8) != 0 || GetFileType(*v2)) )
{
v4 = qword_1801F5160[v3 >> 6];
v5 = 9 * (v3 & 0x3F);
*(_QWORD *)(v4 + 8 * v5 + 40) = *v2;
*(_BYTE *)(v4 + 8 * v5 + 56) = *v0;
}
++v3;
++v0;
++v2;
--v1;
}
while ( v1 );
}
}
}