diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-09-16 23:39:16 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-09-16 23:39:16 -0600 |
commit | 01f8ef4e84a0354d33c32130f11c88d37d5f514d (patch) | |
tree | 62c251433f8a4e3a163821d6a442a3549d67ee38 /ipc/winpipe/sd.go | |
parent | 70f6c42556afad75fa5c9734fe02cd8d2679ed0b (diff) |
winpipe: use x/sys/windows instead of syscall
Diffstat (limited to 'ipc/winpipe/sd.go')
-rw-r--r-- | ipc/winpipe/sd.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/ipc/winpipe/sd.go b/ipc/winpipe/sd.go deleted file mode 100644 index 64728ba..0000000 --- a/ipc/winpipe/sd.go +++ /dev/null @@ -1,36 +0,0 @@ -// +build windows - -/* SPDX-License-Identifier: MIT - * - * Copyright (C) 2005 Microsoft - * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved. - */ - -package winpipe - -import ( - "unsafe" -) - -//sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW -//sys localFree(mem uintptr) = LocalFree -//sys getSecurityDescriptorLength(sd uintptr) (len uint32) = advapi32.GetSecurityDescriptorLength -//sys getSecurityInfo(handle syscall.Handle, objectType uint32, securityInformation uint32, owner **syscall.SID, group **syscall.SID, dacl *uintptr, sacl *uintptr, sd *uintptr) (ret error) = advapi32.GetSecurityInfo -//sys equalSid(sid1 *syscall.SID, sid2 *syscall.SID) (isEqual bool) = advapi32.EqualSid - -const ( - SE_FILE_OBJECT = 1 - OWNER_SECURITY_INFORMATION = 1 -) - -func SddlToSecurityDescriptor(sddl string) ([]byte, error) { - var sdBuffer uintptr - err := convertStringSecurityDescriptorToSecurityDescriptor(sddl, 1, &sdBuffer, nil) - if err != nil { - return nil, err - } - defer localFree(sdBuffer) - sd := make([]byte, getSecurityDescriptorLength(sdBuffer)) - copy(sd, (*[0xffff]byte)(unsafe.Pointer(sdBuffer))[:len(sd)]) - return sd, nil -} |