9 BOOL32 WINAPI
IsValidSid (LPSID pSid
);
10 BOOL32 WINAPI
EqualSid (LPSID pSid1
, LPSID pSid2
);
11 BOOL32 WINAPI
EqualPrefixSid (LPSID pSid1
, LPSID pSid2
);
12 DWORD WINAPI
GetSidLengthRequired (BYTE nSubAuthorityCount
);
13 BOOL32 WINAPI
AllocateAndInitializeSid(LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
, BYTE nSubAuthorityCount
, DWORD nSubAuthority0
, DWORD nSubAuthority1
, DWORD nSubAuthority2
, DWORD nSubAuthority3
, DWORD nSubAuthority4
, DWORD nSubAuthority5
, DWORD nSubAuthority6
, DWORD nSubAuthority7
, LPSID
*pSid
);
14 VOID
* WINAPI
FreeSid(LPSID pSid
);
15 BOOL32 WINAPI
InitializeSid (LPSID pSid
, LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
, BYTE nSubAuthorityCount
);
16 LPSID_IDENTIFIER_AUTHORITY WINAPI
GetSidIdentifierAuthority(LPSID pSid
);
17 DWORD
* WINAPI
GetSidSubAuthority(LPSID pSid
, DWORD nSubAuthority
);
18 BYTE
* WINAPI
GetSidSubAuthorityCount(LPSID pSid
);
19 DWORD WINAPI
GetLengthSid(LPSID pSid
);
20 BOOL32 WINAPI
CopySid(DWORD nDestinationSidLength
, LPSID pDestinationSid
, LPSID pSourceSid
);
22 /***********************************************************************
23 * IsValidSid (ADVAPI.80)
25 BOOL32 WINAPI
IsValidSid (LPSID pSid
) {
26 if (!pSid
|| pSid
->Revision
!= SID_REVISION
)
32 /***********************************************************************
33 * EqualSid (ADVAPI.40)
35 BOOL32 WINAPI
EqualSid (LPSID pSid1
, LPSID pSid2
) {
36 if (!IsValidSid(pSid1
) || !IsValidSid(pSid2
))
39 if (*GetSidSubAuthorityCount(pSid1
) != *GetSidSubAuthorityCount(pSid2
))
42 if (memcmp(pSid1
, pSid2
, GetLengthSid(pSid1
)) != 0)
48 /***********************************************************************
49 * EqualPrefixSid (ADVAPI.39)
51 BOOL32 WINAPI
EqualPrefixSid (LPSID pSid1
, LPSID pSid2
) {
52 if (!IsValidSid(pSid1
) || !IsValidSid(pSid2
))
55 if (*GetSidSubAuthorityCount(pSid1
) != *GetSidSubAuthorityCount(pSid2
))
58 if (memcmp(pSid1
, pSid2
, GetSidLengthRequired(pSid1
->SubAuthorityCount
- 1))
65 /***********************************************************************
66 * GetSidLengthRequired (ADVAPI.63)
68 DWORD WINAPI
GetSidLengthRequired (BYTE nSubAuthorityCount
) {
69 return sizeof (SID
) + (nSubAuthorityCount
- 1 * sizeof (DWORD
));
72 /***********************************************************************
73 * AllocateAndInitializeSid (ADVAPI.11)
75 BOOL32 WINAPI
AllocateAndInitializeSid(LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
76 BYTE nSubAuthorityCount
,
77 DWORD nSubAuthority0
, DWORD nSubAuthority1
,
78 DWORD nSubAuthority2
, DWORD nSubAuthority3
,
79 DWORD nSubAuthority4
, DWORD nSubAuthority5
,
80 DWORD nSubAuthority6
, DWORD nSubAuthority7
,
83 if (!(*pSid
= HeapAlloc( GetProcessHeap(), 0,
84 GetSidLengthRequired(nSubAuthorityCount
))))
86 (*pSid
)->Revision
= SID_REVISION
;
87 if (pIdentifierAuthority
)
88 memcpy(&(*pSid
)->IdentifierAuthority
, pIdentifierAuthority
,
89 sizeof (SID_IDENTIFIER_AUTHORITY
));
90 *GetSidSubAuthorityCount(*pSid
) = nSubAuthorityCount
;
92 if (nSubAuthorityCount
> 0)
93 *GetSidSubAuthority(*pSid
, 0) = nSubAuthority0
;
94 if (nSubAuthorityCount
> 1)
95 *GetSidSubAuthority(*pSid
, 1) = nSubAuthority1
;
96 if (nSubAuthorityCount
> 2)
97 *GetSidSubAuthority(*pSid
, 2) = nSubAuthority2
;
98 if (nSubAuthorityCount
> 3)
99 *GetSidSubAuthority(*pSid
, 3) = nSubAuthority3
;
100 if (nSubAuthorityCount
> 4)
101 *GetSidSubAuthority(*pSid
, 4) = nSubAuthority4
;
102 if (nSubAuthorityCount
> 5)
103 *GetSidSubAuthority(*pSid
, 5) = nSubAuthority5
;
104 if (nSubAuthorityCount
> 6)
105 *GetSidSubAuthority(*pSid
, 6) = nSubAuthority6
;
106 if (nSubAuthorityCount
> 7)
107 *GetSidSubAuthority(*pSid
, 7) = nSubAuthority7
;
112 /***********************************************************************
113 * FreeSid (ADVAPI.42)
115 VOID
* WINAPI
FreeSid(LPSID pSid
)
117 HeapFree( GetProcessHeap(), 0, pSid
);
121 /***********************************************************************
122 * InitializeSecurityDescriptor (ADVAPI.73)
124 BOOL32 WINAPI
InitializeSecurityDescriptor( SECURITY_DESCRIPTOR
*pDescr
,
127 FIXME(security
, "(%p,%#lx): empty stub\n", pDescr
, revision
);
132 /***********************************************************************
133 * InitializeSid (ADVAPI.74)
135 BOOL32 WINAPI
InitializeSid (LPSID pSid
, LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
136 BYTE nSubAuthorityCount
)
140 pSid
->Revision
= SID_REVISION
;
141 if (pIdentifierAuthority
)
142 memcpy(&pSid
->IdentifierAuthority
, pIdentifierAuthority
,
143 sizeof (SID_IDENTIFIER_AUTHORITY
));
144 *GetSidSubAuthorityCount(pSid
) = nSubAuthorityCount
;
146 for (i
= 0; i
< nSubAuthorityCount
; i
++)
147 *GetSidSubAuthority(pSid
, i
) = 0;
152 /***********************************************************************
153 * GetSidIdentifierAuthority (ADVAPI.62)
155 LPSID_IDENTIFIER_AUTHORITY WINAPI
GetSidIdentifierAuthority (LPSID pSid
)
157 return &pSid
->IdentifierAuthority
;
160 /***********************************************************************
161 * GetSidSubAuthority (ADVAPI.64)
163 DWORD
* WINAPI
GetSidSubAuthority (LPSID pSid
, DWORD nSubAuthority
)
165 return &pSid
->SubAuthority
[nSubAuthority
];
168 /***********************************************************************
169 * GetSidSubAuthorityCount (ADVAPI.65)
171 BYTE
* WINAPI
GetSidSubAuthorityCount (LPSID pSid
)
173 return &pSid
->SubAuthorityCount
;
176 /***********************************************************************
177 * GetLengthSid (ADVAPI.48)
179 DWORD WINAPI
GetLengthSid (LPSID pSid
)
181 return GetSidLengthRequired(*GetSidSubAuthorityCount(pSid
));
184 /***********************************************************************
185 * CopySid (ADVAPI.24)
187 BOOL32 WINAPI
CopySid (DWORD nDestinationSidLength
, LPSID pDestinationSid
,
191 if (!IsValidSid(pSourceSid
))
194 if (nDestinationSidLength
< GetLengthSid(pSourceSid
))
197 memcpy(pDestinationSid
, pSourceSid
, GetLengthSid(pSourceSid
));
202 /***********************************************************************
203 * LookupAccountSidA [ADVAPI32.86]
205 BOOL32 WINAPI
LookupAccountSid32A(LPCSTR system
,PSID sid
,
206 LPCSTR account
,LPDWORD accountSize
,
207 LPCSTR domain
, LPDWORD domainSize
,
208 PSID_NAME_USE name_use
)
210 FIXME(security
,"(%s,%p,%p,%p,%p,%p,%p): stub\n",
211 system
,sid
,account
,accountSize
,domain
,domainSize
,name_use
);
212 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
216 /***********************************************************************
217 * LookupAccountSidW [ADVAPI32.86]
219 BOOL32 WINAPI
LookupAccountSid32W(LPCWSTR system
,PSID sid
,
220 LPCWSTR account
,LPDWORD accountSize
,
221 LPCWSTR domain
, LPDWORD domainSize
,
222 PSID_NAME_USE name_use
)
224 FIXME(security
,"(%p,%p,%p,%p,%p,%p,%p): stub\n",
225 system
,sid
,account
,accountSize
,domain
,domainSize
,name_use
);
226 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);