wintun: ring management moved to wintun.dll

Signed-off-by: Simon Rozman <simon@rozman.si>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Simon Rozman
2020-10-24 22:40:46 +02:00
committed by Jason A. Donenfeld
parent 65e03a9182
commit a3b231b31e
4 changed files with 147 additions and 214 deletions

View File

@@ -45,7 +45,6 @@ var (
procWintunGetAdapterLUID = modwintun.NewProc("WintunGetAdapterLUID")
procWintunGetAdapterName = modwintun.NewProc("WintunGetAdapterName")
procWintunGetRunningDriverVersion = modwintun.NewProc("WintunGetRunningDriverVersion")
procWintunOpenAdapterDeviceObject = modwintun.NewProc("WintunOpenAdapterDeviceObject")
procWintunSetAdapterName = modwintun.NewProc("WintunSetAdapterName")
procWintunSetLogger = modwintun.NewProc("WintunSetLogger")
)
@@ -210,16 +209,6 @@ func RunningVersion() (version uint32, err error) {
return
}
// handle returns a handle to the adapter device object. Release handle with windows.CloseHandle
func (wintun *Adapter) OpenAdapterDeviceObject() (handle windows.Handle, err error) {
r0, _, e1 := syscall.Syscall(procWintunOpenAdapterDeviceObject.Addr(), 1, uintptr(wintun.handle), 0, 0)
handle = windows.Handle(r0)
if handle == windows.InvalidHandle {
err = e1
}
return
}
// LUID returns the LUID of the adapter.
func (wintun *Adapter) LUID() (luid uint64) {
syscall.Syscall(procWintunGetAdapterLUID.Addr(), 2, uintptr(wintun.handle), uintptr(unsafe.Pointer(&luid)), 0)