// // lws_server_socket_service from 0xbc38e4 to 0xbc3c24 (832 bytes) // // 2 xrefs: // > lws_service_fd @ 0xbbcbe8 // > @ 0xa9368 // // 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 lws_server_socket_service(__int64 a1, __int64 a2, __int64 a3) { unsigned int v6; // w2 unsigned int v7; // w21 int v9; // w0 int v10; // w24 _BYTE *v11; // x0 __int64 v12; // x23 char v13; // w1 char v14; // w2 __int64 v15; // x0 __int64 v16; // x5 void (__fastcall *v17)(__int64, __int64, _QWORD, _QWORD, _QWORD); // x5 __int16 v18; // w0 int *v19; // x0 char *v20; // x0 void *v21; // x22 int no_ssl; // w0 int v23; // w0 socklen_t v24; // [xsp+44h] [xbp+44h] BYREF struct sockaddr v25; // [xsp+48h] [xbp+48h] BYREF switch ( *(_BYTE *)(a2 + 72) ) { case 0: case 1: case 5: v6 = *(_DWORD *)(a2 + 136); if ( v6 ) { if ( (*(_WORD *)(a3 + 6) & 4) != 0 && (sub_BBD488(a2, (char *)(*(_QWORD *)(a2 + 120) + *(unsigned int *)(a2 + 132)), v6) & 0x80000000) != 0 ) { goto LABEL_13; } return 0; } v18 = *(_WORD *)(a3 + 6); if ( (v18 & 1) == 0 ) goto LABEL_15; v21 = (void *)(a1 + 440); no_ssl = lws_ssl_capable_read_no_ssl(a2, v21, 4096); if ( no_ssl == -1 ) goto LABEL_13; if ( !no_ssl ) { if ( (*(_BYTE *)(a2 + 76) & 1) == 0 ) sub_BBDE38(a2); goto LABEL_13; } if ( no_ssl == -2 || *(_BYTE *)(a2 + 73) == 9 ) { v18 = *(_WORD *)(a3 + 6); LABEL_15: if ( (v18 & 4) == 0 ) return 0; if ( (unsigned int)sub_BBD000(a2, 4, 0) ) goto LABEL_13; if ( *(_BYTE *)(a2 + 73) != 1 ) { if ( (sub_BBBC20( *(__int64 (__fastcall **)(__int64, _QWORD, __int64, __int64, __int64))(*(_QWORD *)(a2 + 8) + 8LL), a2, 0x10u, *(_QWORD *)(a2 + 144), 0, 0) & 0x80000000) == 0 ) return 0; goto LABEL_13; } v23 = lws_serve_http_file_fragment(a2); if ( v23 < 0 || v23 && (unsigned int)lws_http_transaction_completed(a2) ) goto LABEL_13; return 0; } return (unsigned int)lws_read(a2, (__int64)v21, no_ssl) >> 31; case 0xF: if ( (*(_WORD *)(a3 + 6) & 1) == 0 ) return 0; v9 = *(_DWORD *)a3; v24 = 16; v10 = accept(v9, &v25, &v24); if ( v10 < 0 ) { v19 = (int *)__errno(); if ( *v19 != 11 ) { v7 = 0; v20 = strerror(*v19); lws_log(2, "ERROR on accept: %s\n", v20); return v7; } return 0; } lws_plat_set_socket_options((_DWORD *)a1, v10); v7 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, _QWORD, _QWORD))(*(_QWORD *)(a1 + 4584) + 8LL))( a2, 17, 0, v10, 0); if ( v7 ) { v7 = 0; close(v10); return v7; } v11 = sub_BBF8A8(0xD8u); v12 = (__int64)v11; if ( !v11 ) { lws_log(1, "Out of memory for new connection\n"); goto LABEL_36; } v13 = v11[76]; v14 = v11[112] & 0xFC | 1; *(_QWORD *)v11 = a1; v11[77] = 0; v11[112] = v14; v11[73] = 0; v11[72] = 0; v11[76] = v13 & 0xFE; if ( (unsigned int)sub_BBDDB0((__int64)v11) ) { sub_BBF88C((void *)v12, 0); LABEL_36: close(v10); return v7; } v15 = *(_QWORD *)(a1 + 4584); *(_BYTE *)(v12 + 66) = 0; v16 = *(_QWORD *)(a1 + 4584); *(_QWORD *)(v12 + 8) = v15; *(_QWORD *)(v12 + 144) = 0; v17 = *(void (__fastcall **)(__int64, __int64, _QWORD, _QWORD, _QWORD))(v16 + 8); *(_DWORD *)(v12 + 88) = -1; v17(v12, 29, 0, 0, 0); *(_DWORD *)(v12 + 88) = v10; lws_set_timeout(v12, 3, 5); (*(void (__fastcall **)(__int64, __int64, _QWORD, _QWORD, _QWORD))(*(_QWORD *)(a1 + 4584) + 8LL))( v12, 19, 0, 0, 0); if ( !(unsigned int)sub_BBCD70(a1, v12) ) return 0; LABEL_13: v7 = 1; sub_BBC0F0(a2, 0); return v7; default: return 0; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source