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 )
8 * Andrew Greenwood ( silverblade_uk@hotmail.com )
11 * Added a few new stubs 6/27/03
12 * Added stubs for GetSecurityInfo/Ex 8/18/03
15 #define NTOS_MODE_USER
17 // #include <accctrl.h>
26 GetSecurityDescriptorControl (
27 PSECURITY_DESCRIPTOR pSecurityDescriptor,
28 PSECURITY_DESCRIPTOR_CONTROL pControl,
34 Status = RtlGetControlSecurityDescriptor (pSecurityDescriptor,
36 (PULONG)lpdwRevision);
37 if (!NT_SUCCESS(Status))
39 SetLastError (RtlNtStatusToDosError (Status));
52 GetSecurityDescriptorDacl (
53 PSECURITY_DESCRIPTOR pSecurityDescriptor,
54 LPBOOL lpbDaclPresent,
56 LPBOOL lpbDaclDefaulted
60 BOOLEAN DaclDefaulted;
63 Status = RtlGetDaclSecurityDescriptor (pSecurityDescriptor,
67 *lpbDaclPresent = (BOOL)DaclPresent;
68 *lpbDaclDefaulted = (BOOL)DaclDefaulted;
70 if (!NT_SUCCESS(Status))
72 SetLastError (RtlNtStatusToDosError (Status));
85 GetSecurityDescriptorGroup (
86 PSECURITY_DESCRIPTOR pSecurityDescriptor,
88 LPBOOL lpbGroupDefaulted
91 BOOLEAN GroupDefaulted;
94 Status = RtlGetGroupSecurityDescriptor (pSecurityDescriptor,
97 *lpbGroupDefaulted = (BOOL)GroupDefaulted;
99 if (!NT_SUCCESS(Status))
101 SetLastError (RtlNtStatusToDosError (Status));
114 GetSecurityDescriptorLength (
115 PSECURITY_DESCRIPTOR pSecurityDescriptor
118 return RtlLengthSecurityDescriptor(pSecurityDescriptor);
127 GetSecurityDescriptorOwner (
128 PSECURITY_DESCRIPTOR pSecurityDescriptor,
130 LPBOOL lpbOwnerDefaulted
133 BOOLEAN OwnerDefaulted;
136 Status = RtlGetOwnerSecurityDescriptor (pSecurityDescriptor,
139 *lpbOwnerDefaulted = (BOOL)OwnerDefaulted;
141 if (!NT_SUCCESS(Status))
143 SetLastError (RtlNtStatusToDosError (Status));
156 GetSecurityDescriptorSacl (
157 PSECURITY_DESCRIPTOR pSecurityDescriptor,
158 LPBOOL lpbSaclPresent,
160 LPBOOL lpbSaclDefaulted
164 BOOLEAN SaclDefaulted;
167 Status = RtlGetSaclSecurityDescriptor (pSecurityDescriptor,
171 *lpbSaclPresent = (BOOL)SaclPresent;
172 *lpbSaclDefaulted = (BOOL)SaclDefaulted;
174 if (!NT_SUCCESS(Status))
176 SetLastError (RtlNtStatusToDosError (Status));
189 InitializeSecurityDescriptor (
190 PSECURITY_DESCRIPTOR pSecurityDescriptor,
196 Status = RtlCreateSecurityDescriptor (pSecurityDescriptor,
198 if (!NT_SUCCESS(Status))
200 SetLastError (RtlNtStatusToDosError (Status));
213 IsValidSecurityDescriptor (
214 PSECURITY_DESCRIPTOR pSecurityDescriptor
219 Result = RtlValidSecurityDescriptor (pSecurityDescriptor);
221 SetLastError (RtlNtStatusToDosError (STATUS_INVALID_SECURITY_DESCR));
233 PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
234 PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
235 LPDWORD lpdwAbsoluteSecurityDescriptorSize,
237 LPDWORD lpdwDaclSize,
239 LPDWORD lpdwSaclSize,
241 LPDWORD lpdwOwnerSize,
243 LPDWORD lpdwPrimaryGroupSize
248 Status = RtlSelfRelativeToAbsoluteSD (pSelfRelativeSecurityDescriptor,
249 pAbsoluteSecurityDescriptor,
250 lpdwAbsoluteSecurityDescriptorSize,
258 lpdwPrimaryGroupSize);
259 if (!NT_SUCCESS(Status))
261 SetLastError (RtlNtStatusToDosError (Status));
275 PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
276 PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
277 LPDWORD lpdwBufferLength
282 Status = RtlAbsoluteToSelfRelativeSD (pAbsoluteSecurityDescriptor,
283 pSelfRelativeSecurityDescriptor,
284 (PULONG)lpdwBufferLength);
285 if (!NT_SUCCESS(Status))
287 SetLastError (RtlNtStatusToDosError (Status));
300 SetSecurityDescriptorDacl (
301 PSECURITY_DESCRIPTOR pSecurityDescriptor,
309 Status = RtlSetDaclSecurityDescriptor (pSecurityDescriptor,
313 if (!NT_SUCCESS(Status))
315 SetLastError (RtlNtStatusToDosError (Status));
328 SetSecurityDescriptorGroup (
329 PSECURITY_DESCRIPTOR pSecurityDescriptor,
336 Status = RtlSetGroupSecurityDescriptor (pSecurityDescriptor,
339 if (!NT_SUCCESS(Status))
341 SetLastError (RtlNtStatusToDosError (Status));
354 SetSecurityDescriptorOwner (
355 PSECURITY_DESCRIPTOR pSecurityDescriptor,
362 Status = RtlSetGroupSecurityDescriptor (pSecurityDescriptor,
365 if (!NT_SUCCESS(Status))
367 SetLastError (RtlNtStatusToDosError (Status));
380 SetSecurityDescriptorSacl (
381 PSECURITY_DESCRIPTOR pSecurityDescriptor,
389 Status = RtlSetSaclSecurityDescriptor (pSecurityDescriptor,
393 if (!NT_SUCCESS(Status))
395 SetLastError (RtlNtStatusToDosError (Status));
407 GetUserNameA(LPSTR lpBuffer, LPDWORD nSize)
417 GetUserNameW(LPWSTR lpBuffer, LPDWORD nSize)
430 SECURITY_INFORMATION RequestedInformation,
431 PSECURITY_DESCRIPTOR pSecurityDescriptor,
433 LPDWORD lpnLengthNeeded
447 SECURITY_INFORMATION RequestedInformation,
448 PSECURITY_DESCRIPTOR pSecurityDescriptor,
450 LPDWORD lpnLengthNeeded
464 SECURITY_INFORMATION SecurityInformation,
465 PSECURITY_DESCRIPTOR pSecurityDescriptor
475 STDCALL DWORD GetSecurityInfo (
477 UINT ObjectType, // SE_OBJECT_TYPE
478 SECURITY_INFORMATION SecurityInfo,
483 PSECURITY_DESCRIPTOR *ppSecurityDescriptor
493 STDCALL DWORD GetSecurityInfoExA(
495 UINT ObjectType, // SE_OBJECT_TYPE
496 SECURITY_INFORMATION SecurityInfo,
499 VOID *ppAccessList, // PACTRL_ACCESS
500 VOID *ppAuditList, // PACTRL_AUDIT
512 STDCALL DWORD GetSecurityInfoExW(
514 UINT ObjectType, // SE_OBJECT_TYPE
515 SECURITY_INFORMATION SecurityInfo,
518 VOID *ppAccessList, // PACTRL_ACCESS
519 VOID *ppAuditList, // PACTRL_AUDIT