// // sub_BA2110 from 0xba2110 to 0xba2648 (1336 bytes) // // 1 xrefs: // > @ 0x111c8f0 // // 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_BA2110(__int64 *a1, _BYTE *a2) { __int64 v3; // x2 __int64 v5; // x20 int v6; // w1 __int64 *v7; // x0 __int64 v8; // x23 __int64 result; // x0 int v10; // w1 const char *v11; // x24 int v12; // w0 int v13; // w1 __int64 v14; // x0 size_t v15; // x25 size_t v16; // x24 size_t v17; // x25 __int64 v18; // x3 unsigned __int64 v19; // x27 __int64 v20; // x28 __int64 v21; // x1 size_t v22; // x25 size_t v23; // x2 size_t v24; // x24 unsigned __int64 v25; // x25 __int64 v26; // x28 size_t v27; // x2 void *v28; // x0 unsigned __int64 v29; // x27 char *v30; // x1 size_t v31; // x2 size_t v32; // x24 const void *v33; // x1 int *v34; // x0 const char *v35; // x0 __int64 v36; // x1 char *v37; // x0 char *v38; // [xsp+68h] [xbp+68h] char *v39; // [xsp+70h] [xbp+70h] BYREF char v40[64]; // [xsp+78h] [xbp+78h] BYREF __int64 v41; // [xsp+B8h] [xbp+B8h] v3 = _stack_chk_guard; *a2 = 0; v41 = v3; v5 = a1[195]; if ( !v5 ) { result = sub_BA0ED8(a1, a2); if ( (_DWORD)result ) return result; v5 = a1[195]; result = 44; if ( !v5 ) return result; } v6 = *(_DWORD *)v5; v7 = *(__int64 **)(v5 + 16); *a2 = 0; v8 = *v7; switch ( v6 ) { case 0: if ( *(_BYTE *)(v8 + 1555) ) v11 = "netascii"; else v11 = "octet"; v12 = *(_DWORD *)(v5 + 36); v13 = *(_DWORD *)(v5 + 28) + 1; *(_DWORD *)(v5 + 28) = v13; if ( v13 > v12 ) { *(_DWORD *)(v5 + 8) = -98; *(_DWORD *)v5 = 3; goto LABEL_10; } if ( *(_BYTE *)(v8 + 1569) ) { **(_BYTE **)(v5 + 360) = 0; *(_BYTE *)(*(_QWORD *)(v5 + 360) + 1LL) = 2; v14 = *(_QWORD *)(v5 + 16); v36 = *(_QWORD *)(v8 + 36088); *(_QWORD *)(*(_QWORD *)v14 + 520LL) = *(_QWORD *)(v5 + 360) + 4LL; if ( v36 != -1 ) { sub_B72460(v8, v36); v14 = *(_QWORD *)(v5 + 16); } } else { **(_BYTE **)(v5 + 360) = 0; *(_BYTE *)(*(_QWORD *)(v5 + 360) + 1LL) = 1; v14 = *(_QWORD *)(v5 + 16); } result = sub_B8B660(v8, (char *)(*(_QWORD *)(*(_QWORD *)v14 + 36032LL) + 1LL), 0, &v39, nullptr, 0); if ( (_DWORD)result ) return result; sub_B8C278((_BYTE *)(*(_QWORD *)(v5 + 360) + 2LL), *(int *)(v5 + 340), "%s%c%s%c", v39, 0, v11, 0); v15 = strlen(v39); v16 = strlen(v11) + v15; v17 = v16 + 4; if ( *(_BYTE *)(v8 + 896) ) goto LABEL_66; if ( !*(_BYTE *)(v8 + 1569) || (v18 = *(_QWORD *)(v8 + 36088), v18 == -1) ) strcpy(v40, "0"); else sub_B8C278(v40, 64, "%ld", v18); v19 = *(int *)(v5 + 340); v20 = *(_QWORD *)(v5 + 360); v21 = 0; if ( v16 + 10 <= v19 ) { v21 = 6; strcpy((char *)(v20 + v17), "tsize"); v20 = *(_QWORD *)(v5 + 360); v19 = *(int *)(v5 + 340); } v22 = v21 + v17; v23 = strlen(v40) + 1; v24 = v23 + v22; if ( v23 + v22 <= v19 ) memcpy((void *)(v20 + v22), v40, v23); else v24 = v22; sub_B8C278(v40, 64, "%d", *(_DWORD *)(v5 + 344)); v25 = *(int *)(v5 + 340); v26 = *(_QWORD *)(v5 + 360); if ( v24 + 8 <= v25 ) { strcpy((char *)(v26 + v24), "blksize"); v24 += 8LL; v26 = *(_QWORD *)(v5 + 360); v25 = *(int *)(v5 + 340); } v27 = strlen(v40) + 1; if ( v27 + v24 <= v25 ) { v28 = (void *)(v26 + v24); v24 += v27; memcpy(v28, v40, v27); } sub_B8C278(v40, 64, "%d", *(_DWORD *)(v5 + 32)); v29 = *(int *)(v5 + 340); v30 = *(char **)(v5 + 360); if ( v24 + 8 <= v29 ) { strcpy(&v30[v24], "timeout"); v24 += 8LL; v30 = *(char **)(v5 + 360); v29 = *(int *)(v5 + 340); } v38 = v30; v17 = v24; v31 = strlen(v40) + 1; v32 = v31 + v24; v33 = v38; if ( v32 <= v29 ) { v37 = &v38[v17]; v17 = v32; memcpy(v37, v40, v31); LABEL_66: v33 = *(const void **)(v5 + 360); } if ( sendto( *(_DWORD *)(v5 + 24), v33, v17, 0, *(const struct sockaddr **)(*(_QWORD *)(*(_QWORD *)(v5 + 16) + 96LL) + 32LL), *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(v5 + 16) + 96LL) + 16LL)) != v17 ) { v34 = (int *)__errno(); v35 = (const char *)sub_B9F460(*(_QWORD *)(v5 + 16), *v34); sub_B7B690(v8, "%s", v35); } off_1231008(v39); if ( *(_DWORD *)v5 != 3 ) goto LABEL_9; goto LABEL_10; case 1: sub_B7B690(*v7, "%s", "tftp_rx: internal error"); return 71; case 2: sub_B7B690(*v7, "tftp_tx: internal error, event: %i", 0); goto LABEL_8; case 3: sub_B7B528(*v7, "%s\n", "TFTP finished"); LABEL_8: if ( *(_DWORD *)v5 != 3 ) LABEL_9: sub_BA1AA8(a1, a2); LABEL_10: v10 = *(_DWORD *)(v5 + 8); if ( v10 == -100 ) return 0; if ( v10 == 2 ) return 69; if ( v10 > 2 ) { if ( v10 == 5 ) return 72; if ( v10 > 5 ) { result = 73; if ( v10 != 6 ) { result = 74; if ( v10 != 7 ) return 42; } return result; } result = 70; if ( v10 == 3 ) return result; return 71; } if ( v10 == -98 ) return 7; if ( v10 <= -98 ) { result = 28; if ( v10 != -99 ) return 42; } else { if ( !v10 ) return 71; result = 68; if ( v10 != 1 ) return 42; } return result; default: sub_B7B690(*v7, "%s", "Internal state machine error"); return 71; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source