diff options
author | Simon Rozman <simon@rozman.si> | 2019-02-07 22:37:14 +0100 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2019-02-07 23:50:43 +0100 |
commit | 9d830826c53d9b8cd14cf0fcd43fdf4183de4c47 (patch) | |
tree | d24f8a43b46f93b236bbf41bf99c2b87e2164ed5 /tun/wintun/setupapi | |
parent | bd963497da908d3910668dab9dab4ac7654a638a (diff) |
setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun/wintun/setupapi')
-rw-r--r-- | tun/wintun/setupapi/setupapi_windows.go | 8 | ||||
-rw-r--r-- | tun/wintun/setupapi/types_windows.go | 14 | ||||
-rw-r--r-- | tun/wintun/setupapi/zsetupapi_windows.go | 4 |
3 files changed, 16 insertions, 10 deletions
diff --git a/tun/wintun/setupapi/setupapi_windows.go b/tun/wintun/setupapi/setupapi_windows.go index ca944f1..0d9e695 100644 --- a/tun/wintun/setupapi/setupapi_windows.go +++ b/tun/wintun/setupapi/setupapi_windows.go @@ -348,10 +348,10 @@ func (deviceInfoSet DevInfo) GetDeviceInstallParams(deviceInfoData *DevInfoData) } // SetupDiGetClassInstallParams function retrieves class installation parameters for a device information set or a particular device information element. -//sys SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *SP_CLASSINSTALL_HEADER, classInstallParamsSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetClassInstallParamsW +//sys SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetClassInstallParamsW // GetClassInstallParams method retrieves class installation parameters for a device information set or a particular device information element. -func (deviceInfoSet DevInfo) GetClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *SP_CLASSINSTALL_HEADER, classInstallParamsSize uint32, requiredSize *uint32) error { +func (deviceInfoSet DevInfo) GetClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) error { return SetupDiGetClassInstallParams(deviceInfoSet, deviceInfoData, classInstallParams, classInstallParamsSize, requiredSize) } @@ -363,10 +363,10 @@ func (deviceInfoSet DevInfo) SetDeviceInstallParams(deviceInfoData *DevInfoData, } // SetupDiSetClassInstallParams function sets or clears class install parameters for a device information set or a particular device information element. -//sys SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *SP_CLASSINSTALL_HEADER, classInstallParamsSize uint32) (err error) = setupapi.SetupDiSetClassInstallParamsW +//sys SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) = setupapi.SetupDiSetClassInstallParamsW // SetClassInstallParams method sets or clears class install parameters for a device information set or a particular device information element. -func (deviceInfoSet DevInfo) SetClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *SP_CLASSINSTALL_HEADER, classInstallParamsSize uint32) error { +func (deviceInfoSet DevInfo) SetClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) error { return SetupDiSetClassInstallParams(deviceInfoSet, deviceInfoData, classInstallParams, classInstallParamsSize) } diff --git a/tun/wintun/setupapi/types_windows.go b/tun/wintun/setupapi/types_windows.go index ae60bd0..7994f3c 100644 --- a/tun/wintun/setupapi/types_windows.go +++ b/tun/wintun/setupapi/types_windows.go @@ -255,12 +255,18 @@ const ( DI_FLAGSEX_SEARCH_PUBLISHED_INFS DI_FLAGSEX = 0x80000000 // Tell SetupDiBuildDriverInfoList to do a "published INF" search ) -// SP_CLASSINSTALL_HEADER is the first member of any class install parameters structure. It contains the device installation request code that defines the format of the rest of the install parameters structure. -type SP_CLASSINSTALL_HEADER struct { - Size uint32 +// ClassInstallHeader is the first member of any class install parameters structure. It contains the device installation request code that defines the format of the rest of the install parameters structure. +type ClassInstallHeader struct { + size uint32 InstallFunction DI_FUNCTION } +func MakeClassInstallHeader(installFunction DI_FUNCTION) *ClassInstallHeader { + hdr := &ClassInstallHeader{InstallFunction: installFunction} + hdr.size = uint32(unsafe.Sizeof(*hdr)) + return hdr +} + // DICS_FLAG specifies the scope of a device property change type DICS_FLAG uint32 @@ -280,7 +286,7 @@ const ( // SP_REMOVEDEVICE_PARAMS is a structure corresponding to a DIF_REMOVE install function. type SP_REMOVEDEVICE_PARAMS struct { - ClassInstallHeader SP_CLASSINSTALL_HEADER + ClassInstallHeader ClassInstallHeader Scope DI_REMOVEDEVICE HwProfile uint32 } diff --git a/tun/wintun/setupapi/zsetupapi_windows.go b/tun/wintun/setupapi/zsetupapi_windows.go index 2e8a685..5789b3e 100644 --- a/tun/wintun/setupapi/zsetupapi_windows.go +++ b/tun/wintun/setupapi/zsetupapi_windows.go @@ -285,7 +285,7 @@ func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf return } -func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *SP_CLASSINSTALL_HEADER, classInstallParamsSize uint32, requiredSize *uint32) (err error) { +func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0) if r1 == 0 { if e1 != 0 { @@ -309,7 +309,7 @@ func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf return } -func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *SP_CLASSINSTALL_HEADER, classInstallParamsSize uint32) (err error) { +func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) { r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0) if r1 == 0 { if e1 != 0 { |