diff --git a/binaries/win64/winws.exe b/binaries/win64/winws.exe index 88b9446..a4466e6 100644 Binary files a/binaries/win64/winws.exe and b/binaries/win64/winws.exe differ diff --git a/binaries/win64/zapret-winws/preset_russia.cmd b/binaries/win64/zapret-winws/preset_russia.cmd index 37bc355..9d0758d 100644 --- a/binaries/win64/zapret-winws/preset_russia.cmd +++ b/binaries/win64/zapret-winws/preset_russia.cmd @@ -1,3 +1,2 @@ start "zapret: http,https" "%~dp0winws.exe" --wf-tcp=80,443 --dpi-desync=fake,disorder2 --dpi-desync-autottl=2 --dpi-desync-fooling=md5sig -timeout /t 1 start "zapret: quic" "%~dp0winws.exe" --wf-udp=443 --dpi-desync=fake --dpi-desync-repeats=11 \ No newline at end of file diff --git a/binaries/win64/zapret-winws/preset_russia_autohostlist.cmd b/binaries/win64/zapret-winws/preset_russia_autohostlist.cmd index 57024fd..1b9d455 100644 --- a/binaries/win64/zapret-winws/preset_russia_autohostlist.cmd +++ b/binaries/win64/zapret-winws/preset_russia_autohostlist.cmd @@ -1,3 +1,2 @@ start "zapret: http,https,autohostlist" "%~dp0winws.exe" --wf-tcp=80,443 --dpi-desync=fake,disorder2 --dpi-desync-autottl=2 --dpi-desync-fooling=md5sig --hostlist-auto="%~dp0autohostlist.txt" -timeout /t 1 start "zapret: quic,autohostlist" "%~dp0winws.exe" --wf-udp=443 --dpi-desync=fake --dpi-desync-repeats=10 --hostlist-auto="%~dp0autohostlist.txt" \ No newline at end of file diff --git a/binaries/win64/zapret-winws/winws.exe b/binaries/win64/zapret-winws/winws.exe index 88b9446..a4466e6 100644 Binary files a/binaries/win64/zapret-winws/winws.exe and b/binaries/win64/zapret-winws/winws.exe differ diff --git a/nfq/darkmagic.c b/nfq/darkmagic.c index ea1f5f5..877f902 100644 --- a/nfq/darkmagic.c +++ b/nfq/darkmagic.c @@ -959,19 +959,29 @@ void tcp_rewrite_winsize(struct tcphdr *tcp, uint16_t winsize, uint8_t scale_fac static HANDLE w_filter = NULL; static OVERLAPPED ovl = { .hEvent = NULL }; -; static HANDLE windivert_init_filter(const char *filter, UINT64 flags) { LPTSTR errormessage = NULL; DWORD errorcode = 0; - HANDLE h; + HANDLE h, hMutex; + const char *mutex_name = "Global\\winws_windivert_mutex"; + + // windivert driver start in windivert.dll has race conditions + hMutex = CreateMutexA(NULL,TRUE,mutex_name); + if (hMutex && GetLastError()==ERROR_ALREADY_EXISTS) + WaitForSingleObject(hMutex,INFINITE); h = WinDivertOpen(filter, WINDIVERT_LAYER_NETWORK, 0, flags); - if (h != INVALID_HANDLE_VALUE) + + if (hMutex) { - return h; + ReleaseMutex(hMutex); + CloseHandle(hMutex); } + + if (h != INVALID_HANDLE_VALUE) return h; + errorcode = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorcode, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), (LPTSTR)&errormessage, 0, NULL);