11 BOOL32 WINAPI
IsValidSid (LPSID pSid
);
12 BOOL32 WINAPI
EqualSid (LPSID pSid1
, LPSID pSid2
);
13 BOOL32 WINAPI
EqualPrefixSid (LPSID pSid1
, LPSID pSid2
);
14 DWORD WINAPI
GetSidLengthRequired (BYTE nSubAuthorityCount
);
15 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
);
16 VOID
* WINAPI
FreeSid(LPSID pSid
);
17 BOOL32 WINAPI
InitializeSid (LPSID pSid
, LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
, BYTE nSubAuthorityCount
);
18 LPSID_IDENTIFIER_AUTHORITY WINAPI
GetSidIdentifierAuthority(LPSID pSid
);
19 DWORD
* WINAPI
GetSidSubAuthority(LPSID pSid
, DWORD nSubAuthority
);
20 BYTE
* WINAPI
GetSidSubAuthorityCount(LPSID pSid
);
21 DWORD WINAPI
GetLengthSid(LPSID pSid
);
22 BOOL32 WINAPI
CopySid(DWORD nDestinationSidLength
, LPSID pDestinationSid
, LPSID pSourceSid
);
24 /***********************************************************************
25 * IsValidSid (ADVAPI.80)
27 BOOL32 WINAPI
IsValidSid (LPSID pSid
) {
28 if (!pSid
|| pSid
->Revision
!= SID_REVISION
)
34 /***********************************************************************
35 * EqualSid (ADVAPI.40)
37 BOOL32 WINAPI
EqualSid (LPSID pSid1
, LPSID pSid2
) {
38 if (!IsValidSid(pSid1
) || !IsValidSid(pSid2
))
41 if (*GetSidSubAuthorityCount(pSid1
) != *GetSidSubAuthorityCount(pSid2
))
44 if (memcmp(pSid1
, pSid2
, GetLengthSid(pSid1
)) != 0)
50 /***********************************************************************
51 * EqualPrefixSid (ADVAPI.39)
53 BOOL32 WINAPI
EqualPrefixSid (LPSID pSid1
, LPSID pSid2
) {
54 if (!IsValidSid(pSid1
) || !IsValidSid(pSid2
))
57 if (*GetSidSubAuthorityCount(pSid1
) != *GetSidSubAuthorityCount(pSid2
))
60 if (memcmp(pSid1
, pSid2
, GetSidLengthRequired(pSid1
->SubAuthorityCount
- 1))
67 /***********************************************************************
68 * GetSidLengthRequired (ADVAPI.63)
70 DWORD WINAPI
GetSidLengthRequired (BYTE nSubAuthorityCount
) {
71 return sizeof (SID
) + (nSubAuthorityCount
- 1 * sizeof (DWORD
));
74 /***********************************************************************
75 * AllocateAndInitializeSid (ADVAPI.11)
77 BOOL32 WINAPI
AllocateAndInitializeSid(LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
78 BYTE nSubAuthorityCount
,
79 DWORD nSubAuthority0
, DWORD nSubAuthority1
,
80 DWORD nSubAuthority2
, DWORD nSubAuthority3
,
81 DWORD nSubAuthority4
, DWORD nSubAuthority5
,
82 DWORD nSubAuthority6
, DWORD nSubAuthority7
,
85 if (!(*pSid
= HeapAlloc( GetProcessHeap(), 0,
86 GetSidLengthRequired(nSubAuthorityCount
))))
88 (*pSid
)->Revision
= SID_REVISION
;
89 if (pIdentifierAuthority
)
90 memcpy(&(*pSid
)->IdentifierAuthority
, pIdentifierAuthority
,
91 sizeof (SID_IDENTIFIER_AUTHORITY
));
92 *GetSidSubAuthorityCount(*pSid
) = nSubAuthorityCount
;
94 if (nSubAuthorityCount
> 0)
95 *GetSidSubAuthority(*pSid
, 0) = nSubAuthority0
;
96 if (nSubAuthorityCount
> 1)
97 *GetSidSubAuthority(*pSid
, 1) = nSubAuthority1
;
98 if (nSubAuthorityCount
> 2)
99 *GetSidSubAuthority(*pSid
, 2) = nSubAuthority2
;
100 if (nSubAuthorityCount
> 3)
101 *GetSidSubAuthority(*pSid
, 3) = nSubAuthority3
;
102 if (nSubAuthorityCount
> 4)
103 *GetSidSubAuthority(*pSid
, 4) = nSubAuthority4
;
104 if (nSubAuthorityCount
> 5)
105 *GetSidSubAuthority(*pSid
, 5) = nSubAuthority5
;
106 if (nSubAuthorityCount
> 6)
107 *GetSidSubAuthority(*pSid
, 6) = nSubAuthority6
;
108 if (nSubAuthorityCount
> 7)
109 *GetSidSubAuthority(*pSid
, 7) = nSubAuthority7
;
114 /***********************************************************************
115 * FreeSid (ADVAPI.42)
117 VOID
* WINAPI
FreeSid(LPSID pSid
)
119 HeapFree( GetProcessHeap(), 0, pSid
);
123 /***********************************************************************
124 * InitializeSecurityDescriptor (ADVAPI.73)
126 BOOL32 WINAPI
InitializeSecurityDescriptor( SECURITY_DESCRIPTOR
*pDescr
,
129 fprintf( stdnimp
, "InitializeSecurityDescriptor: empty stub\n" );
134 /***********************************************************************
135 * InitializeSid (ADVAPI.74)
137 BOOL32 WINAPI
InitializeSid (LPSID pSid
, LPSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
138 BYTE nSubAuthorityCount
)
142 pSid
->Revision
= SID_REVISION
;
143 if (pIdentifierAuthority
)
144 memcpy(&pSid
->IdentifierAuthority
, pIdentifierAuthority
,
145 sizeof (SID_IDENTIFIER_AUTHORITY
));
146 *GetSidSubAuthorityCount(pSid
) = nSubAuthorityCount
;
148 for (i
= 0; i
< nSubAuthorityCount
; i
++)
149 *GetSidSubAuthority(pSid
, i
) = 0;
154 /***********************************************************************
155 * GetSidIdentifierAuthority (ADVAPI.62)
157 LPSID_IDENTIFIER_AUTHORITY WINAPI
GetSidIdentifierAuthority (LPSID pSid
)
159 return &pSid
->IdentifierAuthority
;
162 /***********************************************************************
163 * GetSidSubAuthority (ADVAPI.64)
165 DWORD
* WINAPI
GetSidSubAuthority (LPSID pSid
, DWORD nSubAuthority
)
167 return &pSid
->SubAuthority
[nSubAuthority
];
170 /***********************************************************************
171 * GetSidSubAuthorityCount (ADVAPI.65)
173 BYTE
* WINAPI
GetSidSubAuthorityCount (LPSID pSid
)
175 return &pSid
->SubAuthorityCount
;
178 /***********************************************************************
179 * GetLengthSid (ADVAPI.48)
181 DWORD WINAPI
GetLengthSid (LPSID pSid
)
183 return GetSidLengthRequired(*GetSidSubAuthorityCount(pSid
));
186 /***********************************************************************
187 * CopySid (ADVAPI.24)
189 BOOL32 WINAPI
CopySid (DWORD nDestinationSidLength
, LPSID pDestinationSid
,
193 if (!IsValidSid(pSourceSid
))
196 if (nDestinationSidLength
< GetLengthSid(pSourceSid
))
199 memcpy(pDestinationSid
, pSourceSid
, GetLengthSid(pSourceSid
));
204 /***********************************************************************
205 * LookupAccountSidA [ADVAPI32.86]
207 BOOL32 WINAPI
LookupAccountSid32A(LPCSTR system
,PSID sid
,
208 LPCSTR account
,LPDWORD accountSize
,
209 LPCSTR domain
, LPDWORD domainSize
,
210 PSID_NAME_USE name_use
)
212 fprintf(stdnimp
,"LookupAccountSid32A(%s,%p,%p,%p,%p,%p,%p),stub\n",
213 system
,sid
,account
,accountSize
,domain
,domainSize
,name_use
);
214 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
218 /***********************************************************************
219 * LookupAccountSidW [ADVAPI32.86]
221 BOOL32 WINAPI
LookupAccountSid32W(LPCWSTR system
,PSID sid
,
222 LPCWSTR account
,LPDWORD accountSize
,
223 LPCWSTR domain
, LPDWORD domainSize
,
224 PSID_NAME_USE name_use
)
226 fprintf(stdnimp
,"LookupAccountSid32W(%p,%p,%p,%p,%p,%p,%p),stub\n",
227 system
,sid
,account
,accountSize
,domain
,domainSize
,name_use
);
228 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);