{"type": "func", "start": 6443721328, "end": 6443721445, "name": "_get_osfhandle", "pseudocode": "// \n// _get_osfhandle from 0x180136270 to 0x1801362e5 (117 bytes)\n// \n// 8 xrefs:\n// > _close_nolock @ 0x180138c2b\n// > _close_nolock @ 0x180138c61\n// > _close_nolock @ 0x180138c6e\n// > _close_nolock @ 0x180138c7a\n// > stream_is_at_end_of_file_nolock @ 0x18013f69c\n// > __crt_seh_guarded_call<int>::operator @ 0x18013f90a\n// > common_lseek_nolock<__int64> @ 0x180141fe6\n// > <???> @ 0x1802034e8\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nintptr_t __cdecl get_osfhandle(int FileHandle)\n{\n  __int64 v1; // rax\n  __int64 v2; // rcx\n  __int64 v3; // rax\n\n  if ( FileHandle == -2 )\n  {\n    *_doserrno() = 0;\n    *errno() = 9;\n  }\n  else\n  {\n    if ( FileHandle >= 0 && FileHandle < (unsigned int)dword_1801F5560 )\n    {\n      v1 = FileHandle;\n      v2 = FileHandle & 0x3F;\n      v3 = qword_1801F5160[v1 >> 6];\n      if ( (*(_BYTE *)(v3 + 72 * v2 + 56) & 1) != 0 )\n        return *(_QWORD *)(v3 + 72 * v2 + 40);\n    }\n    *_doserrno() = 0;\n    *errno() = 9;\n    invalid_parameter_noinfo();\n  }\n  return -1;\n}", "assembly": "; \n; _get_osfhandle from 0x180136270 to 0x1801362e5 (117 bytes)\n; \n; 8 xrefs:\n; > _close_nolock @ 0x180138c2b\n; > _close_nolock @ 0x180138c61\n; > _close_nolock @ 0x180138c6e\n; > _close_nolock @ 0x180138c7a\n; > stream_is_at_end_of_file_nolock @ 0x18013f69c\n; > __crt_seh_guarded_call<int>::operator @ 0x18013f90a\n; > common_lseek_nolock<__int64> @ 0x180141fe6\n; > <???> @ 0x1802034e8\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nsub     rsp, 28h                                                       ; +0x0, 0x180136270\ncmp     ecx, 0FFFFFFFEh                                                ; +0x4, 0x180136274\njnz     short loc_18013628E                                            ; +0x7, 0x180136277\ncall    __doserrno                                                     ; +0x9, 0x180136279\nand     dword ptr [rax], 0                                             ; +0xe, 0x18013627e\ncall    _errno                                                         ; +0x11, 0x180136281\nmov     dword ptr [rax], 9                                             ; +0x16, 0x180136286\njmp     short loc_1801362DC                                            ; +0x1c, 0x18013628c\ntest    ecx, ecx                                                       ; +0x1e, 0x18013628e\njs      short loc_1801362C4                                            ; +0x20, 0x180136290\ncmp     ecx, cs:dword_1801F5560                                        ; +0x22, 0x180136292\njnb     short loc_1801362C4                                            ; +0x28, 0x180136298\nmovsxd  rcx, ecx                                                       ; +0x2a, 0x18013629a\nlea     r8, qword_1801F5160                                            ; +0x2d, 0x18013629d\nmov     rax, rcx                                                       ; +0x34, 0x1801362a4\nand     ecx, 3Fh                                                       ; +0x37, 0x1801362a7\nsar     rax, 6                                                         ; +0x3a, 0x1801362aa\nlea     rdx, [rcx+rcx*8]                                               ; +0x3e, 0x1801362ae\nmov     rax, [r8+rax*8]                                                ; +0x42, 0x1801362b2\ntest    byte ptr [rax+rdx*8+38h], 1                                    ; +0x46, 0x1801362b6\njz      short loc_1801362C4                                            ; +0x4b, 0x1801362bb\nmov     rax, [rax+rdx*8+28h]                                           ; +0x4d, 0x1801362bd\njmp     short loc_1801362E0                                            ; +0x52, 0x1801362c2\ncall    __doserrno                                                     ; +0x54, 0x1801362c4\nand     dword ptr [rax], 0                                             ; +0x59, 0x1801362c9\ncall    _errno                                                         ; +0x5c, 0x1801362cc\nmov     dword ptr [rax], 9                                             ; +0x61, 0x1801362d1\ncall    _invalid_parameter_noinfo                                      ; +0x67, 0x1801362d7\nor      rax, 0FFFFFFFFFFFFFFFFh                                        ; +0x6c, 0x1801362dc\nadd     rsp, 28h                                                       ; +0x70, 0x1801362e0\nretn                                                                   ; +0x74, 0x1801362e4", "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<int>::operator @ 0x18013f90a", "common_lseek_nolock<__int64> @ 0x180141fe6", "<???> @ 0x1802034e8"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}