1 /* $Id: sid.c,v 1.2 2001/01/14 12:15:19 ea Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/advapi32/sec/sid.c
6 * PURPOSE: Security ID functions
10 #include <ntdll/rtl.h>
16 AllocateAndInitializeSid (
17 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
18 BYTE nSubAuthorityCount
,
19 DWORD dwSubAuthority0
,
20 DWORD dwSubAuthority1
,
21 DWORD dwSubAuthority2
,
22 DWORD dwSubAuthority3
,
23 DWORD dwSubAuthority4
,
24 DWORD dwSubAuthority5
,
25 DWORD dwSubAuthority6
,
26 DWORD dwSubAuthority7
,
32 Status
= RtlAllocateAndInitializeSid (pIdentifierAuthority
,
43 if (!NT_SUCCESS(Status
))
45 SetLastError (RtlNtStatusToDosError (Status
));
56 DWORD nDestinationSidLength
,
63 Status
= RtlCopySid (nDestinationSidLength
,
66 if (!NT_SUCCESS(Status
))
68 SetLastError (RtlNtStatusToDosError (Status
));
82 return RtlEqualPrefixSid (pSid1
, pSid2
);
92 return RtlEqualSid (pSid1
, pSid2
);
101 return RtlFreeSid (pSid
);
110 return (DWORD
)RtlLengthSid (pSid
);
113 PSID_IDENTIFIER_AUTHORITY
115 GetSidIdentifierAuthority (
119 return RtlIdentifierAuthoritySid (pSid
);
124 GetSidLengthRequired (
125 UCHAR nSubAuthorityCount
128 return (DWORD
)RtlLengthRequiredSid (nSubAuthorityCount
);
138 return (PDWORD
)RtlSubAuthoritySid (pSid
, nSubAuthority
);
143 GetSidSubAuthorityCount (
147 return RtlSubAuthorityCountSid (pSid
);
154 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
155 BYTE nSubAuthorityCount
160 Status
= RtlInitializeSid (Sid
,
161 pIdentifierAuthority
,
163 if (!NT_SUCCESS(Status
))
165 SetLastError (RtlNtStatusToDosError (Status
));
178 return (WINBOOL
)RtlValidSid (pSid
);
188 LPSTR ReferencedDomainName
,
189 LPDWORD cbReferencedDomainName
,
200 LPCWSTR lpSystemName
,
204 LPWSTR ReferencedDomainName
,
205 LPDWORD cbReferencedDomainName
,