summaryrefslogtreecommitdiffhomepage
path: root/tun/wintun/wintun_windows.go
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-07 22:37:14 +0100
committerSimon Rozman <simon@rozman.si>2019-02-07 23:50:43 +0100
commit9d830826c53d9b8cd14cf0fcd43fdf4183de4c47 (patch)
treed24f8a43b46f93b236bbf41bf99c2b87e2164ed5 /tun/wintun/wintun_windows.go
parentbd963497da908d3910668dab9dab4ac7654a638a (diff)
setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun/wintun/wintun_windows.go')
-rw-r--r--tun/wintun/wintun_windows.go14
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)))