{"type": "func", "start": 6443731996, "end": 6443732185, "name": "_close_nolock", "pseudocode": "// \n// _close_nolock from 0x180138c1c to 0x180138cd9 (189 bytes)\n// \n// 2 xrefs:\n// > __crt_seh_guarded_call<int>::operator @ 0x180138b4a\n// > <???> @ 0x180203710\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\n__int64 __fastcall close_nolock(int a1)\n{\n  __int64 v1; // rdi\n  DWORD LastError; // ebx\n  intptr_t osfhandle; // rbx\n  void *v4; // rax\n\n  v1 = a1;\n  if ( get_osfhandle(a1) == -1\n    || ((_DWORD)v1 == 1 && (*(_BYTE *)(qword_1801F5160[0] + 200) & 1) != 0\n     || (_DWORD)v1 == 2 && (*(_BYTE *)(qword_1801F5160[0] + 128) & 1) != 0)\n    && (osfhandle = get_osfhandle(2), get_osfhandle(1) == osfhandle)\n    || (v4 = (void *)get_osfhandle(v1), CloseHandle(v4)) )\n  {\n    LastError = 0;\n  }\n  else\n  {\n    LastError = GetLastError();\n  }\n  free_osfhnd(v1);\n  *(_BYTE *)(qword_1801F5160[v1 >> 6] + 72 * (v1 & 0x3F) + 56) = 0;\n  if ( !LastError )\n    return 0;\n  _acrt_errno_map_os_error(LastError);\n  return 0xFFFFFFFFLL;\n}", "assembly": "; \n; _close_nolock from 0x180138c1c to 0x180138cd9 (189 bytes)\n; \n; 2 xrefs:\n; > __crt_seh_guarded_call<int>::operator @ 0x180138b4a\n; > <???> @ 0x180203710\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\nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x180138c1c\npush    rdi                                                            ; +0x5, 0x180138c21\nsub     rsp, 20h                                                       ; +0x6, 0x180138c22\nmovsxd  rdi, ecx                                                       ; +0xa, 0x180138c26\nmov     ecx, edi; FileHandle                                           ; +0xd, 0x180138c29\ncall    _get_osfhandle                                                 ; +0xf, 0x180138c2b\ncmp     rax, 0FFFFFFFFFFFFFFFFh                                        ; +0x14, 0x180138c30\njnz     short loc_180138C3A                                            ; +0x18, 0x180138c34\nxor     ebx, ebx                                                       ; +0x1a, 0x180138c36\njmp     short loc_180138C94                                            ; +0x1c, 0x180138c38\nmov     rax, cs:qword_1801F5160                                        ; +0x1e, 0x180138c3a\nmov     ecx, 2; FileHandle                                             ; +0x25, 0x180138c41\ncmp     edi, 1                                                         ; +0x2a, 0x180138c46\njnz     short loc_180138C54                                            ; +0x2d, 0x180138c49\ntest    [rax+0C8h], dil                                                ; +0x2f, 0x180138c4b\njnz     short loc_180138C61                                            ; +0x36, 0x180138c52\ncmp     edi, ecx                                                       ; +0x38, 0x180138c54\njnz     short loc_180138C78                                            ; +0x3a, 0x180138c56\ntest    byte ptr [rax+80h], 1                                          ; +0x3c, 0x180138c58\njz      short loc_180138C78                                            ; +0x43, 0x180138c5f\ncall    _get_osfhandle                                                 ; +0x45, 0x180138c61\nmov     ecx, 1; FileHandle                                             ; +0x4a, 0x180138c66\nmov     rbx, rax                                                       ; +0x4f, 0x180138c6b\ncall    _get_osfhandle                                                 ; +0x52, 0x180138c6e\ncmp     rax, rbx                                                       ; +0x57, 0x180138c73\njz      short loc_180138C36                                            ; +0x5a, 0x180138c76\nmov     ecx, edi; FileHandle                                           ; +0x5c, 0x180138c78\ncall    _get_osfhandle                                                 ; +0x5e, 0x180138c7a\nmov     rcx, rax; hObject                                              ; +0x63, 0x180138c7f\ncall    cs:CloseHandle                                                 ; +0x66, 0x180138c82\ntest    eax, eax                                                       ; +0x6c, 0x180138c88\njnz     short loc_180138C36                                            ; +0x6e, 0x180138c8a\ncall    cs:GetLastError                                                ; +0x70, 0x180138c8c\nmov     ebx, eax                                                       ; +0x76, 0x180138c92\nmov     ecx, edi                                                       ; +0x78, 0x180138c94\ncall    _free_osfhnd                                                   ; +0x7a, 0x180138c96\nmov     rdx, rdi                                                       ; +0x7f, 0x180138c9b\nlea     r8, qword_1801F5160                                            ; +0x82, 0x180138c9e\nand     edx, 3Fh                                                       ; +0x89, 0x180138ca5\nmov     rcx, rdi                                                       ; +0x8c, 0x180138ca8\nsar     rcx, 6                                                         ; +0x8f, 0x180138cab\nlea     rdx, [rdx+rdx*8]                                               ; +0x93, 0x180138caf\nmov     rcx, [r8+rcx*8]                                                ; +0x97, 0x180138cb3\nmov     byte ptr [rcx+rdx*8+38h], 0                                    ; +0x9b, 0x180138cb7\ntest    ebx, ebx                                                       ; +0xa0, 0x180138cbc\njz      short loc_180138CCC                                            ; +0xa2, 0x180138cbe\nmov     ecx, ebx                                                       ; +0xa4, 0x180138cc0\ncall    __acrt_errno_map_os_error                                      ; +0xa6, 0x180138cc2\nor      eax, 0FFFFFFFFh                                                ; +0xab, 0x180138cc7\njmp     short loc_180138CCE                                            ; +0xae, 0x180138cca\nxor     eax, eax                                                       ; +0xb0, 0x180138ccc\nmov     rbx, [rsp+28h+arg_0]                                           ; +0xb2, 0x180138cce\nadd     rsp, 20h                                                       ; +0xb7, 0x180138cd3\npop     rdi                                                            ; +0xbb, 0x180138cd7\nretn                                                                   ; +0xbc, 0x180138cd8", "xrefs": ["__crt_seh_guarded_call<int>::operator @ 0x180138b4a", "<???> @ 0x180203710"], "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"}