From f4903da8eb65fba19b5efdc7cbedaa9dc01bb912 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Mon, 28 Feb 2022 15:13:03 +0100 Subject: [PATCH] More fixes --- src/client/component/auth.cpp | 6 ---- src/client/component/network.cpp | 60 ++------------------------------ 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/src/client/component/auth.cpp b/src/client/component/auth.cpp index 3eb7103b..5ea40d9c 100644 --- a/src/client/component/auth.cpp +++ b/src/client/component/auth.cpp @@ -160,12 +160,6 @@ namespace auth const auto xuid = strtoull(steam_id.data(), nullptr, 16); - if (xuid == auth::get_guid()) - { - network::send(*from, "error", "You are already connected to this server!", '\n'); - return; - } - if (xuid != key.get_hash()) { //MessageBoxA(nullptr, steam_id.data(), std::to_string(key.get_hash()).data(), 0); diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index 4baa57b2..480a187b 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -11,8 +11,6 @@ namespace network { - SOCKET sock; - namespace { @@ -114,7 +112,7 @@ namespace network } address.sin_family = AF_INET; - address.sin_port = ntohs(port); + address.sin_port = ntohs(static_cast(port)); const auto sock = ::socket(AF_INET, SOCK_DGRAM, protocol); @@ -142,7 +140,7 @@ namespace network { sockaddr s = {}; game::NetadrToSockadr(a3, &s); - return sendto(sock, src, size, 0, &s, 16) >= 0; + return sendto(*game::query_socket, src, size, 0, &s, 16) >= 0; } void send(const game::netadr_s& address, const std::string& command, const std::string& data, const char separator) @@ -152,10 +150,6 @@ namespace network packet.push_back(separator); packet.append(data); -#ifdef DEBUG - console::info("[Network] Sending command %s\n", command.data()); -#endif - send_data(address, packet); } @@ -221,53 +215,6 @@ namespace network return dvar; } - utils::hook::detour bind_socket_hook; - - SOCKET bind_socket_stub(const char* net_interface, u_short port, int protocol) - { -#ifdef DEBUG - printf("[Socket] Attempting to create socket\n"); -#endif - - sock = socket(2, 2, protocol); - u_long argp; - char optval; - struct sockaddr name; - - memset(&name, 0, sizeof(name)); - name.sa_family = 2; - - if (sock == -1) - { -#ifdef DEBUG - printf("[Socket] Error creating socket\n"); -#endif - WSAGetLastError(); - return 0; - } - - argp = 1; - optval = 1; - if (ioctlsocket(sock, -2147195266, &argp) == -1 || setsockopt(sock, 0xFFFF, 32, &optval, 4) == -1) - return 0; - - *(WORD*)name.sa_data = ntohs(port); - - if (bind(sock, &name, 16) != -1) - { -#ifdef DEBUG - printf("[Socket] Socket binded!\n"); -#endif - return sock; - } - -#ifdef DEBUG - printf("[Socket] Closing socket\n"); -#endif - closesocket(sock); - return 0; - } - class component final : public component_interface { public: @@ -279,9 +226,6 @@ namespace network return; } - // creating our own variable for socket use - bind_socket_hook.create(0x140512B40, bind_socket_stub); - // redirect dw_sendto to raw socket //utils::hook::jump(0x1404D850A, reinterpret_cast(0x1404D849A)); utils::hook::call(0x140513467, dw_send_to_stub); // H1MP64(1.4)