aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-04 07:50:30 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-05 12:59:42 +0100
commit269944002fcd2f48cda25d564068a14159d179e2 (patch)
tree65579c06fa288935ffc7ebe6d6bc8b2542d7b0c0
parenta5a1ece32f96416bba9515d22555c6df86a379bb (diff)
downloadwireguard-go-269944002fcd2f48cda25d564068a14159d179e2.tar.gz
wireguard-go-269944002fcd2f48cda25d564068a14159d179e2.zip
Add support for setupapi.SetupDiCallClassInstaller()
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r--setupapi/setupapi_windows.go1
-rw-r--r--setupapi/zsetupapi_windows.go13
2 files changed, 14 insertions, 0 deletions
diff --git a/setupapi/setupapi_windows.go b/setupapi/setupapi_windows.go
index 89fb3e4..c7a42c1 100644
--- a/setupapi/setupapi_windows.go
+++ b/setupapi/setupapi_windows.go
@@ -22,6 +22,7 @@ import (
//sys setupDiSetDeviceInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA, DeviceInstallParams *_SP_DEVINSTALL_PARAMS) (err error) = setupapi.SetupDiSetDeviceInstallParamsW
//sys SetupDiGetClassInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA, ClassInstallParams *SP_CLASSINSTALL_HEADER, ClassInstallParamsSize uint32, RequiredSize *uint32) (err error) = setupapi.SetupDiGetClassInstallParamsW
//sys SetupDiSetClassInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA, ClassInstallParams *SP_CLASSINSTALL_HEADER, ClassInstallParamsSize uint32) (err error) = setupapi.SetupDiSetClassInstallParamsW
+//sys SetupDiCallClassInstaller(InstallFunction DI_FUNCTION, DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA) (err error) = setupapi.SetupDiCallClassInstaller
// SetupDiGetClassDevsEx function returns a handle to a device information set that contains requested device information elements for a local or a remote computer.
func SetupDiGetClassDevsEx(ClassGUID *windows.GUID, Enumerator string, hwndParent uintptr, Flags DIGCF, DeviceInfoSet DevInfo, MachineName string) (handle DevInfo, err error) {
diff --git a/setupapi/zsetupapi_windows.go b/setupapi/zsetupapi_windows.go
index d09c8dd..a8c61ad 100644
--- a/setupapi/zsetupapi_windows.go
+++ b/setupapi/zsetupapi_windows.go
@@ -48,6 +48,7 @@ var (
procSetupDiSetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiSetDeviceInstallParamsW")
procSetupDiGetClassInstallParamsW = modsetupapi.NewProc("SetupDiGetClassInstallParamsW")
procSetupDiSetClassInstallParamsW = modsetupapi.NewProc("SetupDiSetClassInstallParamsW")
+ procSetupDiCallClassInstaller = modsetupapi.NewProc("SetupDiCallClassInstaller")
)
func setupDiGetClassDevsEx(ClassGUID *windows.GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, DeviceInfoSet DevInfo, MachineName *uint16, reserved uintptr) (handle DevInfo, err error) {
@@ -159,3 +160,15 @@ func SetupDiSetClassInstallParams(DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVI
}
return
}
+
+func SetupDiCallClassInstaller(InstallFunction DI_FUNCTION, DeviceInfoSet DevInfo, DeviceInfoData *SP_DEVINFO_DATA) (err error) {
+ r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(InstallFunction), uintptr(DeviceInfoSet), uintptr(unsafe.Pointer(DeviceInfoData)))
+ if r1 == 0 {
+ if e1 != 0 {
+ err = errnoErr(e1)
+ } else {
+ err = syscall.EINVAL
+ }
+ }
+ return
+}