// // _wsetlocale_set_cat from 0x180139dd4 to 0x18013a0e2 (782 bytes) // // 2 xrefs: // > common_expand_argv_wildcards @ 0x180139ac8 // > @ 0x180203824 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // __int64 __fastcall wsetlocale_set_cat(char *a1, unsigned __int8 *a2, _QWORD *a3) { __int64 i; // rbx unsigned __int8 v6; // al unsigned __int8 v8; // r8 unsigned int v9; // edi char v10; // al rsize_t v11; // r13 unsigned int v12; // r8d int v13; // eax const WCHAR *v14; // rcx HANDLE FirstFile; // rbx __int64 v16; // r14 UINT v17; // r8d int v18; // eax void *v19; // r15 char *v20; // rcx char v21; // al __int64 v22; // rdx _QWORD v23[3]; // [rsp+30h] [rbp-D0h] BYREF char v24; // [rsp+48h] [rbp-B8h] _QWORD v25[3]; // [rsp+50h] [rbp-B0h] BYREF char v26; // [rsp+68h] [rbp-98h] _QWORD v27[2]; // [rsp+70h] [rbp-90h] BYREF void *Block; // [rsp+80h] [rbp-80h] __int64 v29; // [rsp+88h] [rbp-78h] __int64 v30; // [rsp+90h] [rbp-70h] char v31; // [rsp+98h] [rbp-68h] _QWORD v32[2]; // [rsp+A0h] [rbp-60h] BYREF void *v33; // [rsp+B0h] [rbp-50h] __int64 v34; // [rsp+B8h] [rbp-48h] __int64 v35; // [rsp+C0h] [rbp-40h] char v36; // [rsp+C8h] [rbp-38h] struct _WIN32_FIND_DATAW FindFileData; // [rsp+D0h] [rbp-30h] BYREF for ( i = 0x200000000801LL; a2 != (unsigned __int8 *)a1; a2 = mbsdec((const unsigned __int8 *)a1, a2) ) { v6 = *a2 - 47; if ( v6 <= 0x2Du && _bittest64(&i, (char)v6) ) break; } if ( *a2 == 58 && a2 != (unsigned __int8 *)(a1 + 1) ) return copy_and_add_argument_to_buffer(a1, nullptr, 0, (__int64)a3); v8 = *a2 - 47; v9 = 0; if ( v8 > 0x2Du || (v10 = 1, !_bittest64(&i, (char)v8)) ) v10 = 0; v32[0] = 0; v32[1] = 0; v33 = nullptr; v34 = 0; v35 = 0; v11 = (a2 - (unsigned __int8 *)a1 + 1) & -(__int64)(v10 != 0); v36 = 0; _LocaleUpdate::_LocaleUpdate((_LocaleUpdate *)v23, nullptr); if ( *(_DWORD *)(v23[1] + 12LL) == 65001 ) { if ( v24 ) *(_DWORD *)(v23[0] + 936LL) &= ~2u; v12 = 65001; } else if ( (unsigned int)_acrt_AreFileApisANSI() ) { if ( v24 ) *(_DWORD *)(v23[0] + 936LL) &= ~2u; v12 = 0; } else { if ( v24 ) *(_DWORD *)(v23[0] + 936LL) &= ~2u; v12 = 1; } v13 = __acrt_mbs_to_wcs_cp<__crt_win32_buffer_internal_dynamic_resizing>(a1, (__int64)v32, v12); v14 = (const WCHAR *)v33; if ( v13 ) v14 = nullptr; FirstFile = FindFirstFileExW(v14, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, nullptr, 0); if ( FirstFile == (HANDLE)-1LL ) { v9 = copy_and_add_argument_to_buffer(a1, nullptr, 0, (__int64)a3); goto LABEL_54; } v16 = (__int64)(a3[1] - *a3) >> 3; while ( 1 ) { v27[0] = 0; v27[1] = 0; Block = nullptr; v29 = 0; v30 = 0; v31 = 0; _LocaleUpdate::_LocaleUpdate((_LocaleUpdate *)v25, nullptr); if ( *(_DWORD *)(v25[1] + 12LL) == 65001 ) { if ( v26 ) *(_DWORD *)(v25[0] + 936LL) &= ~2u; v17 = 65001; } else if ( (unsigned int)_acrt_AreFileApisANSI() ) { if ( v26 ) *(_DWORD *)(v25[0] + 936LL) &= ~2u; v17 = 0; } else { if ( v26 ) *(_DWORD *)(v25[0] + 936LL) &= ~2u; v17 = 1; } v18 = __acrt_wcs_to_mbs_cp<__crt_win32_buffer_internal_dynamic_resizing>(FindFileData.cFileName, (__int64)v27, v17); v19 = Block; v20 = (char *)Block; if ( v18 ) v20 = nullptr; if ( *v20 == 46 ) { v21 = v20[1]; if ( !v21 || v21 == 46 && !v20[2] ) goto LABEL_46; } v9 = copy_and_add_argument_to_buffer(v20, a1, v11, (__int64)a3); if ( v9 ) break; v9 = 0; LABEL_46: if ( v31 ) free_base(v19); if ( !FindNextFileW(FirstFile, &FindFileData) ) { v22 = (__int64)(a3[1] - *a3) >> 3; if ( v16 != v22 ) qsort((void *)(*a3 + 8 * v16), v22 - v16, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)unknown_libname_71); goto LABEL_53; } } if ( v31 ) free_base(v19); LABEL_53: FindClose(FirstFile); LABEL_54: if ( v36 ) free_base(v33); return v9; }