mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-10-06 17:17:02 +08:00
Add support for setupapi.SetupDi(Get|Set)DeviceInstallParams()
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:

committed by
Jason A. Donenfeld

parent
dce5192d86
commit
f1d5db6547
@@ -135,3 +135,27 @@ func TestSetupDiOpenDevRegKey(t *testing.T) {
|
||||
defer key.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetupDiGetDeviceInstallParams(t *testing.T) {
|
||||
devInfoList, err := SetupDiGetClassDevsEx(&deviceClassNetGUID, "", 0, DIGCF_PRESENT, DevInfo(0), "")
|
||||
if err != nil {
|
||||
t.Errorf("Error calling SetupDiGetClassDevsEx: %s", err.Error())
|
||||
}
|
||||
defer devInfoList.Close()
|
||||
|
||||
var data SP_DEVINFO_DATA
|
||||
for i := 0; true; i++ {
|
||||
err := SetupDiEnumDeviceInfo(devInfoList, i, &data)
|
||||
if err != nil {
|
||||
if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ {
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
_, err = SetupDiGetDeviceInstallParams(devInfoList, &data)
|
||||
if err != nil {
|
||||
t.Errorf("Error calling SetupDiOpenDevRegKey: %s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user