{"type": "func", "start": 6443744972, "end": 6443745331, "name": "common_getdcwd<wchar_t>", "pseudocode": "// \n// common_getdcwd<wchar_t> from 0x18013becc to 0x18013c033 (359 bytes)\n// \n// 2 xrefs:\n// > sub_18013C0B4 @ 0x18013c0d1\n// > <???> @ 0x18020398c\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_WORD *__fastcall common_getdcwd<wchar_t>(int a1, _WORD *a2, int a3)\n{\n  __int64 v3; // rsi\n  int v5; // ebx\n  __int64 v7; // rbx\n  _WORD *v8; // [rsp+20h] [rbp-40h] BYREF\n  __int64 v9; // [rsp+28h] [rbp-38h]\n  void *Block; // [rsp+30h] [rbp-30h]\n  __int64 v11; // [rsp+38h] [rbp-28h]\n  __int64 v12; // [rsp+40h] [rbp-20h]\n  char v13; // [rsp+48h] [rbp-18h]\n  __int64 FileName; // [rsp+50h] [rbp-10h] BYREF\n\n  v3 = a3;\n  v5 = a1;\n  if ( a3 < 0 )\n    goto LABEL_2;\n  if ( a1 )\n  {\n    if ( !(unsigned int)validdrive() )\n    {\n      *_doserrno() = 15;\n      *errno() = 13;\n      goto LABEL_3;\n    }\n  }\n  else\n  {\n    v5 = getdrive();\n  }\n  if ( v5 )\n  {\n    wcscpy((wchar_t *)&FileName + 1, L\":.\");\n    LOWORD(FileName) = v5 + 64;\n  }\n  else\n  {\n    wcscpy((wchar_t *)&FileName, L\".\");\n  }\n  if ( a2 )\n  {\n    if ( (int)v3 <= 0 )\n    {\nLABEL_2:\n      *errno() = 22;\nLABEL_3:\n      invalid_parameter_noinfo();\n      return nullptr;\n    }\n    *a2 = 0;\n    v9 = v3;\n    v11 = v3;\n    v8 = a2;\n    Block = a2;\n    v12 = 0;\n    v13 = 0;\n    if ( (unsigned int)unknown_libname_66((const WCHAR *)&FileName, (__int64)&v8) )\n      return nullptr;\n    return a2;\n  }\n  else\n  {\n    v8 = nullptr;\n    v9 = 0;\n    v12 = 0;\n    Block = j__malloc_base(2 * v3);\n    if ( Block )\n    {\n      v13 = 1;\n      v11 = v3;\n    }\n    else\n    {\n      v13 = 0;\n      v11 = 0;\n    }\n    if ( (unsigned int)__acrt_get_full_path_name_wide<__crt_win32_buffer_public_dynamic_resizing>(\n                         (LPCWSTR)&FileName,\n                         (__int64)&v8) )\n    {\n      if ( v13 )\n        free(Block);\n      return nullptr;\n    }\n    v7 = __crt_win32_buffer<wchar_t,__crt_win32_buffer_public_dynamic_resizing>::detach((__int64 *)&v8);\n    if ( v13 )\n      free(Block);\n    return (_WORD *)v7;\n  }\n}", "assembly": "; \n; common_getdcwd<wchar_t> from 0x18013becc to 0x18013c033 (359 bytes)\n; \n; 2 xrefs:\n; > sub_18013C0B4 @ 0x18013c0d1\n; > <???> @ 0x18020398c\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\npush    rbp                                                            ; +0x0, 0x18013becc\npush    rbx                                                            ; +0x2, 0x18013bece\npush    rsi                                                            ; +0x3, 0x18013becf\npush    rdi                                                            ; +0x4, 0x18013bed0\npush    r14                                                            ; +0x5, 0x18013bed1\nmov     rbp, rsp                                                       ; +0x7, 0x18013bed3\nsub     rsp, 60h                                                       ; +0xa, 0x18013bed6\nmov     rax, cs:__security_cookie                                      ; +0xe, 0x18013beda\nxor     rax, rsp                                                       ; +0x15, 0x18013bee1\nmov     [rbp+var_8], rax                                               ; +0x18, 0x18013bee4\nxor     r14d, r14d                                                     ; +0x1c, 0x18013bee8\nmovsxd  rsi, r8d                                                       ; +0x1f, 0x18013beeb\nmov     rdi, rdx                                                       ; +0x22, 0x18013beee\nmov     ebx, ecx                                                       ; +0x25, 0x18013bef1\ntest    r8d, r8d                                                       ; +0x27, 0x18013bef3\njns     short loc_18013BF21                                            ; +0x2a, 0x18013bef6\ncall    _errno                                                         ; +0x2c, 0x18013bef8\nmov     dword ptr [rax], 16h                                           ; +0x31, 0x18013befd\ncall    _invalid_parameter_noinfo                                      ; +0x37, 0x18013bf03\nxor     eax, eax                                                       ; +0x3c, 0x18013bf08\nmov     rcx, [rbp+var_8]                                               ; +0x3e, 0x18013bf0a\nxor     rcx, rsp; StackCookie                                          ; +0x42, 0x18013bf0e\ncall    __security_check_cookie                                        ; +0x45, 0x18013bf11\nadd     rsp, 60h                                                       ; +0x4a, 0x18013bf16\npop     r14                                                            ; +0x4e, 0x18013bf1a\npop     rdi                                                            ; +0x50, 0x18013bf1c\npop     rsi                                                            ; +0x51, 0x18013bf1d\npop     rbx                                                            ; +0x52, 0x18013bf1e\npop     rbp                                                            ; +0x53, 0x18013bf1f\nretn                                                                   ; +0x54, 0x18013bf20\ntest    ecx, ecx                                                       ; +0x55, 0x18013bf21\njz      short loc_18013BF46                                            ; +0x57, 0x18013bf23\ncall    _validdrive                                                    ; +0x59, 0x18013bf25\ntest    eax, eax                                                       ; +0x5e, 0x18013bf2a\njnz     short loc_18013BF4D                                            ; +0x60, 0x18013bf2c\ncall    __doserrno                                                     ; +0x62, 0x18013bf2e\nmov     dword ptr [rax], 0Fh                                           ; +0x67, 0x18013bf33\ncall    _errno                                                         ; +0x6d, 0x18013bf39\nmov     dword ptr [rax], 0Dh                                           ; +0x72, 0x18013bf3e\njmp     short loc_18013BF03                                            ; +0x78, 0x18013bf44\ncall    _getdrive                                                      ; +0x7a, 0x18013bf46\nmov     ebx, eax                                                       ; +0x7f, 0x18013bf4b\ntest    ebx, ebx                                                       ; +0x81, 0x18013bf4d\njz      short loc_18013BF67                                            ; +0x83, 0x18013bf4f\nadd     bx, 40h ; '@'                                                  ; +0x85, 0x18013bf51\nmov     dword ptr [rbp+FileName+2], 2E003Ah                            ; +0x89, 0x18013bf55\nmov     [rbp+FileName], bx                                             ; +0x90, 0x18013bf5c\nmov     [rbp+var_A], r14w                                              ; +0x94, 0x18013bf60\njmp     short loc_18013BF6E                                            ; +0x99, 0x18013bf65\nmov     dword ptr [rbp+FileName], 2Eh ; '.'                            ; +0x9b, 0x18013bf67\ntest    rdi, rdi                                                       ; +0xa2, 0x18013bf6e\njnz     short loc_18013BFEF                                            ; +0xa5, 0x18013bf71\nlea     rcx, [rsi+rsi]; Size                                           ; +0xa7, 0x18013bf73\nmov     [rbp+var_40], r14                                              ; +0xab, 0x18013bf77\nmov     [rbp+var_38], r14                                              ; +0xaf, 0x18013bf7b\nmov     [rbp+var_20], r14                                              ; +0xb3, 0x18013bf7f\ncall    j__malloc_base                                                 ; +0xb7, 0x18013bf83\nmov     [rbp+Block], rax                                               ; +0xbc, 0x18013bf88\ntest    rax, rax                                                       ; +0xc0, 0x18013bf8c\njnz     short loc_18013BF9B                                            ; +0xc3, 0x18013bf8f\nmov     [rbp+var_18], r14b                                             ; +0xc5, 0x18013bf91\nmov     [rbp+var_28], r14                                              ; +0xc9, 0x18013bf95\njmp     short loc_18013BFA3                                            ; +0xcd, 0x18013bf99\nmov     [rbp+var_18], 1                                                ; +0xcf, 0x18013bf9b\nmov     [rbp+var_28], rsi                                              ; +0xd3, 0x18013bf9f\nlea     rdx, [rbp+var_40]                                              ; +0xd7, 0x18013bfa3\nlea     rcx, [rbp+FileName]; lpFileName                                ; +0xdb, 0x18013bfa7\ncall    ??$__acrt_get_full_path_name_wide@U__crt_win32_buffer_public_dynamic_resizing@@@@YAHQEB_WAEAV?$__crt_win32_buffer@_WU__crt_win32_buffer_public_dynamic_resizing@@@@@Z ; +0xdf, 0x18013bfab\ntest    eax, eax                                                       ; +0xe4, 0x18013bfb0\njnz     short loc_18013BFD7                                            ; +0xe6, 0x18013bfb2\nlea     rcx, [rbp+var_40]                                              ; +0xe8, 0x18013bfb4\ncall    ?detach@?$__crt_win32_buffer@_WU__crt_win32_buffer_public_dynamic_resizing@@@@QEAAPEA_WXZ ; +0xec, 0x18013bfb8\nmov     rbx, rax                                                       ; +0xf1, 0x18013bfbd\ncmp     [rbp+var_18], r14b                                             ; +0xf4, 0x18013bfc0\njz      short loc_18013BFCF                                            ; +0xf8, 0x18013bfc4\nmov     rcx, [rbp+Block]; Block                                        ; +0xfa, 0x18013bfc6\ncall    free                                                           ; +0xfe, 0x18013bfca\nmov     rax, rbx                                                       ; +0x103, 0x18013bfcf\njmp     loc_18013BF0A                                                  ; +0x106, 0x18013bfd2\ncmp     [rbp+var_18], r14b                                             ; +0x10b, 0x18013bfd7\njz      loc_18013BF08                                                  ; +0x10f, 0x18013bfdb\nmov     rcx, [rbp+Block]; Block                                        ; +0x115, 0x18013bfe1\ncall    free                                                           ; +0x119, 0x18013bfe5\njmp     loc_18013BF08                                                  ; +0x11e, 0x18013bfea\ntest    esi, esi                                                       ; +0x123, 0x18013bfef\njle     loc_18013BEF8                                                  ; +0x125, 0x18013bff1\nmov     rcx, rsi                                                       ; +0x12b, 0x18013bff7\nmov     [rdi], r14w                                                    ; +0x12e, 0x18013bffa\nmov     [rbp+var_38], rcx                                              ; +0x132, 0x18013bffe\nlea     rdx, [rbp+var_40]                                              ; +0x136, 0x18013c002\nmov     [rbp+var_28], rcx                                              ; +0x13a, 0x18013c006\nlea     rcx, [rbp+FileName]                                            ; +0x13e, 0x18013c00a\nmov     [rbp+var_40], rdi                                              ; +0x142, 0x18013c00e\nmov     [rbp+Block], rdi                                               ; +0x146, 0x18013c012\nmov     [rbp+var_20], r14                                              ; +0x14a, 0x18013c016\nmov     [rbp+var_18], r14b                                             ; +0x14e, 0x18013c01a\ncall    unknown_libname_66; Microsoft VisualC 64bit universal runtime  ; +0x152, 0x18013c01e\ntest    eax, eax                                                       ; +0x157, 0x18013c023\njnz     loc_18013BF08                                                  ; +0x159, 0x18013c025\nmov     rax, rdi                                                       ; +0x15f, 0x18013c02b\njmp     loc_18013BF0A                                                  ; +0x162, 0x18013c02e", "xrefs": ["sub_18013C0B4 @ 0x18013c0d1", "<???> @ 0x18020398c"], "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"}