Unify certain variable names

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-02-04 11:42:51 +01:00 committed by Jason A. Donenfeld
parent 38c7acd70f
commit e821cdabd2
2 changed files with 10 additions and 12 deletions

View File

@ -104,7 +104,7 @@ func SetupDiGetClassDevsEx(ClassGUID *windows.GUID, Enumerator string, hwndParen
} }
// SetupDiGetDeviceInfoListDetail function retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name. // SetupDiGetDeviceInfoListDetail function retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name.
func SetupDiGetDeviceInfoListDetail(DeviceInfoSet DevInfo) (data *DevInfoListDetailData, err error) { func SetupDiGetDeviceInfoListDetail(DeviceInfoSet DevInfo) (DeviceInfoSetDetailData *DevInfoListDetailData, err error) {
var _data _SP_DEVINFO_LIST_DETAIL_DATA var _data _SP_DEVINFO_LIST_DETAIL_DATA
_data.Size = uint32(unsafe.Sizeof(_data)) _data.Size = uint32(unsafe.Sizeof(_data))
@ -113,12 +113,11 @@ func SetupDiGetDeviceInfoListDetail(DeviceInfoSet DevInfo) (data *DevInfoListDet
return return
} }
data = &DevInfoListDetailData{ return &DevInfoListDetailData{
ClassGUID: _data.ClassGUID, ClassGUID: _data.ClassGUID,
RemoteMachineHandle: _data.RemoteMachineHandle, RemoteMachineHandle: _data.RemoteMachineHandle,
RemoteMachineName: windows.UTF16ToString(_data.RemoteMachineName[:]), RemoteMachineName: windows.UTF16ToString(_data.RemoteMachineName[:]),
} }, nil
return
} }
// SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set. // SetupDiEnumDeviceInfo function returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set.
@ -136,7 +135,7 @@ func SetupDiOpenDevRegKey(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA
} }
// SetupDiGetDeviceInstallParams function retrieves device installation parameters for a device information set or a particular device information element. // SetupDiGetDeviceInstallParams function retrieves device installation parameters for a device information set or a particular device information element.
func SetupDiGetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA) (data *DevInstallParams, err error) { func SetupDiGetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA) (DeviceInstallParams *DevInstallParams, err error) {
var _data _SP_DEVINSTALL_PARAMS var _data _SP_DEVINSTALL_PARAMS
_data.Size = uint32(unsafe.Sizeof(_data)) _data.Size = uint32(unsafe.Sizeof(_data))
@ -145,7 +144,7 @@ func SetupDiGetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEV
return return
} }
data = &DevInstallParams{ return &DevInstallParams{
Flags: _data.Flags, Flags: _data.Flags,
FlagsEx: _data.FlagsEx, FlagsEx: _data.FlagsEx,
hwndParent: _data.hwndParent, hwndParent: _data.hwndParent,
@ -153,8 +152,7 @@ func SetupDiGetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEV
InstallMsgHandlerContext: _data.InstallMsgHandlerContext, InstallMsgHandlerContext: _data.InstallMsgHandlerContext,
FileQueue: _data.FileQueue, FileQueue: _data.FileQueue,
DriverPath: windows.UTF16ToString(_data.DriverPath[:]), DriverPath: windows.UTF16ToString(_data.DriverPath[:]),
} }, nil
return
} }
// SetupDiSetDeviceInstallParams function sets device installation parameters for a device information set or a particular device information element. // SetupDiSetDeviceInstallParams function sets device installation parameters for a device information set or a particular device information element.

View File

@ -21,17 +21,17 @@ func init() {
} }
func TestSetupDiClassNameFromGuidEx(t *testing.T) { func TestSetupDiClassNameFromGuidEx(t *testing.T) {
className, err := SetupDiClassNameFromGuidEx(&deviceClassNetGUID, "") deviceClassNetName, err := SetupDiClassNameFromGuidEx(&deviceClassNetGUID, "")
if err != nil { if err != nil {
t.Errorf("Error calling SetupDiClassNameFromGuidEx: %s", err.Error()) t.Errorf("Error calling SetupDiClassNameFromGuidEx: %s", err.Error())
} else if strings.ToLower(className) != "net" { } else if strings.ToLower(deviceClassNetName) != "net" {
t.Errorf("SetupDiClassNameFromGuidEx(%x) should return \"Net\"", deviceClassNetGUID) t.Errorf("SetupDiClassNameFromGuidEx(%x) should return \"Net\"", deviceClassNetGUID)
} }
className, err = SetupDiClassNameFromGuidEx(&deviceClassNetGUID, computerName) deviceClassNetName, err = SetupDiClassNameFromGuidEx(&deviceClassNetGUID, computerName)
if err != nil { if err != nil {
t.Errorf("Error calling SetupDiClassNameFromGuidEx: %s", err.Error()) t.Errorf("Error calling SetupDiClassNameFromGuidEx: %s", err.Error())
} else if strings.ToLower(className) != "net" { } else if strings.ToLower(deviceClassNetName) != "net" {
t.Errorf("SetupDiClassNameFromGuidEx(%x) should return \"Net\"", deviceClassNetGUID) t.Errorf("SetupDiClassNameFromGuidEx(%x) should return \"Net\"", deviceClassNetGUID)
} }