From: Jason A. Donenfeld Date: Tue, 6 Apr 2021 17:45:10 +0000 (-0600) Subject: winrio: test that IOCP-based RIO is supported X-Git-Tag: 0.0.20210424~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbf97502cfcfcf35e7963e02b4412e46396334a1;p=thirdparty%2Fwireguard-go.git winrio: test that IOCP-based RIO is supported Signed-off-by: Jason A. Donenfeld --- diff --git a/conn/winrio/rio_windows.go b/conn/winrio/rio_windows.go index 2f13ec8..0a07c65 100644 --- a/conn/winrio/rio_windows.go +++ b/conn/winrio/rio_windows.go @@ -118,9 +118,17 @@ func Initialize() bool { if err != nil { return } + // While we should be able to stop here, after getting the function pointers, some anti-virus actually causes // failures in RIOCreateRequestQueue, so keep going to be certain this is supported. - cq, err = CreatePolledCompletionQueue(2) + var iocp windows.Handle + iocp, err = windows.CreateIoCompletionPort(windows.InvalidHandle, 0, 0, 0) + if err != nil { + return + } + defer windows.CloseHandle(iocp) + var overlapped windows.Overlapped + cq, err = CreateIOCPCompletionQueue(2, iocp, 0, &overlapped) if err != nil { return }