aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/conf
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-06 18:49:31 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-07 11:31:53 +0200
commitf4a8dd20fe35d05053d8c06db8627e4aae8b6fae (patch)
treebe28461e0fb8b702c0c1d98f81db1e6792a0ec20 /conf
parentmanager: install tunnel to depend on Nsi (diff)
downloadwireguard-windows-f4a8dd20fe35d05053d8c06db8627e4aae8b6fae.tar.xz
wireguard-windows-f4a8dd20fe35d05053d8c06db8627e4aae8b6fae.zip
conf: tick count is upstream now
Diffstat (limited to 'conf')
-rw-r--r--conf/dnsresolver_windows.go3
-rw-r--r--conf/zsyscall_windows.go9
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