{"type": "func", "start": 6443762272, "end": 6443762507, "name": "_write", "pseudocode": "// \n// _write from 0x180140260 to 0x18014034b (235 bytes)\n// \n// 7 xrefs:\n// > __acrt_stdio_flush_nolock @ 0x1801389d2\n// > write_buffer_nolock<char> @ 0x18013f4f9\n// > write_buffer_nolock<char> @ 0x18013f571\n// > write_buffer_nolock<wchar_t> @ 0x18013f5df\n// > write_buffer_nolock<wchar_t> @ 0x18013f659\n// > <???> @ 0x180203bfc\n// > <???> @ 0x180203c08\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\nint __cdecl write(int FileHandle, const void *Buf, unsigned int MaxCharCount)\n{\n  __int64 v6; // rsi\n  int v7; // edi\n\n  if ( FileHandle == -2 )\n  {\n    *_doserrno() = 0;\n    *errno() = 9;\n    return -1;\n  }\n  if ( FileHandle < 0\n    || FileHandle >= (unsigned int)dword_1801F5560\n    || (v6 = (__int64)FileHandle >> 6, (*(_BYTE *)(qword_1801F5160[v6] + 72LL * (FileHandle & 0x3F) + 56) & 1) == 0) )\n  {\n    *_doserrno() = 0;\n    *errno() = 9;\n    invalid_parameter_noinfo();\n    return -1;\n  }\n  sub_180136164(FileHandle);\n  v7 = -1;\n  if ( (*(_BYTE *)(qword_1801F5160[v6] + 72LL * (FileHandle & 0x3F) + 56) & 1) != 0 )\n  {\n    v7 = write_nolock((unsigned int)FileHandle, Buf, MaxCharCount);\n  }\n  else\n  {\n    *errno() = 9;\n    *_doserrno() = 0;\n  }\n  sub_18013618C(FileHandle);\n  return v7;\n}", "assembly": "; \n; _write from 0x180140260 to 0x18014034b (235 bytes)\n; \n; 7 xrefs:\n; > __acrt_stdio_flush_nolock @ 0x1801389d2\n; > write_buffer_nolock<char> @ 0x18013f4f9\n; > write_buffer_nolock<char> @ 0x18013f571\n; > write_buffer_nolock<wchar_t> @ 0x18013f5df\n; > write_buffer_nolock<wchar_t> @ 0x18013f659\n; > <???> @ 0x180203bfc\n; > <???> @ 0x180203c08\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_8], rbx                                               ; +0x0, 0x180140260\nmov     [rsp+arg_10], rsi                                              ; +0x5, 0x180140265\nmov     [rsp+arg_0], ecx                                               ; +0xa, 0x18014026a\npush    rdi                                                            ; +0xe, 0x18014026e\npush    r12                                                            ; +0xf, 0x18014026f\npush    r13                                                            ; +0x11, 0x180140271\npush    r14                                                            ; +0x13, 0x180140273\npush    r15                                                            ; +0x15, 0x180140275\nsub     rsp, 20h                                                       ; +0x17, 0x180140277\nmov     r14d, r8d                                                      ; +0x1b, 0x18014027b\nmov     r15, rdx                                                       ; +0x1e, 0x18014027e\nmovsxd  rbx, ecx                                                       ; +0x21, 0x180140281\ncmp     ebx, 0FFFFFFFEh                                                ; +0x24, 0x180140284\njnz     short loc_1801402A1                                            ; +0x27, 0x180140287\ncall    __doserrno                                                     ; +0x29, 0x180140289\nand     dword ptr [rax], 0                                             ; +0x2e, 0x18014028e\ncall    _errno                                                         ; +0x31, 0x180140291\nmov     dword ptr [rax], 9                                             ; +0x36, 0x180140296\njmp     loc_180140330                                                  ; +0x3c, 0x18014029c\ntest    ecx, ecx                                                       ; +0x41, 0x1801402a1\njs      short loc_180140318                                            ; +0x43, 0x1801402a3\ncmp     ebx, cs:dword_1801F5560                                        ; +0x45, 0x1801402a5\njnb     short loc_180140318                                            ; +0x4b, 0x1801402ab\nmov     rax, rbx                                                       ; +0x4d, 0x1801402ad\nmov     rsi, rbx                                                       ; +0x50, 0x1801402b0\nsar     rsi, 6                                                         ; +0x53, 0x1801402b3\nlea     r13, qword_1801F5160                                           ; +0x57, 0x1801402b7\nand     eax, 3Fh                                                       ; +0x5e, 0x1801402be\nlea     r12, [rax+rax*8]                                               ; +0x61, 0x1801402c1\nmov     rax, [r13+rsi*8+0]                                             ; +0x65, 0x1801402c5\ntest    byte ptr [rax+r12*8+38h], 1                                    ; +0x6a, 0x1801402ca\njz      short loc_180140318                                            ; +0x70, 0x1801402d0\nmov     ecx, ebx                                                       ; +0x72, 0x1801402d2\ncall    sub_180136164                                                  ; +0x74, 0x1801402d4\nor      edi, 0FFFFFFFFh                                                ; +0x79, 0x1801402d9\nmov     rax, [r13+rsi*8+0]                                             ; +0x7c, 0x1801402dc\ntest    byte ptr [rax+r12*8+38h], 1                                    ; +0x81, 0x1801402e1\njnz     short loc_1801402FE                                            ; +0x87, 0x1801402e7\ncall    _errno                                                         ; +0x89, 0x1801402e9\nmov     dword ptr [rax], 9                                             ; +0x8e, 0x1801402ee\ncall    __doserrno                                                     ; +0x94, 0x1801402f4\nand     dword ptr [rax], 0                                             ; +0x99, 0x1801402f9\njmp     short loc_18014030D                                            ; +0x9c, 0x1801402fc\nmov     r8d, r14d                                                      ; +0x9e, 0x1801402fe\nmov     rdx, r15                                                       ; +0xa1, 0x180140301\nmov     ecx, ebx                                                       ; +0xa4, 0x180140304\ncall    _write_nolock                                                  ; +0xa6, 0x180140306\nmov     edi, eax                                                       ; +0xab, 0x18014030b\nmov     ecx, ebx                                                       ; +0xad, 0x18014030d\ncall    sub_18013618C                                                  ; +0xaf, 0x18014030f\nmov     eax, edi                                                       ; +0xb4, 0x180140314\njmp     short loc_180140333                                            ; +0xb6, 0x180140316\ncall    __doserrno                                                     ; +0xb8, 0x180140318\nand     dword ptr [rax], 0                                             ; +0xbd, 0x18014031d\ncall    _errno                                                         ; +0xc0, 0x180140320\nmov     dword ptr [rax], 9                                             ; +0xc5, 0x180140325\ncall    _invalid_parameter_noinfo                                      ; +0xcb, 0x18014032b\nor      eax, 0FFFFFFFFh                                                ; +0xd0, 0x180140330\nmov     rbx, [rsp+48h+arg_8]                                           ; +0xd3, 0x180140333\nmov     rsi, [rsp+48h+arg_10]                                          ; +0xd8, 0x180140338\nadd     rsp, 20h                                                       ; +0xdd, 0x18014033d\npop     r15                                                            ; +0xe1, 0x180140341\npop     r14                                                            ; +0xe3, 0x180140343\npop     r13                                                            ; +0xe5, 0x180140345\npop     r12                                                            ; +0xe7, 0x180140347\npop     rdi                                                            ; +0xe9, 0x180140349\nretn                                                                   ; +0xea, 0x18014034a", "xrefs": ["__acrt_stdio_flush_nolock @ 0x1801389d2", "write_buffer_nolock<char> @ 0x18013f4f9", "write_buffer_nolock<char> @ 0x18013f571", "write_buffer_nolock<wchar_t> @ 0x18013f5df", "write_buffer_nolock<wchar_t> @ 0x18013f659", "<???> @ 0x180203bfc", "<???> @ 0x180203c08"], "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"}