diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-10 16:59:24 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-10 16:59:24 +0200 |
commit | f9dcfccbb7f918d699c0a922f3b8638c366516b4 (patch) | |
tree | 8c5d6c764faa30f19fef24a376e8c9a840be31df /tun/wintun | |
parent | 7e962a9932667f4a161b20aba5ff1c75ab8e578a (diff) |
wintun: fix scope of error object
Diffstat (limited to 'tun/wintun')
-rw-r--r-- | tun/wintun/wintun_windows.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go index fb2cc22..23b09d1 100644 --- a/tun/wintun/wintun_windows.go +++ b/tun/wintun/wintun_windows.go @@ -277,6 +277,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err var wintun *Wintun var rebootRequired bool + var key registry.Key // Install the device. err = devInfoList.CallClassInstaller(setupapi.DIF_INSTALLDEVICE, deviceData) @@ -295,7 +296,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err // keys and values are populated. // Wait for device registry key to emerge and populate. - key, err := registryEx.OpenKeyWait( + key, err = registryEx.OpenKeyWait( registry.LOCAL_MACHINE, fmt.Sprintf("SYSTEM\\CurrentControlSet\\Control\\Class\\%v\\%04d", guid.ToString(&deviceClassNetGUID), deviceData.DevInst), registry.QUERY_VALUE|registryEx.KEY_NOTIFY, @@ -321,7 +322,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err if err == nil { // Wait for network registry key to emerge and populate. - key, err := registryEx.OpenKeyWait( + key, err = registryEx.OpenKeyWait( registry.LOCAL_MACHINE, wintun.GetNetRegKeyName(), registry.QUERY_VALUE|registryEx.KEY_NOTIFY, @@ -334,7 +335,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err if err == nil { // Wait for TCP/IP adapter registry key to emerge and populate. - key, err := registryEx.OpenKeyWait( + key, err = registryEx.OpenKeyWait( registry.LOCAL_MACHINE, wintun.GetTcpipAdapterRegKeyName(), registry.QUERY_VALUE|registryEx.KEY_NOTIFY, waitForRegistryTimeout) @@ -346,7 +347,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err if err == nil { // Wait for TCP/IP interface registry key to emerge. - key, err := registryEx.OpenKeyWait( + key, err = registryEx.OpenKeyWait( registry.LOCAL_MACHINE, wintun.GetTcpipInterfaceRegKeyName(), registry.QUERY_VALUE, waitForRegistryTimeout) @@ -361,7 +362,7 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err if err == nil { // Disable dead gateway detection on our interface. - key, err := registry.OpenKey(registry.LOCAL_MACHINE, wintun.GetTcpipInterfaceRegKeyName(), registry.SET_VALUE) + key, err = registry.OpenKey(registry.LOCAL_MACHINE, wintun.GetTcpipInterfaceRegKeyName(), registry.SET_VALUE) if err != nil { err = errors.New("Error opening interface-specific TCP/IP network registry key: " + err.Error()) } |