diff options
author | Simon Rozman <simon@rozman.si> | 2019-02-04 11:40:44 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-05 12:59:42 +0100 |
commit | 38c7acd70f408e63a70ff45f01d0a22f2c4ac2c7 (patch) | |
tree | 4a0f705cd834b3445c934db1714537c1ee795322 /setupapi/setupapi_windows_test.go | |
parent | 20f1512b7c5bdc0fc0b7aaf53fa9d6eba8f7d0a6 (diff) |
Simplify SetupDiEnumDeviceInfo() synopsis
The SetupDiEnumDeviceInfo() now returns a SP_DEVINFO_DATA rather than
taking it on input to fill it on return.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'setupapi/setupapi_windows_test.go')
-rw-r--r-- | setupapi/setupapi_windows_test.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/setupapi/setupapi_windows_test.go b/setupapi/setupapi_windows_test.go index 5d84a39..76257ac 100644 --- a/setupapi/setupapi_windows_test.go +++ b/setupapi/setupapi_windows_test.go @@ -146,9 +146,8 @@ func TestSetupDiEnumDeviceInfo(t *testing.T) { } defer devInfoList.Close() - var data SP_DEVINFO_DATA for i := 0; true; i++ { - err := SetupDiEnumDeviceInfo(devInfoList, i, &data) + data, err := SetupDiEnumDeviceInfo(devInfoList, i) if err != nil { if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ { break @@ -169,9 +168,8 @@ func TestSetupDiOpenDevRegKey(t *testing.T) { } defer devInfoList.Close() - var data SP_DEVINFO_DATA for i := 0; true; i++ { - err := SetupDiEnumDeviceInfo(devInfoList, i, &data) + data, err := SetupDiEnumDeviceInfo(devInfoList, i) if err != nil { if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ { break @@ -179,7 +177,7 @@ func TestSetupDiOpenDevRegKey(t *testing.T) { continue } - key, err := SetupDiOpenDevRegKey(devInfoList, &data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, windows.KEY_READ) + key, err := SetupDiOpenDevRegKey(devInfoList, data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, windows.KEY_READ) if err != nil { t.Errorf("Error calling SetupDiOpenDevRegKey: %s", err.Error()) } @@ -194,9 +192,8 @@ func TestSetupDiGetDeviceInstallParams(t *testing.T) { } defer devInfoList.Close() - var data SP_DEVINFO_DATA for i := 0; true; i++ { - err := SetupDiEnumDeviceInfo(devInfoList, i, &data) + data, err := SetupDiEnumDeviceInfo(devInfoList, i) if err != nil { if errWin, ok := err.(syscall.Errno); ok && errWin == 259 /*ERROR_NO_MORE_ITEMS*/ { break @@ -204,7 +201,7 @@ func TestSetupDiGetDeviceInstallParams(t *testing.T) { continue } - _, err = SetupDiGetDeviceInstallParams(devInfoList, &data) + _, err = SetupDiGetDeviceInstallParams(devInfoList, data) if err != nil { t.Errorf("Error calling SetupDiOpenDevRegKey: %s", err.Error()) } |