3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/advapi32/sec/trustee.c
6 * PURPOSE: Trustee functions
15 /******************************************************************************
16 * BuildImpersonateTrusteeA [ADVAPI32.@]
19 BuildImpersonateTrusteeA(PTRUSTEE_A pTrustee
,
20 PTRUSTEE_A pImpersonateTrustee
)
22 pTrustee
->pMultipleTrustee
= pImpersonateTrustee
;
23 pTrustee
->MultipleTrusteeOperation
= TRUSTEE_IS_IMPERSONATE
;
27 /******************************************************************************
28 * BuildImpersonateTrusteeW [ADVAPI32.@]
31 BuildImpersonateTrusteeW(PTRUSTEE_W pTrustee
,
32 PTRUSTEE_W pImpersonateTrustee
)
34 pTrustee
->pMultipleTrustee
= pImpersonateTrustee
;
35 pTrustee
->MultipleTrusteeOperation
= TRUSTEE_IS_IMPERSONATE
;
39 /******************************************************************************
40 * BuildExplicitAccessWithNameA [ADVAPI32.@]
43 BuildExplicitAccessWithNameA(PEXPLICIT_ACCESSA pExplicitAccess
,
45 DWORD AccessPermissions
,
46 ACCESS_MODE AccessMode
,
49 pExplicitAccess
->grfAccessPermissions
= AccessPermissions
;
50 pExplicitAccess
->grfAccessMode
= AccessMode
;
51 pExplicitAccess
->grfInheritance
= Inheritance
;
53 pExplicitAccess
->Trustee
.pMultipleTrustee
= NULL
;
54 pExplicitAccess
->Trustee
.MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
55 pExplicitAccess
->Trustee
.TrusteeForm
= TRUSTEE_IS_NAME
;
56 pExplicitAccess
->Trustee
.TrusteeType
= TRUSTEE_IS_UNKNOWN
;
57 pExplicitAccess
->Trustee
.ptstrName
= pTrusteeName
;
61 /******************************************************************************
62 * BuildExplicitAccessWithNameW [ADVAPI32.@]
65 BuildExplicitAccessWithNameW(PEXPLICIT_ACCESSW pExplicitAccess
,
67 DWORD AccessPermissions
,
68 ACCESS_MODE AccessMode
,
71 pExplicitAccess
->grfAccessPermissions
= AccessPermissions
;
72 pExplicitAccess
->grfAccessMode
= AccessMode
;
73 pExplicitAccess
->grfInheritance
= Inheritance
;
75 pExplicitAccess
->Trustee
.pMultipleTrustee
= NULL
;
76 pExplicitAccess
->Trustee
.MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
77 pExplicitAccess
->Trustee
.TrusteeForm
= TRUSTEE_IS_NAME
;
78 pExplicitAccess
->Trustee
.TrusteeType
= TRUSTEE_IS_UNKNOWN
;
79 pExplicitAccess
->Trustee
.ptstrName
= pTrusteeName
;
83 /******************************************************************************
84 * BuildImpersonateExplicitAccessWithNameA [ADVAPI32.@]
87 BuildImpersonateExplicitAccessWithNameA(PEXPLICIT_ACCESS_A pExplicitAccess
,
90 DWORD AccessPermissions
,
91 ACCESS_MODE AccessMode
,
94 pExplicitAccess
->grfAccessPermissions
= AccessPermissions
;
95 pExplicitAccess
->grfAccessMode
= AccessMode
;
96 pExplicitAccess
->grfInheritance
= Inheritance
;
98 pExplicitAccess
->Trustee
.pMultipleTrustee
= pTrustee
;
99 pExplicitAccess
->Trustee
.MultipleTrusteeOperation
= TRUSTEE_IS_IMPERSONATE
;
100 pExplicitAccess
->Trustee
.TrusteeForm
= TRUSTEE_IS_NAME
;
101 pExplicitAccess
->Trustee
.TrusteeType
= TRUSTEE_IS_UNKNOWN
;
102 pExplicitAccess
->Trustee
.ptstrName
= pTrusteeName
;
106 /******************************************************************************
107 * BuildImpersonateExplicitAccessWithNameW [ADVAPI32.@]
110 BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W pExplicitAccess
,
113 DWORD AccessPermissions
,
114 ACCESS_MODE AccessMode
,
117 pExplicitAccess
->grfAccessPermissions
= AccessPermissions
;
118 pExplicitAccess
->grfAccessMode
= AccessMode
;
119 pExplicitAccess
->grfInheritance
= Inheritance
;
121 pExplicitAccess
->Trustee
.pMultipleTrustee
= pTrustee
;
122 pExplicitAccess
->Trustee
.MultipleTrusteeOperation
= TRUSTEE_IS_IMPERSONATE
;
123 pExplicitAccess
->Trustee
.TrusteeForm
= TRUSTEE_IS_NAME
;
124 pExplicitAccess
->Trustee
.TrusteeType
= TRUSTEE_IS_UNKNOWN
;
125 pExplicitAccess
->Trustee
.ptstrName
= pTrusteeName
;
129 /******************************************************************************
130 * BuildTrusteeWithSidA [ADVAPI32.@]
133 BuildTrusteeWithSidA(PTRUSTEE_A pTrustee
, PSID pSid
)
135 DPRINT("%p %p\n", pTrustee
, pSid
);
137 pTrustee
->pMultipleTrustee
= NULL
;
138 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
139 pTrustee
->TrusteeForm
= TRUSTEE_IS_SID
;
140 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
141 pTrustee
->ptstrName
= (LPSTR
) pSid
;
145 /******************************************************************************
146 * BuildTrusteeWithSidW [ADVAPI32.@]
149 BuildTrusteeWithSidW(PTRUSTEE_W pTrustee
, PSID pSid
)
151 DPRINT("%p %p\n", pTrustee
, pSid
);
153 pTrustee
->pMultipleTrustee
= NULL
;
154 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
155 pTrustee
->TrusteeForm
= TRUSTEE_IS_SID
;
156 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
157 pTrustee
->ptstrName
= (LPWSTR
) pSid
;
161 /******************************************************************************
162 * BuildTrusteeWithNameA [ADVAPI32.@]
165 BuildTrusteeWithNameA(PTRUSTEE_A pTrustee
, LPSTR name
)
167 DPRINT("%p %s\n", pTrustee
, name
);
169 pTrustee
->pMultipleTrustee
= NULL
;
170 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
171 pTrustee
->TrusteeForm
= TRUSTEE_IS_NAME
;
172 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
173 pTrustee
->ptstrName
= name
;
177 /******************************************************************************
178 * BuildTrusteeWithNameW [ADVAPI32.@]
181 BuildTrusteeWithNameW(PTRUSTEE_W pTrustee
, LPWSTR name
)
183 DPRINT("%p %s\n", pTrustee
, name
);
185 pTrustee
->pMultipleTrustee
= NULL
;
186 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
187 pTrustee
->TrusteeForm
= TRUSTEE_IS_NAME
;
188 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
189 pTrustee
->ptstrName
= name
;
193 /******************************************************************************
194 * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@]
197 BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee
, POBJECTS_AND_NAME_A pObjName
,
198 SE_OBJECT_TYPE ObjectType
, LPSTR ObjectTypeName
,
199 LPSTR InheritedObjectTypeName
, LPSTR Name
)
201 DPRINT("%p %p 0x%08x %p %p %s\n", pTrustee
, pObjName
,
202 ObjectType
, ObjectTypeName
, InheritedObjectTypeName
, Name
);
204 pTrustee
->pMultipleTrustee
= NULL
;
205 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
206 pTrustee
->TrusteeForm
= TRUSTEE_IS_OBJECTS_AND_NAME
;
207 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
208 pTrustee
->ptstrName
= Name
;
212 /******************************************************************************
213 * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@]
216 BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee
, POBJECTS_AND_NAME_W pObjName
,
217 SE_OBJECT_TYPE ObjectType
, LPWSTR ObjectTypeName
,
218 LPWSTR InheritedObjectTypeName
, LPWSTR Name
)
220 DPRINT("%p %p 0x%08x %p %p %S\n", pTrustee
, pObjName
,
221 ObjectType
, ObjectTypeName
, InheritedObjectTypeName
, Name
);
223 pTrustee
->pMultipleTrustee
= NULL
;
224 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
225 pTrustee
->TrusteeForm
= TRUSTEE_IS_OBJECTS_AND_NAME
;
226 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
227 pTrustee
->ptstrName
= Name
;
231 /******************************************************************************
232 * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@]
235 BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee
, POBJECTS_AND_SID pObjSid
,
236 GUID
* pObjectGuid
, GUID
* pInheritedObjectGuid
, PSID pSid
)
238 DPRINT("%p %p %p %p %p\n", pTrustee
, pObjSid
, pObjectGuid
, pInheritedObjectGuid
, pSid
);
240 pTrustee
->pMultipleTrustee
= NULL
;
241 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
242 pTrustee
->TrusteeForm
= TRUSTEE_IS_OBJECTS_AND_SID
;
243 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
244 pTrustee
->ptstrName
= (LPSTR
) pSid
;
248 /******************************************************************************
249 * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@]
252 BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee
, POBJECTS_AND_SID pObjSid
,
253 GUID
* pObjectGuid
, GUID
* pInheritedObjectGuid
, PSID pSid
)
255 DPRINT("%p %p %p %p %p\n", pTrustee
, pObjSid
, pObjectGuid
, pInheritedObjectGuid
, pSid
);
257 pTrustee
->pMultipleTrustee
= NULL
;
258 pTrustee
->MultipleTrusteeOperation
= NO_MULTIPLE_TRUSTEE
;
259 pTrustee
->TrusteeForm
= TRUSTEE_IS_OBJECTS_AND_SID
;
260 pTrustee
->TrusteeType
= TRUSTEE_IS_UNKNOWN
;
261 pTrustee
->ptstrName
= (LPWSTR
) pSid
;
265 /******************************************************************************
266 * GetMultipleTrusteeA [ADVAPI32.@]
269 GetMultipleTrusteeA(PTRUSTEE_A pTrustee
)
271 return pTrustee
->pMultipleTrustee
;
275 /******************************************************************************
276 * GetMultipleTrusteeW [ADVAPI32.@]
279 GetMultipleTrusteeW(PTRUSTEE_W pTrustee
)
281 return pTrustee
->pMultipleTrustee
;
285 /******************************************************************************
286 * GetMultipleTrusteeOperationA [ADVAPI32.@]
288 MULTIPLE_TRUSTEE_OPERATION WINAPI
289 GetMultipleTrusteeOperationA(PTRUSTEE_A pTrustee
)
291 return pTrustee
->MultipleTrusteeOperation
;
295 /******************************************************************************
296 * GetMultipleTrusteeOperationW [ADVAPI32.@]
298 MULTIPLE_TRUSTEE_OPERATION WINAPI
299 GetMultipleTrusteeOperationW(PTRUSTEE_W pTrustee
)
301 return pTrustee
->MultipleTrusteeOperation
;
305 /******************************************************************************
306 * GetTrusteeFormW [ADVAPI32.@]
309 GetTrusteeFormA(PTRUSTEE_A pTrustee
)
311 return pTrustee
->TrusteeForm
;
315 /******************************************************************************
316 * GetTrusteeFormW [ADVAPI32.@]
319 GetTrusteeFormW(PTRUSTEE_W pTrustee
)
321 return pTrustee
->TrusteeForm
;
325 /******************************************************************************
326 * GetTrusteeNameA [ADVAPI32.@]
329 GetTrusteeNameA(PTRUSTEE_A pTrustee
)
331 return (pTrustee
->TrusteeForm
== TRUSTEE_IS_NAME
) ? pTrustee
->ptstrName
: NULL
;
335 /******************************************************************************
336 * GetTrusteeNameW [ADVAPI32.@]
339 GetTrusteeNameW(PTRUSTEE_W pTrustee
)
341 return (pTrustee
->TrusteeForm
== TRUSTEE_IS_NAME
) ? pTrustee
->ptstrName
: NULL
;
345 /******************************************************************************
346 * GetTrusteeTypeA [ADVAPI32.@]
349 GetTrusteeTypeA(PTRUSTEE_A pTrustee
)
351 return pTrustee
->TrusteeType
;
355 /******************************************************************************
356 * GetTrusteeTypeW [ADVAPI32.@]
359 GetTrusteeTypeW(PTRUSTEE_W pTrustee
)
361 return pTrustee
->TrusteeType
;