mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-11-04 02:01:14 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			569 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			569 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// 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
 | 
						|
}
 |