diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-07 09:27:01 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-07 09:34:38 +0200 |
commit | 0a6708f865fc6e8c89e0fe9ecf75aea4b617b7ec (patch) | |
tree | 54e89b2824e1f936abaa134663117087bbe13576 /conf/zsyscall_windows.go | |
parent | installer: delete config file with custom action (diff) | |
download | wireguard-windows-0a6708f865fc6e8c89e0fe9ecf75aea4b617b7ec.tar.xz wireguard-windows-0a6708f865fc6e8c89e0fe9ecf75aea4b617b7ec.zip |
conf: retry DNS resoluion when no internet present
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'conf/zsyscall_windows.go')
-rw-r--r-- | conf/zsyscall_windows.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/conf/zsyscall_windows.go b/conf/zsyscall_windows.go index 64bec1f4..d8984bef 100644 --- a/conf/zsyscall_windows.go +++ b/conf/zsyscall_windows.go @@ -37,16 +37,24 @@ func errnoErr(e syscall.Errno) error { } var ( + modwininet = windows.NewLazySystemDLL("wininet.dll") modole32 = windows.NewLazySystemDLL("ole32.dll") modshell32 = windows.NewLazySystemDLL("shell32.dll") modkernel32 = windows.NewLazySystemDLL("kernel32.dll") + procInternetGetConnectedState = modwininet.NewProc("InternetGetConnectedState") procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath") procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW") procFindNextChangeNotification = modkernel32.NewProc("FindNextChangeNotification") ) +func internetGetConnectedState(flags *uint32, reserved uint32) (connected bool) { + r0, _, _ := syscall.Syscall(procInternetGetConnectedState.Addr(), 2, uintptr(unsafe.Pointer(flags)), uintptr(reserved), 0) + connected = r0 != 0 + return +} + func coTaskMemFree(pointer uintptr) { syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(pointer), 0, 0) return |