Implement private object security functions.
authorEric Kohl <eric.kohl@reactos.org>
Mon, 27 Jun 2005 22:42:28 +0000 (22:42 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 27 Jun 2005 22:42:28 +0000 (22:42 +0000)
svn path=/trunk/; revision=16309

reactos/lib/advapi32/advapi32.def
reactos/lib/advapi32/sec/misc.c

index bc0881b..1209f22 100644 (file)
@@ -98,7 +98,7 @@ ConvertSidToStringSidW@8
 ;ConvertToAutoInheritPrivateObjectSecurity@24
 CopySid@12
 ;CreateCodeAuthzLevel@20
-;CreatePrivateObjectSecurity@24
+CreatePrivateObjectSecurity@24
 ;CreatePrivateObjectSecurityEx@32
 ;CreatePrivateObjectSecurityWithMultipleInheritance@36
 CreateProcessAsUserA@44
@@ -183,7 +183,7 @@ CryptVerifySignatureW@24
 DeleteAce@8
 DeleteService@4
 DeregisterEventSource@4
-;DestroyPrivateObjectSecurity@4
+DestroyPrivateObjectSecurity@4
 ;DuplicateEncryptionInfoFile
 DuplicateToken@12
 DuplicateTokenEx@24
@@ -267,7 +267,7 @@ GetNamedSecurityInfoW@32
 GetNumberOfEventLogRecords@8
 GetOldestEventLogRecord@8
 ;GetOverlappedAccessResults
-;GetPrivateObjectSecurity@20
+GetPrivateObjectSecurity@20
 GetSecurityDescriptorControl@12
 GetSecurityDescriptorDacl@16
 GetSecurityDescriptorGroup@12
@@ -563,7 +563,7 @@ SetNamedSecurityInfoA@28
 ;SetNamedSecurityInfoExA
 ;SetNamedSecurityInfoExW
 SetNamedSecurityInfoW@28
-;SetPrivateObjectSecurity@20
+SetPrivateObjectSecurity@20
 ;SetPrivateObjectSecurityEx
 SetSecurityDescriptorControl@12
 SetSecurityDescriptorDacl@16
index 05c6358..4b1f270 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            lib/advapi32/sec/misc.c
@@ -1264,4 +1263,106 @@ ImpersonateNamedPipeClient(HANDLE hNamedPipe)
   return TRUE;
 }
 
+
+/*
+ * @implemented
+ */
+BOOL STDCALL
+CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,
+                            PSECURITY_DESCRIPTOR CreatorDescriptor,
+                            PSECURITY_DESCRIPTOR *NewDescriptor,
+                            BOOL IsDirectoryObject,
+                            HANDLE Token,
+                            PGENERIC_MAPPING GenericMapping)
+{
+    NTSTATUS Status;
+
+    Status = RtlNewSecurityObject(ParentDescriptor,
+                                  CreatorDescriptor,
+                                  NewDescriptor,
+                                  IsDirectoryObject,
+                                  Token,
+                                  GenericMapping);
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastError(RtlNtStatusToDosError(Status));
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL STDCALL
+DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor)
+{
+    NTSTATUS Status;
+
+    Status = RtlDeleteSecurityObject(ObjectDescriptor);
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastError(RtlNtStatusToDosError(Status));
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL STDCALL
+GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,
+                         SECURITY_INFORMATION SecurityInformation,
+                         PSECURITY_DESCRIPTOR ResultantDescriptor,
+                         DWORD DescriptorLength,
+                         PDWORD ReturnLength)
+{
+    NTSTATUS Status;
+
+    Status = RtlQuerySecurityObject(ObjectDescriptor,
+                                    SecurityInformation,
+                                    ResultantDescriptor,
+                                    DescriptorLength,
+                                    ReturnLength);
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastError(RtlNtStatusToDosError(Status));
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL STDCALL
+SetPrivateObjectSecurity(SECURITY_INFORMATION SecurityInformation,
+                         PSECURITY_DESCRIPTOR ModificationDescriptor,
+                         PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
+                         PGENERIC_MAPPING GenericMapping,
+                         HANDLE Token)
+{
+    NTSTATUS Status;
+
+    Status = RtlSetSecurityObject(SecurityInformation,
+                                  ModificationDescriptor,
+                                  ObjectsSecurityDescriptor,
+                                  GenericMapping,
+                                  Token);
+    if (!NT_SUCCESS(Status))
+    {
+        SetLastError(RtlNtStatusToDosError(Status));
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
 /* EOF */