2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/advapi32/sec/sec.c
5 * PURPOSE: Registry functions
6 * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
7 * Steven Edwards ( Steven_Ed4153@yahoo.com )
10 * Added a few new stubs 6/27/03
13 #define NTOS_MODE_USER
23 GetSecurityDescriptorControl (
24 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
25 PSECURITY_DESCRIPTOR_CONTROL pControl
,
31 Status
= RtlGetControlSecurityDescriptor (pSecurityDescriptor
,
33 (PULONG
)lpdwRevision
);
34 if (!NT_SUCCESS(Status
))
36 SetLastError (RtlNtStatusToDosError (Status
));
49 GetSecurityDescriptorDacl (
50 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
51 LPBOOL lpbDaclPresent
,
53 LPBOOL lpbDaclDefaulted
57 BOOLEAN DaclDefaulted
;
60 Status
= RtlGetDaclSecurityDescriptor (pSecurityDescriptor
,
64 *lpbDaclPresent
= (BOOL
)DaclPresent
;
65 *lpbDaclDefaulted
= (BOOL
)DaclDefaulted
;
67 if (!NT_SUCCESS(Status
))
69 SetLastError (RtlNtStatusToDosError (Status
));
82 GetSecurityDescriptorGroup (
83 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
85 LPBOOL lpbGroupDefaulted
88 BOOLEAN GroupDefaulted
;
91 Status
= RtlGetGroupSecurityDescriptor (pSecurityDescriptor
,
94 *lpbGroupDefaulted
= (BOOL
)GroupDefaulted
;
96 if (!NT_SUCCESS(Status
))
98 SetLastError (RtlNtStatusToDosError (Status
));
111 GetSecurityDescriptorLength (
112 PSECURITY_DESCRIPTOR pSecurityDescriptor
115 return RtlLengthSecurityDescriptor(pSecurityDescriptor
);
124 GetSecurityDescriptorOwner (
125 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
127 LPBOOL lpbOwnerDefaulted
130 BOOLEAN OwnerDefaulted
;
133 Status
= RtlGetOwnerSecurityDescriptor (pSecurityDescriptor
,
136 *lpbOwnerDefaulted
= (BOOL
)OwnerDefaulted
;
138 if (!NT_SUCCESS(Status
))
140 SetLastError (RtlNtStatusToDosError (Status
));
153 GetSecurityDescriptorSacl (
154 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
155 LPBOOL lpbSaclPresent
,
157 LPBOOL lpbSaclDefaulted
161 BOOLEAN SaclDefaulted
;
164 Status
= RtlGetSaclSecurityDescriptor (pSecurityDescriptor
,
168 *lpbSaclPresent
= (BOOL
)SaclPresent
;
169 *lpbSaclDefaulted
= (BOOL
)SaclDefaulted
;
171 if (!NT_SUCCESS(Status
))
173 SetLastError (RtlNtStatusToDosError (Status
));
186 InitializeSecurityDescriptor (
187 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
193 Status
= RtlCreateSecurityDescriptor (pSecurityDescriptor
,
195 if (!NT_SUCCESS(Status
))
197 SetLastError (RtlNtStatusToDosError (Status
));
210 IsValidSecurityDescriptor (
211 PSECURITY_DESCRIPTOR pSecurityDescriptor
216 Result
= RtlValidSecurityDescriptor (pSecurityDescriptor
);
218 SetLastError (RtlNtStatusToDosError (STATUS_INVALID_SECURITY_DESCR
));
230 PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor
,
231 PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor
,
232 LPDWORD lpdwAbsoluteSecurityDescriptorSize
,
234 LPDWORD lpdwDaclSize
,
236 LPDWORD lpdwSaclSize
,
238 LPDWORD lpdwOwnerSize
,
240 LPDWORD lpdwPrimaryGroupSize
245 Status
= RtlSelfRelativeToAbsoluteSD (pSelfRelativeSecurityDescriptor
,
246 pAbsoluteSecurityDescriptor
,
247 lpdwAbsoluteSecurityDescriptorSize
,
255 lpdwPrimaryGroupSize
);
256 if (!NT_SUCCESS(Status
))
258 SetLastError (RtlNtStatusToDosError (Status
));
272 PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor
,
273 PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor
,
274 LPDWORD lpdwBufferLength
279 Status
= RtlAbsoluteToSelfRelativeSD (pAbsoluteSecurityDescriptor
,
280 pSelfRelativeSecurityDescriptor
,
281 (PULONG
)lpdwBufferLength
);
282 if (!NT_SUCCESS(Status
))
284 SetLastError (RtlNtStatusToDosError (Status
));
297 SetSecurityDescriptorDacl (
298 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
306 Status
= RtlSetDaclSecurityDescriptor (pSecurityDescriptor
,
310 if (!NT_SUCCESS(Status
))
312 SetLastError (RtlNtStatusToDosError (Status
));
325 SetSecurityDescriptorGroup (
326 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
333 Status
= RtlSetGroupSecurityDescriptor (pSecurityDescriptor
,
336 if (!NT_SUCCESS(Status
))
338 SetLastError (RtlNtStatusToDosError (Status
));
351 SetSecurityDescriptorOwner (
352 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
359 Status
= RtlSetGroupSecurityDescriptor (pSecurityDescriptor
,
362 if (!NT_SUCCESS(Status
))
364 SetLastError (RtlNtStatusToDosError (Status
));
377 SetSecurityDescriptorSacl (
378 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
386 Status
= RtlSetSaclSecurityDescriptor (pSecurityDescriptor
,
390 if (!NT_SUCCESS(Status
))
392 SetLastError (RtlNtStatusToDosError (Status
));
404 GetUserNameA(LPSTR lpBuffer
, LPDWORD nSize
)
414 GetUserNameW(LPWSTR lpBuffer
, LPDWORD nSize
)
427 SECURITY_INFORMATION RequestedInformation
,
428 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
430 LPDWORD lpnLengthNeeded
444 SECURITY_INFORMATION RequestedInformation
,
445 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
447 LPDWORD lpnLengthNeeded
461 SECURITY_INFORMATION SecurityInformation
,
462 PSECURITY_DESCRIPTOR pSecurityDescriptor