Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentrustee.c
Go to the documentation of this file.
00001 /* $Id: trustee.c 53225 2011-08-14 11:31:23Z akhaldi $ 00002 * 00003 * COPYRIGHT: See COPYING in the top level directory 00004 * PROJECT: ReactOS system libraries 00005 * FILE: lib/advapi32/sec/trustee.c 00006 * PURPOSE: Trustee functions 00007 */ 00008 00009 #include <advapi32.h> 00010 WINE_DEFAULT_DEBUG_CHANNEL(advapi); 00011 00012 00013 /****************************************************************************** 00014 * BuildImpersonateTrusteeA [ADVAPI32.@] 00015 */ 00016 VOID WINAPI 00017 BuildImpersonateTrusteeA(PTRUSTEE_A pTrustee, 00018 PTRUSTEE_A pImpersonateTrustee) 00019 { 00020 pTrustee->pMultipleTrustee = pImpersonateTrustee; 00021 pTrustee->MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE; 00022 } 00023 00024 00025 /****************************************************************************** 00026 * BuildImpersonateTrusteeW [ADVAPI32.@] 00027 */ 00028 VOID WINAPI 00029 BuildImpersonateTrusteeW(PTRUSTEE_W pTrustee, 00030 PTRUSTEE_W pImpersonateTrustee) 00031 { 00032 pTrustee->pMultipleTrustee = pImpersonateTrustee; 00033 pTrustee->MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE; 00034 } 00035 00036 00037 /****************************************************************************** 00038 * BuildExplicitAccessWithNameA [ADVAPI32.@] 00039 */ 00040 VOID WINAPI 00041 BuildExplicitAccessWithNameA(PEXPLICIT_ACCESSA pExplicitAccess, 00042 LPSTR pTrusteeName, 00043 DWORD AccessPermissions, 00044 ACCESS_MODE AccessMode, 00045 DWORD Inheritance) 00046 { 00047 pExplicitAccess->grfAccessPermissions = AccessPermissions; 00048 pExplicitAccess->grfAccessMode = AccessMode; 00049 pExplicitAccess->grfInheritance = Inheritance; 00050 00051 pExplicitAccess->Trustee.pMultipleTrustee = NULL; 00052 pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00053 pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; 00054 pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; 00055 pExplicitAccess->Trustee.ptstrName = pTrusteeName; 00056 } 00057 00058 00059 /****************************************************************************** 00060 * BuildExplicitAccessWithNameW [ADVAPI32.@] 00061 */ 00062 VOID WINAPI 00063 BuildExplicitAccessWithNameW(PEXPLICIT_ACCESSW pExplicitAccess, 00064 LPWSTR pTrusteeName, 00065 DWORD AccessPermissions, 00066 ACCESS_MODE AccessMode, 00067 DWORD Inheritance) 00068 { 00069 pExplicitAccess->grfAccessPermissions = AccessPermissions; 00070 pExplicitAccess->grfAccessMode = AccessMode; 00071 pExplicitAccess->grfInheritance = Inheritance; 00072 00073 pExplicitAccess->Trustee.pMultipleTrustee = NULL; 00074 pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00075 pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; 00076 pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; 00077 pExplicitAccess->Trustee.ptstrName = pTrusteeName; 00078 } 00079 00080 00081 /****************************************************************************** 00082 * BuildImpersonateExplicitAccessWithNameA [ADVAPI32.@] 00083 */ 00084 VOID WINAPI 00085 BuildImpersonateExplicitAccessWithNameA(PEXPLICIT_ACCESS_A pExplicitAccess, 00086 LPSTR pTrusteeName, 00087 PTRUSTEE_A pTrustee, 00088 DWORD AccessPermissions, 00089 ACCESS_MODE AccessMode, 00090 DWORD Inheritance) 00091 { 00092 pExplicitAccess->grfAccessPermissions = AccessPermissions; 00093 pExplicitAccess->grfAccessMode = AccessMode; 00094 pExplicitAccess->grfInheritance = Inheritance; 00095 00096 pExplicitAccess->Trustee.pMultipleTrustee = pTrustee; 00097 pExplicitAccess->Trustee.MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE; 00098 pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; 00099 pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; 00100 pExplicitAccess->Trustee.ptstrName = pTrusteeName; 00101 } 00102 00103 00104 /****************************************************************************** 00105 * BuildImpersonateExplicitAccessWithNameW [ADVAPI32.@] 00106 */ 00107 VOID WINAPI 00108 BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W pExplicitAccess, 00109 LPWSTR pTrusteeName, 00110 PTRUSTEE_W pTrustee, 00111 DWORD AccessPermissions, 00112 ACCESS_MODE AccessMode, 00113 DWORD Inheritance) 00114 { 00115 pExplicitAccess->grfAccessPermissions = AccessPermissions; 00116 pExplicitAccess->grfAccessMode = AccessMode; 00117 pExplicitAccess->grfInheritance = Inheritance; 00118 00119 pExplicitAccess->Trustee.pMultipleTrustee = pTrustee; 00120 pExplicitAccess->Trustee.MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE; 00121 pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; 00122 pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; 00123 pExplicitAccess->Trustee.ptstrName = pTrusteeName; 00124 } 00125 00126 00127 /****************************************************************************** 00128 * BuildTrusteeWithSidA [ADVAPI32.@] 00129 */ 00130 VOID WINAPI 00131 BuildTrusteeWithSidA(PTRUSTEE_A pTrustee, 00132 PSID pSid) 00133 { 00134 TRACE("%p %p\n", pTrustee, pSid); 00135 00136 pTrustee->pMultipleTrustee = NULL; 00137 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00138 pTrustee->TrusteeForm = TRUSTEE_IS_SID; 00139 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00140 pTrustee->ptstrName = (LPSTR) pSid; 00141 } 00142 00143 00144 /****************************************************************************** 00145 * BuildTrusteeWithSidW [ADVAPI32.@] 00146 */ 00147 VOID WINAPI 00148 BuildTrusteeWithSidW(PTRUSTEE_W pTrustee, 00149 PSID pSid) 00150 { 00151 TRACE("%p %p\n", pTrustee, pSid); 00152 00153 pTrustee->pMultipleTrustee = NULL; 00154 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00155 pTrustee->TrusteeForm = TRUSTEE_IS_SID; 00156 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00157 pTrustee->ptstrName = (LPWSTR) pSid; 00158 } 00159 00160 00161 /****************************************************************************** 00162 * BuildTrusteeWithNameA [ADVAPI32.@] 00163 */ 00164 VOID WINAPI 00165 BuildTrusteeWithNameA(PTRUSTEE_A pTrustee, 00166 LPSTR name) 00167 { 00168 TRACE("%p %s\n", pTrustee, name); 00169 00170 pTrustee->pMultipleTrustee = NULL; 00171 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00172 pTrustee->TrusteeForm = TRUSTEE_IS_NAME; 00173 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00174 pTrustee->ptstrName = name; 00175 } 00176 00177 00178 /****************************************************************************** 00179 * BuildTrusteeWithNameW [ADVAPI32.@] 00180 */ 00181 VOID WINAPI 00182 BuildTrusteeWithNameW(PTRUSTEE_W pTrustee, 00183 LPWSTR name) 00184 { 00185 TRACE("%p %s\n", pTrustee, name); 00186 00187 pTrustee->pMultipleTrustee = NULL; 00188 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00189 pTrustee->TrusteeForm = TRUSTEE_IS_NAME; 00190 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00191 pTrustee->ptstrName = name; 00192 } 00193 00194 00195 /****************************************************************************** 00196 * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] 00197 */ 00198 VOID WINAPI 00199 BuildTrusteeWithObjectsAndNameA(PTRUSTEEA pTrustee, 00200 POBJECTS_AND_NAME_A pObjName, 00201 SE_OBJECT_TYPE ObjectType, 00202 LPSTR ObjectTypeName, 00203 LPSTR InheritedObjectTypeName, 00204 LPSTR Name) 00205 { 00206 DWORD ObjectsPresent = 0; 00207 00208 TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, 00209 ObjectType, ObjectTypeName, InheritedObjectTypeName, Name); 00210 00211 /* Fill the OBJECTS_AND_NAME structure */ 00212 pObjName->ObjectType = ObjectType; 00213 if (ObjectTypeName != NULL) 00214 { 00215 ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; 00216 } 00217 00218 pObjName->InheritedObjectTypeName = InheritedObjectTypeName; 00219 if (InheritedObjectTypeName != NULL) 00220 { 00221 ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; 00222 } 00223 00224 pObjName->ObjectsPresent = ObjectsPresent; 00225 pObjName->ptstrName = Name; 00226 00227 /* Fill the TRUSTEE structure */ 00228 pTrustee->pMultipleTrustee = NULL; 00229 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00230 pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; 00231 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00232 pTrustee->ptstrName = (LPSTR)pObjName; 00233 } 00234 00235 00236 /****************************************************************************** 00237 * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] 00238 */ 00239 VOID WINAPI 00240 BuildTrusteeWithObjectsAndNameW(PTRUSTEEW pTrustee, 00241 POBJECTS_AND_NAME_W pObjName, 00242 SE_OBJECT_TYPE ObjectType, 00243 LPWSTR ObjectTypeName, 00244 LPWSTR InheritedObjectTypeName, 00245 LPWSTR Name) 00246 { 00247 DWORD ObjectsPresent = 0; 00248 00249 TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, 00250 ObjectType, ObjectTypeName, InheritedObjectTypeName, Name); 00251 00252 /* Fill the OBJECTS_AND_NAME structure */ 00253 pObjName->ObjectType = ObjectType; 00254 if (ObjectTypeName != NULL) 00255 { 00256 ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; 00257 } 00258 00259 pObjName->InheritedObjectTypeName = InheritedObjectTypeName; 00260 if (InheritedObjectTypeName != NULL) 00261 { 00262 ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; 00263 } 00264 00265 pObjName->ObjectsPresent = ObjectsPresent; 00266 pObjName->ptstrName = Name; 00267 00268 /* Fill the TRUSTEE structure */ 00269 pTrustee->pMultipleTrustee = NULL; 00270 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00271 pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; 00272 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00273 pTrustee->ptstrName = (LPWSTR)pObjName; 00274 } 00275 00276 00277 /****************************************************************************** 00278 * BuildTrusteeWithObjectsAndSidA [ADVAPI32.@] 00279 */ 00280 VOID WINAPI 00281 BuildTrusteeWithObjectsAndSidA(PTRUSTEEA pTrustee, 00282 POBJECTS_AND_SID pObjSid, 00283 GUID *pObjectGuid, 00284 GUID *pInheritedObjectGuid, 00285 PSID pSid) 00286 { 00287 DWORD ObjectsPresent = 0; 00288 00289 TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); 00290 00291 /* Fill the OBJECTS_AND_SID structure */ 00292 if (pObjectGuid != NULL) 00293 { 00294 pObjSid->ObjectTypeGuid = *pObjectGuid; 00295 ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; 00296 } 00297 else 00298 { 00299 ZeroMemory(&pObjSid->ObjectTypeGuid, 00300 sizeof(GUID)); 00301 } 00302 00303 if (pInheritedObjectGuid != NULL) 00304 { 00305 pObjSid->InheritedObjectTypeGuid = *pInheritedObjectGuid; 00306 ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; 00307 } 00308 else 00309 { 00310 ZeroMemory(&pObjSid->InheritedObjectTypeGuid, 00311 sizeof(GUID)); 00312 } 00313 00314 pObjSid->ObjectsPresent = ObjectsPresent; 00315 pObjSid->pSid = pSid; 00316 00317 /* Fill the TRUSTEE structure */ 00318 pTrustee->pMultipleTrustee = NULL; 00319 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00320 pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; 00321 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00322 pTrustee->ptstrName = (LPSTR) pObjSid; 00323 } 00324 00325 00326 /****************************************************************************** 00327 * BuildTrusteeWithObjectsAndSidW [ADVAPI32.@] 00328 */ 00329 VOID WINAPI 00330 BuildTrusteeWithObjectsAndSidW(PTRUSTEEW pTrustee, 00331 POBJECTS_AND_SID pObjSid, 00332 GUID *pObjectGuid, 00333 GUID *pInheritedObjectGuid, 00334 PSID pSid) 00335 { 00336 DWORD ObjectsPresent = 0; 00337 00338 TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); 00339 00340 /* Fill the OBJECTS_AND_SID structure */ 00341 if (pObjectGuid != NULL) 00342 { 00343 pObjSid->ObjectTypeGuid = *pObjectGuid; 00344 ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT; 00345 } 00346 else 00347 { 00348 ZeroMemory(&pObjSid->ObjectTypeGuid, 00349 sizeof(GUID)); 00350 } 00351 00352 if (pInheritedObjectGuid != NULL) 00353 { 00354 pObjSid->InheritedObjectTypeGuid = *pInheritedObjectGuid; 00355 ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT; 00356 } 00357 else 00358 { 00359 ZeroMemory(&pObjSid->InheritedObjectTypeGuid, 00360 sizeof(GUID)); 00361 } 00362 00363 pObjSid->ObjectsPresent = ObjectsPresent; 00364 pObjSid->pSid = pSid; 00365 00366 /* Fill the TRUSTEE structure */ 00367 pTrustee->pMultipleTrustee = NULL; 00368 pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; 00369 pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; 00370 pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; 00371 pTrustee->ptstrName = (LPWSTR) pObjSid; 00372 } 00373 00374 00375 /****************************************************************************** 00376 * GetMultipleTrusteeA [ADVAPI32.@] 00377 */ 00378 PTRUSTEEA WINAPI 00379 GetMultipleTrusteeA(PTRUSTEE_A pTrustee) 00380 { 00381 return pTrustee->pMultipleTrustee; 00382 } 00383 00384 00385 /****************************************************************************** 00386 * GetMultipleTrusteeW [ADVAPI32.@] 00387 */ 00388 PTRUSTEEW WINAPI 00389 GetMultipleTrusteeW(PTRUSTEE_W pTrustee) 00390 { 00391 return pTrustee->pMultipleTrustee; 00392 } 00393 00394 00395 /****************************************************************************** 00396 * GetMultipleTrusteeOperationA [ADVAPI32.@] 00397 */ 00398 MULTIPLE_TRUSTEE_OPERATION WINAPI 00399 GetMultipleTrusteeOperationA(PTRUSTEE_A pTrustee) 00400 { 00401 return pTrustee->MultipleTrusteeOperation; 00402 } 00403 00404 00405 /****************************************************************************** 00406 * GetMultipleTrusteeOperationW [ADVAPI32.@] 00407 */ 00408 MULTIPLE_TRUSTEE_OPERATION WINAPI 00409 GetMultipleTrusteeOperationW(PTRUSTEE_W pTrustee) 00410 { 00411 return pTrustee->MultipleTrusteeOperation; 00412 } 00413 00414 00415 /****************************************************************************** 00416 * GetTrusteeFormW [ADVAPI32.@] 00417 */ 00418 TRUSTEE_FORM WINAPI 00419 GetTrusteeFormA(PTRUSTEE_A pTrustee) 00420 { 00421 return pTrustee->TrusteeForm; 00422 } 00423 00424 00425 /****************************************************************************** 00426 * GetTrusteeFormW [ADVAPI32.@] 00427 */ 00428 TRUSTEE_FORM WINAPI 00429 GetTrusteeFormW(PTRUSTEE_W pTrustee) 00430 { 00431 return pTrustee->TrusteeForm; 00432 } 00433 00434 00435 /****************************************************************************** 00436 * GetTrusteeNameA [ADVAPI32.@] 00437 */ 00438 LPSTR WINAPI 00439 GetTrusteeNameA(PTRUSTEE_A pTrustee) 00440 { 00441 return pTrustee->ptstrName; 00442 } 00443 00444 00445 /****************************************************************************** 00446 * GetTrusteeNameW [ADVAPI32.@] 00447 */ 00448 LPWSTR WINAPI 00449 GetTrusteeNameW(PTRUSTEE_W pTrustee) 00450 { 00451 return pTrustee->ptstrName; 00452 } 00453 00454 00455 /****************************************************************************** 00456 * GetTrusteeTypeA [ADVAPI32.@] 00457 */ 00458 TRUSTEE_TYPE WINAPI 00459 GetTrusteeTypeA(PTRUSTEE_A pTrustee) 00460 { 00461 return pTrustee->TrusteeType; 00462 } 00463 00464 00465 /****************************************************************************** 00466 * GetTrusteeTypeW [ADVAPI32.@] 00467 */ 00468 TRUSTEE_TYPE WINAPI 00469 GetTrusteeTypeW(PTRUSTEE_W pTrustee) 00470 { 00471 return pTrustee->TrusteeType; 00472 } 00473 00474 /* EOF */ Generated on Sun May 27 2012 04:22:44 for ReactOS by
1.7.6.1
|