From 03df1a8a16e316f68b6eafb41000dcbdd73643af Mon Sep 17 00:00:00 2001 From: Peacoor Date: Sun, 5 Mar 2023 16:13:58 +0800 Subject: [PATCH] Update fake functions --- 230130-hookgamesendto/src/fkhook.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/230130-hookgamesendto/src/fkhook.cpp b/230130-hookgamesendto/src/fkhook.cpp index 022373c..9c6ba0d 100644 --- a/230130-hookgamesendto/src/fkhook.cpp +++ b/230130-hookgamesendto/src/fkhook.cpp @@ -55,7 +55,6 @@ static const std::vector &enum_addr() // hook后替换的函数 static int WINAPI fake_sendto(SOCKET s, const char *buf, int len, int flags, const sockaddr *to, int tolen) { - // static SockQueue sockqueue; sockaddr_in *toaddr = (sockaddr_in *)to; if (toaddr->sin_addr.S_un.S_addr != INADDR_BROADCAST) { return _sendto(s, buf, len, flags, to, tolen); // 非广播直接原样发送 @@ -78,7 +77,7 @@ static int WINAPI fake_sendto(SOCKET s, const char *buf, int len, int flags, con closesocket(socks[i]); socks.clear(); for (int i = 0; i < list.size(); i++) { - addr_self.sin_addr = list[i]; // 把新的地址换上去,然后发送 + addr_self.sin_addr = list[i]; // 把新的地址换上去,然后绑定 SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0); BOOL opt = TRUE; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&opt, sizeof(BOOL)); // 广播 @@ -109,10 +108,10 @@ static int WINAPI fake_select(int n, fd_set *rd, fd_set *wr, fd_set *ex, const T return fds.fd_count; } fake_sock = 0; - return _select(n, rd, wr, ex, timeout); + rd->fd_count = 0; + return 0; } - else - return _select(n, rd, wr, ex, timeout); + return _select(n, rd, wr, ex, timeout); } static int WINAPI fake_recvfrom(SOCKET s, char *buf, int len, int flags, sockaddr *from, int *fromlen) -- GitLab