// // _mbtowc_l from 0x18013729c to 0x18013741a (382 bytes) // // 6 xrefs: // > unknown_libname_48 @ 0x18012e42a // > unknown_libname_49 @ 0x18012e4d2 // > unknown_libname_57 @ 0x18012ee90 // > unknown_libname_58 @ 0x18012ef92 // > mbtowc @ 0x18013741f // > @ 0x1802035cc // // 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 // int __cdecl mbtowc_l(wchar_t *DstCh, const char *SrcCh, size_t SrcSizeInBytes, _locale_t Locale) { int v7; // ecx struct __crt_locale_data *locinfo; // rcx int v10; // r9d int v11; // eax int *v12; // rax struct _Mbstatet *v13; // [rsp+20h] [rbp-38h] __int64 v14; // [rsp+30h] [rbp-28h] BYREF __crt_locale_pointers Localea; // [rsp+38h] [rbp-20h] BYREF char v16; // [rsp+48h] [rbp-10h] if ( !SrcCh || !SrcSizeInBytes ) { qword_1801F5568 = 0; return 0; } if ( !*SrcCh ) { if ( DstCh ) *DstCh = 0; return 0; } _LocaleUpdate::_LocaleUpdate((_LocaleUpdate *)&v14, Locale); if ( *((_DWORD *)Localea.locinfo + 3) == 65001 ) { v7 = __crt_mbstring::__mbrtowc_utf8( (__crt_mbstring *)DstCh, (wchar_t *)SrcCh, (const char *)SrcSizeInBytes, (unsigned __int64)&qword_1801F5568, v13); if ( v7 < 0 ) v7 = -1; goto LABEL_14; } if ( !*((_QWORD *)Localea.locinfo + 39) ) { if ( DstCh ) *DstCh = *(unsigned __int8 *)SrcCh; goto LABEL_13; } if ( isleadbyte_l(*(unsigned __int8 *)SrcCh, &Localea) ) { locinfo = Localea.locinfo; v10 = *((_DWORD *)Localea.locinfo + 2); if ( v10 > 1 && (int)SrcSizeInBytes >= v10 && (v11 = _acrt_MultiByteToWideChar(*((_DWORD *)Localea.locinfo + 3), 9, SrcCh, v10, DstCh, DstCh != nullptr), locinfo = Localea.locinfo, v11) || SrcSizeInBytes >= *((int *)locinfo + 2) && SrcCh[1] ) { v7 = *((_DWORD *)locinfo + 2); goto LABEL_14; } LABEL_25: v12 = errno(); v7 = -1; *v12 = 42; goto LABEL_14; } if ( !_acrt_MultiByteToWideChar(*((_DWORD *)Localea.locinfo + 3), 9, SrcCh, 1, DstCh, DstCh != nullptr) ) goto LABEL_25; LABEL_13: v7 = 1; LABEL_14: if ( v16 ) *(_DWORD *)(v14 + 936) &= ~2u; return v7; }