From 9d830826c53d9b8cd14cf0fcd43fdf4183de4c47 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 7 Feb 2019 22:37:14 +0100 Subject: setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader Signed-off-by: Simon Rozman --- tun/wintun/wintun_windows.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'tun/wintun/wintun_windows.go') diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go index b510d9a..1763692 100644 --- a/tun/wintun/wintun_windows.go +++ b/tun/wintun/wintun_windows.go @@ -250,12 +250,9 @@ func CreateInterface(description string, hwndParent uintptr) (*Wintun, bool, err // The interface failed to install, or the interface ID was unobtainable. Clean-up. removeDeviceParams := setupapi.SP_REMOVEDEVICE_PARAMS{ - ClassInstallHeader: setupapi.SP_CLASSINSTALL_HEADER{ - InstallFunction: setupapi.DIF_REMOVE, - }, - Scope: setupapi.DI_REMOVEDEVICE_GLOBAL, + ClassInstallHeader: *setupapi.MakeClassInstallHeader(setupapi.DIF_REMOVE), + Scope: setupapi.DI_REMOVEDEVICE_GLOBAL, } - removeDeviceParams.ClassInstallHeader.Size = uint32(unsafe.Sizeof(removeDeviceParams.ClassInstallHeader)) // Set class installer parameters for DIF_REMOVE. if devInfoList.SetClassInstallParams(deviceData, &removeDeviceParams.ClassInstallHeader, uint32(unsafe.Sizeof(removeDeviceParams))) == nil { @@ -314,12 +311,9 @@ func (wintun *Wintun) DeleteInterface(hwndParent uintptr) (bool, bool, error) { if *ifid == *ifid2 { // Remove the device. removeDeviceParams := setupapi.SP_REMOVEDEVICE_PARAMS{ - ClassInstallHeader: setupapi.SP_CLASSINSTALL_HEADER{ - InstallFunction: setupapi.DIF_REMOVE, - }, - Scope: setupapi.DI_REMOVEDEVICE_GLOBAL, + ClassInstallHeader: *setupapi.MakeClassInstallHeader(setupapi.DIF_REMOVE), + Scope: setupapi.DI_REMOVEDEVICE_GLOBAL, } - removeDeviceParams.ClassInstallHeader.Size = uint32(unsafe.Sizeof(removeDeviceParams.ClassInstallHeader)) // Set class installer parameters for DIF_REMOVE. err = devInfoList.SetClassInstallParams(deviceData, &removeDeviceParams.ClassInstallHeader, uint32(unsafe.Sizeof(removeDeviceParams))) -- cgit v1.2.3-59-g8ed1b