diff options
Diffstat (limited to 'tun/wintun/wintun_windows.go')
-rw-r--r-- | tun/wintun/wintun_windows.go | 14 |
1 files changed, 4 insertions, 10 deletions
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))) |