From 2e244fd1b88cbd7c29017b548c7beea27dc0a735 Mon Sep 17 00:00:00 2001 From: ruti <> Date: Sun, 25 Aug 2024 11:28:24 +0300 Subject: [PATCH] Fix --fake on Windows --- desync.c | 14 +++++++------- main.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/desync.c b/desync.c index 552fd16..250cefe 100644 --- a/desync.c +++ b/desync.c @@ -270,13 +270,12 @@ ssize_t send_fake(int sfd, char *buffer, else { pkt = cnt != IS_HTTP ? fake_tls : fake_http; } - size_t psz = pkt.size; if (opt->fake_offset) { - if (psz > opt->fake_offset) { - psz -= opt->fake_offset; + if (pkt.size > opt->fake_offset) { + pkt.size -= opt->fake_offset; pkt.data += opt->fake_offset; } - else psz = 0; + else pkt.size = 0; } char path[MAX_PATH], temp[MAX_PATH + 1]; @@ -306,11 +305,12 @@ ssize_t send_fake(int sfd, char *buffer, uniperror("CreateEvent"); break; } - if (!WriteFile(hfile, pkt.data, psz < pos ? psz : pos, 0, 0)) { + DWORD wrtcnt = 0; + if (!WriteFile(hfile, pkt.data, pkt.size < pos ? pkt.size : pos, &wrtcnt, 0)) { uniperror("WriteFile"); break; } - if (psz < pos) { + if (pkt.size < pos) { if (SetFilePointer(hfile, pos, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) { uniperror("SetFilePointer"); break; @@ -341,7 +341,7 @@ ssize_t send_fake(int sfd, char *buffer, uniperror("SetFilePointer"); break; } - if (!WriteFile(hfile, buffer, pos, 0, 0)) { + if (!WriteFile(hfile, buffer, pos, &wrtcnt, 0)) { uniperror("WriteFile"); break; } diff --git a/main.c b/main.c index 9782ff5..7e95145 100644 --- a/main.c +++ b/main.c @@ -23,7 +23,7 @@ #define close(fd) closesocket(fd) #endif -#define VERSION "13" +#define VERSION "13.1" char ip_option[1] = "\0";