diff options
author | Simon Rozman <simon@rozman.si> | 2019-02-01 13:59:53 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-05 12:59:42 +0100 |
commit | f1d5db6547738a24b660d766d0690bb9642cc1bb (patch) | |
tree | 0f576f51544ad37c36f2f7a878cf6922b4afacf1 /setupapi/setupapi_windows_test.go | |
parent | dce5192d860888e6af3e7fa8a7e4b2c776274e69 (diff) |
Add support for setupapi.SetupDi(Get|Set)DeviceInstallParams()
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'setupapi/setupapi_windows_test.go')
-rw-r--r-- | setupapi/setupapi_windows_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/setupapi/setupapi_windows_test.go b/setupapi/setupapi_windows_test.go index 25e712f..1d3c33d 100644 --- a/setupapi/setupapi_windows_test.go +++ b/setupapi/setupapi_windows_test.go @@ -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()) + } + } +} |