winpipe: use x/sys/windows instead of syscall

This commit is contained in:
Jason A. Donenfeld
2019-09-16 23:39:16 -06:00
parent 70f6c42556
commit 01f8ef4e84
7 changed files with 128 additions and 229 deletions

View File

@@ -16,7 +16,6 @@ import (
"golang.org/x/sys/windows"
"golang.org/x/text/unicode/norm"
"golang.zx2c4.com/wireguard/ipc/winpipe"
"golang.zx2c4.com/wireguard/tun/wintun/namespaceapi"
)
@@ -32,13 +31,13 @@ func initializeNamespace() error {
if hasInitializedNamespace {
return nil
}
sd, err := winpipe.SddlToSecurityDescriptor("O:SYD:P(A;;GA;;;SY)")
sd, err := windows.SecurityDescriptorFromString("O:SYD:P(A;;GA;;;SY)")
if err != nil {
return fmt.Errorf("SddlToSecurityDescriptor failed: %v", err)
}
wintunObjectSecurityAttributes = &windows.SecurityAttributes{
Length: uint32(unsafe.Sizeof(windows.SecurityAttributes{})),
SecurityDescriptor: uintptr(unsafe.Pointer(&sd[0])),
SecurityDescriptor: uintptr(unsafe.Pointer(sd)),
}
sid, err := windows.CreateWellKnownSid(windows.WinLocalSystemSid)
if err != nil {