Add support for setupapi.SetupDi(Get|Set)DeviceInstallParams()

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman
2019-02-01 13:59:53 +01:00
committed by Jason A. Donenfeld
parent dce5192d86
commit f1d5db6547
4 changed files with 227 additions and 0 deletions

View File

@@ -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())
}
}
}