Author: jimtabor
Date: Fri Jan 2 17:52:37 2009
New Revision: 38513
URL:
http://svn.reactos.org/svn/reactos?rev=38513&view=rev
Log:
- Implement RtlQuerySecurityObject.
Modified:
trunk/reactos/lib/rtl/security.c
Modified: trunk/reactos/lib/rtl/security.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/security.c?rev=385…
==============================================================================
--- trunk/reactos/lib/rtl/security.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/security.c [iso-8859-1] Fri Jan 2 17:52:37 2009
@@ -228,8 +228,49 @@
IN ULONG DescriptorLength,
OUT PULONG ReturnLength)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ NTSTATUS Status;
+ SECURITY_DESCRIPTOR desc;
+ BOOLEAN defaulted, present;
+ PACL pacl;
+ PSID psid;
+
+ Status = RtlCreateSecurityDescriptor(&desc, SECURITY_DESCRIPTOR_REVISION);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ if (SecurityInformation & OWNER_SECURITY_INFORMATION)
+ {
+ Status = RtlGetOwnerSecurityDescriptor(ObjectDescriptor, &psid,
&defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ Status = RtlSetOwnerSecurityDescriptor(&desc, psid, defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ }
+
+ if (SecurityInformation & GROUP_SECURITY_INFORMATION)
+ {
+ Status = RtlGetGroupSecurityDescriptor(ObjectDescriptor, &psid,
&defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ Status = RtlSetGroupSecurityDescriptor(&desc, psid, defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ }
+
+ if (SecurityInformation & DACL_SECURITY_INFORMATION)
+ {
+ Status = RtlGetDaclSecurityDescriptor(ObjectDescriptor, &present, &pacl,
&defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ Status = RtlSetDaclSecurityDescriptor(&desc, present, pacl, defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ }
+
+ if (SecurityInformation & SACL_SECURITY_INFORMATION)
+ {
+ Status = RtlGetSaclSecurityDescriptor(ObjectDescriptor, &present, &pacl,
&defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ Status = RtlSetSaclSecurityDescriptor(&desc, present, pacl, defaulted);
+ if (!NT_SUCCESS(Status)) return Status;
+ }
+
+ *ReturnLength = DescriptorLength;
+ return RtlAbsoluteToSelfRelativeSD(&desc, ResultantDescriptor, ReturnLength);
}