github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/osext/winsvc/winapi/security.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package winapi 6 7 import "syscall" 8 9 type SidIdentifierAuthority struct { 10 Value [6]byte 11 } 12 13 var ( 14 SECURITY_NULL_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 0}} 15 SECURITY_WORLD_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 1}} 16 SECURITY_LOCAL_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 2}} 17 SECURITY_CREATOR_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 3}} 18 SECURITY_NON_UNIQUE_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 4}} 19 SECURITY_NT_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 5}} 20 SECURITY_MANDATORY_LABEL_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 16}} 21 ) 22 23 const ( 24 SECURITY_NULL_RID = 0 25 SECURITY_WORLD_RID = 0 26 SECURITY_LOCAL_RID = 0 27 SECURITY_CREATOR_OWNER_RID = 0 28 SECURITY_CREATOR_GROUP_RID = 1 29 SECURITY_DIALUP_RID = 1 30 SECURITY_NETWORK_RID = 2 31 SECURITY_BATCH_RID = 3 32 SECURITY_INTERACTIVE_RID = 4 33 SECURITY_LOGON_IDS_RID = 5 34 SECURITY_SERVICE_RID = 6 35 SECURITY_LOCAL_SYSTEM_RID = 18 36 SECURITY_BUILTIN_DOMAIN_RID = 32 37 SECURITY_PRINCIPAL_SELF_RID = 10 38 SECURITY_CREATOR_OWNER_SERVER_RID = 0x2 39 SECURITY_CREATOR_GROUP_SERVER_RID = 0x3 40 SECURITY_LOGON_IDS_RID_COUNT = 0x3 41 SECURITY_ANONYMOUS_LOGON_RID = 0x7 42 SECURITY_PROXY_RID = 0x8 43 SECURITY_ENTERPRISE_CONTROLLERS_RID = 0x9 44 SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID 45 SECURITY_AUTHENTICATED_USER_RID = 0xb 46 SECURITY_RESTRICTED_CODE_RID = 0xc 47 SECURITY_NT_NON_UNIQUE_RID = 0x15 48 ) 49 50 type Tokengroups struct { 51 GroupCount uint32 52 Groups [1]syscall.SIDAndAttributes 53 } 54 55 //sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **syscall.SID) (err error) = advapi32.AllocateAndInitializeSid 56 //sys FreeSid(sid *syscall.SID) (err error) [failretval!=0] = advapi32.FreeSid 57 //sys EqualSid(sid1 *syscall.SID, sid2 *syscall.SID) (isEqual bool) = advapi32.EqualSid