mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
windows: revert security_windows.go change of CL 202177
This change is golang.org/x/sys/windows copy of CL 204117. Updates golang/go#34972 Change-Id: I338c91bfe3971a80cbf44c2a0f1807adaa00918d Reviewed-on: https://go-review.googlesource.com/c/sys/+/207199 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
@@ -229,15 +229,13 @@ func LookupSID(system, account string) (sid *SID, domain string, accType uint32,
|
||||
|
||||
// String converts SID to a string format suitable for display, storage, or transmission.
|
||||
func (sid *SID) String() string {
|
||||
// From https://docs.microsoft.com/en-us/windows/win32/secbiomet/general-constants
|
||||
const SecurityMaxSidSize = 68
|
||||
var s *uint16
|
||||
e := ConvertSidToStringSid(sid, &s)
|
||||
if e != nil {
|
||||
return ""
|
||||
}
|
||||
defer LocalFree((Handle)(unsafe.Pointer(s)))
|
||||
return UTF16ToString((*[SecurityMaxSidSize]uint16)(unsafe.Pointer(s))[:])
|
||||
return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:])
|
||||
}
|
||||
|
||||
// Len returns the length, in bytes, of a valid security identifier SID.
|
||||
|
||||
Reference in New Issue
Block a user