xref: /reactos/dll/win32/advapi32/sec/trustee.c (revision 7ed4c1dd)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS system libraries
4  * FILE:            lib/advapi32/sec/trustee.c
5  * PURPOSE:         Trustee functions
6  */
7 
8 #include <advapi32.h>
9 
10 /******************************************************************************
11  * BuildImpersonateTrusteeA [ADVAPI32.@]
12  */
13 VOID WINAPI
BuildImpersonateTrusteeA(PTRUSTEE_A pTrustee,PTRUSTEE_A pImpersonateTrustee)14 BuildImpersonateTrusteeA(PTRUSTEE_A pTrustee,
15                          PTRUSTEE_A pImpersonateTrustee)
16 {
17     pTrustee->pMultipleTrustee = pImpersonateTrustee;
18     pTrustee->MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE;
19 }
20 
21 
22 /******************************************************************************
23  * BuildImpersonateTrusteeW [ADVAPI32.@]
24  */
25 VOID WINAPI
BuildImpersonateTrusteeW(PTRUSTEE_W pTrustee,PTRUSTEE_W pImpersonateTrustee)26 BuildImpersonateTrusteeW(PTRUSTEE_W pTrustee,
27                          PTRUSTEE_W pImpersonateTrustee)
28 {
29     pTrustee->pMultipleTrustee = pImpersonateTrustee;
30     pTrustee->MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE;
31 }
32 
33 /******************************************************************************
34  * BuildImpersonateExplicitAccessWithNameA [ADVAPI32.@]
35  */
36 VOID WINAPI
BuildImpersonateExplicitAccessWithNameA(PEXPLICIT_ACCESS_A pExplicitAccess,LPSTR pTrusteeName,PTRUSTEE_A pTrustee,DWORD AccessPermissions,ACCESS_MODE AccessMode,DWORD Inheritance)37 BuildImpersonateExplicitAccessWithNameA(PEXPLICIT_ACCESS_A pExplicitAccess,
38                                         LPSTR pTrusteeName,
39                                         PTRUSTEE_A pTrustee,
40                                         DWORD AccessPermissions,
41                                         ACCESS_MODE AccessMode,
42                                         DWORD Inheritance)
43 {
44     pExplicitAccess->grfAccessPermissions = AccessPermissions;
45     pExplicitAccess->grfAccessMode = AccessMode;
46     pExplicitAccess->grfInheritance = Inheritance;
47 
48     pExplicitAccess->Trustee.pMultipleTrustee = pTrustee;
49     pExplicitAccess->Trustee.MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE;
50     pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME;
51     pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
52     pExplicitAccess->Trustee.ptstrName = pTrusteeName;
53 }
54 
55 
56 /******************************************************************************
57  * BuildImpersonateExplicitAccessWithNameW [ADVAPI32.@]
58  */
59 VOID WINAPI
BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W pExplicitAccess,LPWSTR pTrusteeName,PTRUSTEE_W pTrustee,DWORD AccessPermissions,ACCESS_MODE AccessMode,DWORD Inheritance)60 BuildImpersonateExplicitAccessWithNameW(PEXPLICIT_ACCESS_W pExplicitAccess,
61                                         LPWSTR pTrusteeName,
62                                         PTRUSTEE_W pTrustee,
63                                         DWORD AccessPermissions,
64                                         ACCESS_MODE AccessMode,
65                                         DWORD Inheritance)
66 {
67     pExplicitAccess->grfAccessPermissions = AccessPermissions;
68     pExplicitAccess->grfAccessMode = AccessMode;
69     pExplicitAccess->grfInheritance = Inheritance;
70 
71     pExplicitAccess->Trustee.pMultipleTrustee = pTrustee;
72     pExplicitAccess->Trustee.MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE;
73     pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME;
74     pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
75     pExplicitAccess->Trustee.ptstrName = pTrusteeName;
76 }
77 
78 /******************************************************************************
79  * GetMultipleTrusteeA [ADVAPI32.@]
80  */
81 PTRUSTEEA WINAPI
GetMultipleTrusteeA(PTRUSTEE_A pTrustee)82 GetMultipleTrusteeA(PTRUSTEE_A pTrustee)
83 {
84     return pTrustee->pMultipleTrustee;
85 }
86 
87 
88 /******************************************************************************
89  * GetMultipleTrusteeW [ADVAPI32.@]
90  */
91 PTRUSTEEW WINAPI
GetMultipleTrusteeW(PTRUSTEE_W pTrustee)92 GetMultipleTrusteeW(PTRUSTEE_W pTrustee)
93 {
94     return pTrustee->pMultipleTrustee;
95 }
96 
97 
98 /******************************************************************************
99  * GetMultipleTrusteeOperationA [ADVAPI32.@]
100  */
101 MULTIPLE_TRUSTEE_OPERATION WINAPI
GetMultipleTrusteeOperationA(PTRUSTEE_A pTrustee)102 GetMultipleTrusteeOperationA(PTRUSTEE_A pTrustee)
103 {
104     return pTrustee->MultipleTrusteeOperation;
105 }
106 
107 
108 /******************************************************************************
109  * GetMultipleTrusteeOperationW [ADVAPI32.@]
110  */
111 MULTIPLE_TRUSTEE_OPERATION WINAPI
GetMultipleTrusteeOperationW(PTRUSTEE_W pTrustee)112 GetMultipleTrusteeOperationW(PTRUSTEE_W pTrustee)
113 {
114     return pTrustee->MultipleTrusteeOperation;
115 }
116 
117 /* EOF */
118