xref: /reactos/sdk/include/psdk/aclapi.h (revision c2c66aff)
1 #ifndef _ACLAPI_H
2 #define _ACLAPI_H
3 
4 #include <windows.h>
5 #include <accctrl.h>
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 VOID WINAPI BuildExplicitAccessWithNameA(_Inout_ PEXPLICIT_ACCESS_A, _In_opt_ LPSTR, _In_ DWORD, _In_ ACCESS_MODE, _In_ DWORD);
12 VOID WINAPI BuildExplicitAccessWithNameW(_Inout_ PEXPLICIT_ACCESS_W, _In_opt_ LPWSTR, _In_ DWORD, _In_ ACCESS_MODE, _In_ DWORD);
13 
14 DWORD
15 WINAPI
16 BuildSecurityDescriptorA(
17   _In_opt_ PTRUSTEE_A pOwner,
18   _In_opt_ PTRUSTEE_A pGroup,
19   _In_ ULONG cCountOfAccessEntries,
20   _In_reads_opt_(cCountOfAccessEntries) PEXPLICIT_ACCESS_A pListOfAccessEntries,
21   _In_ ULONG cCountOfAuditEntries,
22   _In_reads_opt_(cCountOfAuditEntries) PEXPLICIT_ACCESS_A pListOfAuditEntries,
23   _In_opt_ PSECURITY_DESCRIPTOR pOldSD,
24   _Out_ PULONG pSizeNewSD,
25   _Outptr_result_bytebuffer_(*pSizeNewSD) PSECURITY_DESCRIPTOR *pNewSD);
26 
27 DWORD
28 WINAPI
29 BuildSecurityDescriptorW(
30   _In_opt_ PTRUSTEE_W pOwner,
31   _In_opt_ PTRUSTEE_W pGroup,
32   _In_ ULONG cCountOfAccessEntries,
33   _In_reads_opt_(cCountOfAccessEntries) PEXPLICIT_ACCESS_W pListOfAccessEntries,
34   _In_ ULONG cCountOfAuditEntries,
35   _In_reads_opt_(cCountOfAuditEntries) PEXPLICIT_ACCESS_W pListOfAuditEntries,
36   _In_opt_ PSECURITY_DESCRIPTOR pOldSD,
37   _Out_ PULONG pSizeNewSD,
38   _Outptr_result_bytebuffer_(*pSizeNewSD) PSECURITY_DESCRIPTOR *pNewSD);
39 
40 VOID WINAPI BuildTrusteeWithNameA(_Inout_ PTRUSTEE_A, _In_opt_ LPSTR);
41 VOID WINAPI BuildTrusteeWithNameW(_Inout_ PTRUSTEE_W, _In_opt_ LPWSTR);
42 VOID WINAPI BuildTrusteeWithObjectsAndNameA(_Inout_ PTRUSTEE_A, _In_opt_ POBJECTS_AND_NAME_A, _In_opt_ SE_OBJECT_TYPE, _In_opt_ LPSTR, _In_opt_ LPSTR, _In_opt_ LPSTR);
43 VOID WINAPI BuildTrusteeWithObjectsAndNameW(_Inout_ PTRUSTEE_W, _In_opt_ POBJECTS_AND_NAME_W, _In_opt_ SE_OBJECT_TYPE, _In_opt_ LPWSTR, _In_opt_ LPWSTR, _In_opt_ LPWSTR);
44 VOID WINAPI BuildTrusteeWithObjectsAndSidA(_Inout_ PTRUSTEE_A, _In_opt_ POBJECTS_AND_SID, _In_opt_ GUID*, _In_opt_ GUID*, _In_opt_ PSID);
45 VOID WINAPI BuildTrusteeWithObjectsAndSidW(_Inout_ PTRUSTEE_W, _In_opt_ POBJECTS_AND_SID, _In_opt_ GUID*, _In_opt_ GUID*, _In_opt_ PSID);
46 VOID WINAPI BuildTrusteeWithSidA(_Inout_ PTRUSTEE_A, _In_opt_ PSID);
47 VOID WINAPI BuildTrusteeWithSidW(_Inout_ PTRUSTEE_W, _In_opt_ PSID);
48 
49 #if (_WIN32_WINNT >= 0x0501)
50 DWORD
51 WINAPI
52 FreeInheritedFromArray(
53   _In_reads_(AceCnt) PINHERITED_FROMW pInheritArray,
54   _In_ USHORT AceCnt,
55   _In_opt_ PFN_OBJECT_MGR_FUNCTS pfnArray);
56 #endif
57 
58 DWORD WINAPI GetAuditedPermissionsFromAclA(_In_ PACL, _In_ PTRUSTEE_A, _Out_ PACCESS_MASK, _Out_ PACCESS_MASK);
59 DWORD WINAPI GetAuditedPermissionsFromAclW(_In_ PACL, _In_ PTRUSTEE_W, _Out_ PACCESS_MASK, _Out_ PACCESS_MASK);
60 DWORD WINAPI GetEffectiveRightsFromAclA(_In_ PACL, _In_ PTRUSTEE_A, _Out_ PACCESS_MASK);
61 DWORD WINAPI GetEffectiveRightsFromAclW(_In_ PACL, _In_ PTRUSTEE_W, _Out_ PACCESS_MASK);
62 
63 DWORD
64 WINAPI
65 GetExplicitEntriesFromAclA(
66   _In_ PACL pacl,
67   _Out_ PULONG pcCountOfExplicitEntries,
68   _Outptr_result_buffer_(*pcCountOfExplicitEntries) PEXPLICIT_ACCESS_A *pListOfExplicitEntries);
69 
70 DWORD
71 WINAPI
72 GetExplicitEntriesFromAclW(
73   _In_ PACL pacl,
74   _Out_ PULONG pcCountOfExplicitEntries,
75   _Outptr_result_buffer_(*pcCountOfExplicitEntries) PEXPLICIT_ACCESS_W *pListOfExplicitEntries);
76 
77 #if (_WIN32_WINNT >= 0x0501)
78 
79 DWORD
80 WINAPI
81 GetInheritanceSourceA(
82   _In_ LPSTR pObjectName,
83   _In_ SE_OBJECT_TYPE ObjectType,
84   _In_ SECURITY_INFORMATION SecurityInfo,
85   _In_ BOOL Container,
86   _In_reads_opt_(GuidCount) GUID **pObjectClassGuids,
87   _In_ DWORD GuidCount,
88   _In_ PACL pAcl,
89   _In_opt_ PFN_OBJECT_MGR_FUNCTS pfnArray,
90   _In_ PGENERIC_MAPPING pGenericMapping,
91   _Out_ PINHERITED_FROMA pInheritArray);
92 
93 DWORD
94 WINAPI
95 GetInheritanceSourceW(
96   _In_ LPWSTR pObjectName,
97   _In_ SE_OBJECT_TYPE ObjectType,
98   _In_ SECURITY_INFORMATION SecurityInfo,
99   _In_ BOOL Container,
100   _In_reads_opt_(GuidCount) GUID **pObjectClassGuids,
101   _In_ DWORD GuidCount,
102   _In_ PACL pAcl,
103   _In_opt_ PFN_OBJECT_MGR_FUNCTS pfnArray,
104   _In_ PGENERIC_MAPPING pGenericMapping,
105   _Out_ PINHERITED_FROMW pInheritArray);
106 
107 #endif
108 
109 DWORD
110 WINAPI
111 GetNamedSecurityInfoA(
112   _In_ LPSTR pObjectName,
113   _In_ SE_OBJECT_TYPE ObjectType,
114   _In_ SECURITY_INFORMATION SecurityInfo,
115   _Out_opt_ PSID *ppsidOwner,
116   _Out_opt_ PSID *ppsidGroup,
117   _Out_opt_ PACL *ppDacl,
118   _Out_opt_ PACL *ppSacl,
119   _Out_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
120 
121 DWORD
122 WINAPI
123 GetNamedSecurityInfoW(
124   _In_ LPWSTR pObjectName,
125   _In_ SE_OBJECT_TYPE ObjectType,
126   _In_ SECURITY_INFORMATION SecurityInfo,
127   _Out_opt_ PSID *ppsidOwner,
128   _Out_opt_ PSID *ppsidGroup,
129   _Out_opt_ PACL *ppDacl,
130   _Out_opt_ PACL *ppSacl,
131   _Out_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
132 
133 DWORD
134 WINAPI
135 GetSecurityInfo(
136   _In_ HANDLE handle,
137   _In_ SE_OBJECT_TYPE ObjectType,
138   _In_ SECURITY_INFORMATION SecurityInfo,
139   _Out_opt_ PSID *ppsidOwner,
140   _Out_opt_ PSID *ppsidGroup,
141   _Out_opt_ PACL *ppDacl,
142   _Out_opt_ PACL *ppSacl,
143   _Out_opt_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
144 
145 TRUSTEE_FORM WINAPI GetTrusteeFormA(_In_ PTRUSTEE_A);
146 TRUSTEE_FORM WINAPI GetTrusteeFormW(_In_ PTRUSTEE_W);
147 LPSTR WINAPI GetTrusteeNameA(_In_ PTRUSTEE_A);
148 LPWSTR WINAPI GetTrusteeNameW(_In_ PTRUSTEE_W);
149 TRUSTEE_TYPE WINAPI GetTrusteeTypeA(_In_opt_ PTRUSTEE_A);
150 TRUSTEE_TYPE WINAPI GetTrusteeTypeW(_In_opt_ PTRUSTEE_W);
151 
152 DWORD
153 WINAPI
154 LookupSecurityDescriptorPartsA(
155   _Out_opt_ PTRUSTEE_A *ppOwner,
156   _Out_opt_ PTRUSTEE_A *ppGroup,
157   _Out_opt_ PULONG pcCountOfAccessEntries,
158   _Outptr_result_buffer_maybenull_(*pcCountOfAccessEntries) PEXPLICIT_ACCESS_A *ppListOfAccessEntries,
159   _Out_opt_ PULONG pcCountOfAuditEntries,
160   _Outptr_result_buffer_maybenull_(*pcCountOfAuditEntries) PEXPLICIT_ACCESS_A *ppListOfAuditEntries,
161   _In_ PSECURITY_DESCRIPTOR pSD);
162 
163 DWORD
164 WINAPI
165 LookupSecurityDescriptorPartsW(
166   _Out_opt_ PTRUSTEE_W *ppOwner,
167   _Out_opt_ PTRUSTEE_W *ppGroup,
168   _Out_opt_ PULONG pcCountOfAccessEntries,
169   _Outptr_result_buffer_maybenull_(*pcCountOfAccessEntries) PEXPLICIT_ACCESS_W *ppListOfAccessEntries,
170   _Out_opt_ PULONG pcCountOfAuditEntries,
171   _Outptr_result_buffer_maybenull_(*pcCountOfAuditEntries) PEXPLICIT_ACCESS_W *ppListOfAuditEntries,
172   _In_ PSECURITY_DESCRIPTOR pSD);
173 
174 DWORD
175 WINAPI
176 SetEntriesInAclA(
177   _In_ ULONG cCountOfExplicitEntries,
178   _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_A pListOfExplicitEntries,
179   _In_opt_ PACL OldAcl,
180   _Out_ PACL *NewAcl);
181 
182 DWORD
183 WINAPI
184 SetEntriesInAclW(
185   _In_ ULONG cCountOfExplicitEntries,
186   _In_reads_opt_(cCountOfExplicitEntries) PEXPLICIT_ACCESS_W pListOfExplicitEntries,
187   _In_opt_ PACL OldAcl,
188   _Out_ PACL *NewAcl);
189 
190 DWORD WINAPI SetNamedSecurityInfoA(_In_ LPSTR, _In_ SE_OBJECT_TYPE, _In_ SECURITY_INFORMATION, _In_opt_ PSID, _In_opt_ PSID, _In_opt_ PACL, _In_opt_ PACL);
191 DWORD WINAPI SetNamedSecurityInfoW(_In_ LPWSTR, _In_ SE_OBJECT_TYPE, _In_ SECURITY_INFORMATION, _In_opt_ PSID, _In_opt_ PSID, _In_opt_ PACL, _In_opt_ PACL);
192 DWORD WINAPI SetSecurityInfo(_In_ HANDLE, _In_ SE_OBJECT_TYPE, _In_ SECURITY_INFORMATION, _In_opt_ PSID, _In_opt_ PSID, _In_opt_ PACL, _In_opt_ PACL);
193 VOID WINAPI BuildImpersonateExplicitAccessWithNameA(_Inout_ PEXPLICIT_ACCESS_A, _In_opt_ LPSTR, _In_opt_ PTRUSTEE_A, _In_ DWORD, _In_ ACCESS_MODE, _In_ DWORD);
194 VOID WINAPI BuildImpersonateExplicitAccessWithNameW(_Inout_ PEXPLICIT_ACCESS_W, _In_opt_ LPWSTR, _In_opt_ PTRUSTEE_W, _In_ DWORD, _In_ ACCESS_MODE, _In_ DWORD);
195 VOID WINAPI BuildImpersonateTrusteeA(_Inout_ PTRUSTEE_A, _In_opt_ PTRUSTEE_A);
196 VOID WINAPI BuildImpersonateTrusteeW(_Inout_ PTRUSTEE_W, _In_opt_ PTRUSTEE_W);
197 PTRUSTEE_A WINAPI GetMultipleTrusteeA(_In_opt_ PTRUSTEE_A);
198 PTRUSTEE_W WINAPI GetMultipleTrusteeW(_In_opt_ PTRUSTEE_W);
199 MULTIPLE_TRUSTEE_OPERATION WINAPI GetMultipleTrusteeOperationA(_In_opt_ PTRUSTEE_A);
200 MULTIPLE_TRUSTEE_OPERATION WINAPI GetMultipleTrusteeOperationW(_In_opt_ PTRUSTEE_W);
201 
202 #ifdef UNICODE
203 #define BuildExplicitAccessWithName  BuildExplicitAccessWithNameW
204 #define BuildSecurityDescriptor  BuildSecurityDescriptorW
205 #define BuildTrusteeWithName  BuildTrusteeWithNameW
206 #define BuildTrusteeWithObjectsAndName  BuildTrusteeWithObjectsAndNameW
207 #define BuildTrusteeWithObjectsAndSid  BuildTrusteeWithObjectsAndSidW
208 #define BuildTrusteeWithSid  BuildTrusteeWithSidW
209 #define GetAuditedPermissionsFromAcl  GetAuditedPermissionsFromAclW
210 #define GetEffectiveRightsFromAcl  GetEffectiveRightsFromAclW
211 #define GetExplicitEntriesFromAcl  GetExplicitEntriesFromAclW
212 #define GetInheritanceSource  GetInheritanceSourceW
213 #define GetNamedSecurityInfo  GetNamedSecurityInfoW
214 #define GetTrusteeForm  GetTrusteeFormW
215 #define GetTrusteeName  GetTrusteeNameW
216 #define GetTrusteeType  GetTrusteeTypeW
217 #define LookupSecurityDescriptorParts  LookupSecurityDescriptorPartsW
218 #define SetEntriesInAcl  SetEntriesInAclW
219 #define SetNamedSecurityInfo  SetNamedSecurityInfoW
220 #define BuildImpersonateExplicitAccessWithName  BuildImpersonateExplicitAccessWithNameW
221 #define BuildImpersonateTrustee  BuildImpersonateTrusteeW
222 #define GetMultipleTrustee  GetMultipleTrusteeW
223 #define GetMultipleTrusteeOperation  GetMultipleTrusteeOperationW
224 #else
225 #define BuildExplicitAccessWithName  BuildExplicitAccessWithNameA
226 #define BuildSecurityDescriptor  BuildSecurityDescriptorA
227 #define BuildTrusteeWithName  BuildTrusteeWithNameA
228 #define BuildTrusteeWithObjectsAndName  BuildTrusteeWithObjectsAndNameA
229 #define BuildTrusteeWithObjectsAndSid  BuildTrusteeWithObjectsAndSidA
230 #define BuildTrusteeWithSid  BuildTrusteeWithSidA
231 #define GetAuditedPermissionsFromAcl  GetAuditedPermissionsFromAclA
232 #define GetEffectiveRightsFromAcl  GetEffectiveRightsFromAclA
233 #define GetExplicitEntriesFromAcl  GetExplicitEntriesFromAclA
234 #define GetInheritanceSource  GetInheritanceSourceA
235 #define GetNamedSecurityInfo  GetNamedSecurityInfoA
236 #define GetTrusteeForm  GetTrusteeFormA
237 #define GetTrusteeName  GetTrusteeNameA
238 #define GetTrusteeType  GetTrusteeTypeA
239 #define LookupSecurityDescriptorParts  LookupSecurityDescriptorPartsA
240 #define SetEntriesInAcl  SetEntriesInAclA
241 #define SetNamedSecurityInfo  SetNamedSecurityInfoA
242 #define BuildImpersonateExplicitAccessWithName  BuildImpersonateExplicitAccessWithNameA
243 #define BuildImpersonateTrustee  BuildImpersonateTrusteeA
244 #define GetMultipleTrustee  GetMultipleTrusteeA
245 #define GetMultipleTrusteeOperation  GetMultipleTrusteeOperationA
246 #endif /* UNICODE */
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 #endif
252