wintun: query for NetCfgInstanceId several times
This commit is contained in:
parent
52ec440d79
commit
2fa80c0cb7
|
@ -45,14 +45,25 @@ func MakeWintun(deviceInfoSet setupapi.DevInfo, deviceInfoData *setupapi.DevInfo
|
||||||
}
|
}
|
||||||
defer key.Close()
|
defer key.Close()
|
||||||
|
|
||||||
|
var valueStr string
|
||||||
|
var valueType uint32
|
||||||
|
|
||||||
|
//TODO: Figure out a way to not need to loop like this.
|
||||||
|
for i := 0; i < 30; i++ {
|
||||||
// Read the NetCfgInstanceId value.
|
// Read the NetCfgInstanceId value.
|
||||||
valueStr, valueType, err := key.GetStringValue("NetCfgInstanceId")
|
valueStr, valueType, err = key.GetStringValue("NetCfgInstanceId")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("RegQueryStringValue(\"NetCfgInstanceId\") failed: " + err.Error())
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if valueType != registry.SZ {
|
if valueType != registry.SZ {
|
||||||
return nil, fmt.Errorf("NetCfgInstanceId registry value is not REG_SZ (expected: %v, provided: %v)", registry.SZ, valueType)
|
return nil, fmt.Errorf("NetCfgInstanceId registry value is not REG_SZ (expected: %v, provided: %v)", registry.SZ, valueType)
|
||||||
}
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("RegQueryStringValue(\"NetCfgInstanceId\") failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
// Convert to windows.GUID.
|
// Convert to windows.GUID.
|
||||||
ifid, err := guid.FromString(valueStr)
|
ifid, err := guid.FromString(valueStr)
|
||||||
|
|
Loading…
Reference in a new issue