Move Linux client & common packages into a public repo.
This commit is contained in:
26
wgengine/winnet/winnet_windows.go
Normal file
26
wgengine/winnet/winnet_windows.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package winnet
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/go-ole/go-ole"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func (v *INetworkConnection) GetAdapterId() (string, error) {
|
||||
buf := ole.GUID{}
|
||||
hr, _, _ := syscall.Syscall(
|
||||
v.VTable().GetAdapterId,
|
||||
2,
|
||||
uintptr(unsafe.Pointer(v)),
|
||||
uintptr(unsafe.Pointer(&buf)),
|
||||
0)
|
||||
if hr != 0 {
|
||||
return "", fmt.Errorf("GetAdapterId failed: %08x", hr)
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
Reference in New Issue
Block a user