diff options
-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 |