//
// _get_osfhandle from 0x180136270 to 0x1801362e5 (117 bytes)
//
// 8 xrefs:
// > _close_nolock @ 0x180138c2b
// > _close_nolock @ 0x180138c61
// > _close_nolock @ 0x180138c6e
// > _close_nolock @ 0x180138c7a
// > stream_is_at_end_of_file_nolock @ 0x18013f69c
// > __crt_seh_guarded_call::operator @ 0x18013f90a
// > common_lseek_nolock<__int64> @ 0x180141fe6
// > ??> @ 0x1802034e8
//
// 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
//
intptr_t __cdecl get_osfhandle(int FileHandle)
{
__int64 v1; // rax
__int64 v2; // rcx
__int64 v3; // rax
if ( FileHandle == -2 )
{
*_doserrno() = 0;
*errno() = 9;
}
else
{
if ( FileHandle >= 0 && FileHandle < (unsigned int)dword_1801F5560 )
{
v1 = FileHandle;
v2 = FileHandle & 0x3F;
v3 = qword_1801F5160[v1 >> 6];
if ( (*(_BYTE *)(v3 + 72 * v2 + 56) & 1) != 0 )
return *(_QWORD *)(v3 + 72 * v2 + 40);
}
*_doserrno() = 0;
*errno() = 9;
invalid_parameter_noinfo();
}
return -1;
}