// // sub_BA6138 from 0xba6138 to 0xba67c0 (1672 bytes) // // 2 xrefs: // > sub_BA5740 @ 0xba5780 // > sub_BA5740 @ 0xba5790 // // 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 sub_BA6138(__int64 a1, unsigned __int8 *a2, unsigned __int64 a3, _DWORD *a4) { const void *v5; // x23 __int64 v9; // x26 size_t v10; // x0 size_t v11; // x24 size_t v12; // x22 __int64 v13; // x25 unsigned __int64 v15; // x19 unsigned __int8 *v16; // x21 int v17; // w0 unsigned __int8 *v18; // x20 char *v19; // x22 unsigned __int64 v20; // x19 unsigned __int8 *v21; // x20 unsigned __int64 v22; // x19 unsigned __int8 *v23; // x20 unsigned __int64 v24; // x19 unsigned __int8 *v25; // x23 unsigned __int8 *v26; // x24 size_t v27; // x26 _BYTE *v28; // x20 unsigned __int64 v29; // x19 unsigned __int8 *v30; // x20 int v31; // w0 int v32; // w0 int v33; // w0 unsigned __int8 *v34; // x3 int v35; // w1 int v36; // w0 v5 = (const void *)(a1 + 1720); v9 = *(_QWORD *)a1; v10 = strlen((const char *)(a1 + 1720)); v11 = v10 + 1; v12 = v10; v13 = *(_QWORD *)(v9 + 536); if ( v10 + 1 > a3 || memcmp(v5, a2, v10) || a2[v12] != 32 ) { if ( a3 > 1 && !memcmp("* ", a2, 2u) ) { switch ( *(_DWORD *)(a1 + 1672) ) { case 2: v29 = (unsigned __int64)&a2[a3]; v30 = a2 + 2; if ( v29 <= (unsigned __int64)(a2 + 2) || (unsigned int)a2[2] - 48 > 9 ) goto LABEL_56; while ( ++v30 != (unsigned __int8 *)v29 ) { v33 = *v30; if ( (unsigned int)(v33 - 48) > 9 ) { if ( v33 != 32 ) return 0; ++v30; LABEL_56: if ( v29 < (unsigned __int64)(v30 + 10) || !(unsigned int)sub_B94674(v30, "CAPABILITY", 10) || v30[10] != 32 && (unsigned __int8 *)v29 != v30 + 12 ) { return 0; } goto LABEL_29; } } return 0; case 7: v19 = *(char **)(v13 + 56); v24 = (unsigned __int64)&a2[a3]; v25 = a2 + 2; if ( v19 ) goto LABEL_43; v18 = a2 + 2; if ( v24 <= (unsigned __int64)v25 || (unsigned int)a2[2] - 48 > 9 ) goto LABEL_24; do { if ( ++v18 == (unsigned __int8 *)v24 ) return 0; v36 = *v18; } while ( (unsigned int)(v36 - 48) <= 9 ); if ( v36 != 32 ) return 0; ++v18; LABEL_24: if ( v24 < (unsigned __int64)(v18 + 4) || !(unsigned int)sub_B94674(v18, "LIST", 4) || v18[4] != 32 && (unsigned __int8 *)v24 != v18 + 6 ) { return 0; } v19 = *(char **)(v13 + 56); if ( !v19 ) goto LABEL_29; LABEL_43: v26 = a2 + 2; v27 = strlen(v19); if ( v24 <= (unsigned __int64)v25 || (unsigned int)a2[2] - 48 > 9 ) { v28 = a2 + 2; LABEL_45: if ( v24 >= (unsigned __int64)&v28[v27] ) { if ( (unsigned int)sub_B94674(v28, v19, v27) && (v28[v27] == 32 || (_BYTE *)v24 == &v28[v27 + 2]) ) goto LABEL_29; v19 = *(char **)(v13 + 56); } } else { v34 = a2 + 2; while ( ++v34 != (unsigned __int8 *)v24 ) { v35 = *v34; if ( (unsigned int)(v35 - 48) > 9 ) { if ( v35 == 32 ) { v28 = v34 + 1; goto LABEL_45; } if ( strcmp(v19, "STORE") ) goto LABEL_47; goto LABEL_84; } } } if ( strcmp(v19, "STORE") ) goto LABEL_47; if ( v24 <= (unsigned __int64)v25 || (unsigned int)a2[2] - 48 > 9 ) goto LABEL_88; do LABEL_84: ++v26; while ( v24 > (unsigned __int64)v26 && (unsigned int)*v26 - 48 <= 9 ); if ( (unsigned __int8 *)v24 != v26 && *v26 == 32 ) { ++v26; LABEL_88: if ( v24 >= (unsigned __int64)(v26 + 5) ) { if ( (unsigned int)sub_B94674(v26, "FETCH", 5) && (v26[5] == 32 || (unsigned __int8 *)v24 == v26 + 7) ) goto LABEL_29; v19 = *(char **)(v13 + 56); } } LABEL_47: if ( !strcmp(v19, "SELECT") || !strcmp(v19, "EXAMINE") || !strcmp(v19, "SEARCH") || !strcmp(v19, "EXPUNGE") || !strcmp(v19, "LSUB") || !strcmp(v19, "UID") || !strcmp(v19, "NOOP") ) { goto LABEL_29; } return 0; case 8: goto LABEL_29; case 9: v22 = (unsigned __int64)&a2[a3]; v23 = a2 + 2; if ( v22 <= (unsigned __int64)(a2 + 2) || (unsigned int)a2[2] - 48 > 9 ) goto LABEL_37; while ( ++v23 != (unsigned __int8 *)v22 ) { v31 = *v23; if ( (unsigned int)(v31 - 48) > 9 ) { if ( v31 != 32 ) return 0; ++v23; LABEL_37: if ( v22 < (unsigned __int64)(v23 + 5) || !(unsigned int)sub_B94674(v23, "FETCH", 5) || v23[5] != 32 && (unsigned __int8 *)v22 != v23 + 7 ) { return 0; } goto LABEL_29; } } return 0; case 0xD: v20 = (unsigned __int64)&a2[a3]; v21 = a2 + 2; if ( v20 <= (unsigned __int64)(a2 + 2) || (unsigned int)a2[2] - 48 > 9 ) goto LABEL_31; break; default: return 0; } while ( ++v21 != (unsigned __int8 *)v20 ) { v32 = *v21; if ( (unsigned int)(v32 - 48) > 9 ) { if ( v32 == 32 ) { ++v21; LABEL_31: if ( v20 >= (unsigned __int64)(v21 + 6) && (unsigned int)sub_B94674(v21, "SEARCH", 6) && (v21[6] == 32 || (unsigned __int8 *)v20 == v21 + 8) ) { LABEL_29: *a4 = 42; return 1; } } return 0; } } return 0; } if ( !v13 || *(_QWORD *)(v13 + 56) ) return 0; if ( a3 == 3 ) { if ( *a2 == 43 ) goto LABEL_19; } else if ( a3 <= 1 ) { return 0; } if ( memcmp("+ ", a2, 2u) ) return 0; LABEL_19: v17 = *(_DWORD *)(a1 + 1672); if ( v17 == 5 || v17 == 11 ) { *a4 = 43; return 1; } else { sub_B7B690(v9, "Unexpected continuation response"); *a4 = -1; return 1; } } v15 = a3 - v12 - 1; if ( v15 <= 1 ) { LABEL_97: sub_B7B690(v9, "Bad tagged response"); *a4 = -1; return 1; } v16 = &a2[v11]; if ( !memcmp(v16, "OK", 2u) ) { *a4 = 79; return 1; } if ( memcmp(v16, "NO", 2u) ) { if ( v15 != 2 && !memcmp(v16, "BAD", 3u) ) { *a4 = 66; return 1; } goto LABEL_97; } *a4 = 78; return 1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source