diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-06-06 18:49:31 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-06-07 11:31:53 +0200 |
commit | 24cf2d6eb49a0c15e056912ce3170c00eee6cc85 (patch) | |
tree | be28461e0fb8b702c0c1d98f81db1e6792a0ec20 | |
parent | manager: install tunnel to depend on Nsi (diff) | |
download | wireguard-windows-24cf2d6eb49a0c15e056912ce3170c00eee6cc85.tar.xz wireguard-windows-24cf2d6eb49a0c15e056912ce3170c00eee6cc85.zip |
conf: tick count is upstream now
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | conf/dnsresolver_windows.go | 3 | ||||
-rw-r--r-- | conf/zsyscall_windows.go | 9 |
2 files changed, 2 insertions, 10 deletions
diff --git a/conf/dnsresolver_windows.go b/conf/dnsresolver_windows.go index 03ec793d..08dc3783 100644 --- a/conf/dnsresolver_windows.go +++ b/conf/dnsresolver_windows.go @@ -17,11 +17,10 @@ import ( ) //sys internetGetConnectedState(flags *uint32, reserved uint32) (connected bool) = wininet.InternetGetConnectedState -//sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 func resolveHostname(name string) (resolvedIPString string, err error) { const maxTries = 10 - systemJustBooted := getTickCount64() <= uint64(time.Minute*4/time.Millisecond) + systemJustBooted := windows.DurationSinceBoot() <= time.Minute*4 for i := 0; i < maxTries; i++ { resolvedIPString, err = resolveHostnameOnce(name) if err == nil { diff --git a/conf/zsyscall_windows.go b/conf/zsyscall_windows.go index bfe54931..d8984bef 100644 --- a/conf/zsyscall_windows.go +++ b/conf/zsyscall_windows.go @@ -38,12 +38,11 @@ func errnoErr(e syscall.Errno) error { var ( modwininet = windows.NewLazySystemDLL("wininet.dll") - modkernel32 = windows.NewLazySystemDLL("kernel32.dll") modole32 = windows.NewLazySystemDLL("ole32.dll") modshell32 = windows.NewLazySystemDLL("shell32.dll") + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") procInternetGetConnectedState = modwininet.NewProc("InternetGetConnectedState") - procGetTickCount64 = modkernel32.NewProc("GetTickCount64") procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath") procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW") @@ -56,12 +55,6 @@ func internetGetConnectedState(flags *uint32, reserved uint32) (connected bool) return } -func getTickCount64() (ms uint64) { - r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) - ms = uint64(r0) - return -} - func coTaskMemFree(pointer uintptr) { syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(pointer), 0, 0) return |