implemented some stubs needed by ClamWin
[reactos.git] / reactos / lib / advapi32 / sec / sec.c
index 04a80d8..20d664e 100644 (file)
@@ -1,20 +1,24 @@
-/*
+/* $Id$
+ *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            lib/advapi32/sec/sec.c
- * PURPOSE:         Registry functions
+ * PURPOSE:         Security descriptor functions
  * PROGRAMMER:      Ariadne ( ariadne@xs4all.nl)
- *                 Steven Edwards ( Steven_Ed4153@yahoo.com )
+ *                  Steven Edwards ( Steven_Ed4153@yahoo.com )
+ *                  Andrew Greenwood ( silverblade_uk@hotmail.com )
  * UPDATE HISTORY:
  *                  Created 01/11/98
- *                  Added a few new stubs 6/27/03
  */
 
-#define NTOS_MODE_USER
-#include <ntos.h>
-#include <windows.h>
+#include <advapi32.h>
 
+#define NDEBUG
+#include <debug.h>
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 GetSecurityDescriptorControl (
@@ -38,6 +42,9 @@ GetSecurityDescriptorControl (
 }
 
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 GetSecurityDescriptorDacl (
@@ -68,6 +75,9 @@ GetSecurityDescriptorDacl (
 }
 
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 GetSecurityDescriptorGroup (
@@ -94,23 +104,16 @@ GetSecurityDescriptorGroup (
 }
 
 
-DWORD
-STDCALL
-GetSecurityDescriptorLength (
-       PSECURITY_DESCRIPTOR    pSecurityDescriptor
-       )
-{
-       return RtlLengthSecurityDescriptor(pSecurityDescriptor);
-}
-
-
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 GetSecurityDescriptorOwner (
        PSECURITY_DESCRIPTOR    pSecurityDescriptor,
        PSID                    *pOwner,
        LPBOOL                  lpbOwnerDefaulted
-)
+       )
 {
        BOOLEAN OwnerDefaulted;
        NTSTATUS Status;
@@ -130,6 +133,26 @@ GetSecurityDescriptorOwner (
 }
 
 
+/*
+ * @implemented
+ */
+DWORD
+STDCALL
+GetSecurityDescriptorRMControl (
+       PSECURITY_DESCRIPTOR    SecurityDescriptor,
+       PUCHAR                  RMControl)
+{
+  if (!RtlGetSecurityDescriptorRMControl(SecurityDescriptor,
+                                        RMControl))
+    return ERROR_INVALID_DATA;
+
+  return ERROR_SUCCESS;
+}
+
+
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 GetSecurityDescriptorSacl (
@@ -160,6 +183,9 @@ GetSecurityDescriptorSacl (
 }
 
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 InitializeSecurityDescriptor (
@@ -180,6 +206,10 @@ InitializeSecurityDescriptor (
        return TRUE;
 }
 
+
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 IsValidSecurityDescriptor (
@@ -196,7 +226,10 @@ IsValidSecurityDescriptor (
 }
 
 
-WINBOOL
+/*
+ * @implemented
+ */
+BOOL
 STDCALL
 MakeAbsoluteSD (
        PSECURITY_DESCRIPTOR    pSelfRelativeSecurityDescriptor,
@@ -235,7 +268,32 @@ MakeAbsoluteSD (
 }
 
 
-WINBOOL
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+MakeAbsoluteSD2(IN OUT PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
+                OUT LPDWORD lpdwBufferSize)
+{
+    NTSTATUS Status;
+
+    Status = RtlSelfRelativeToAbsoluteSD2(pSelfRelativeSecurityDescriptor,
+                                          lpdwBufferSize);
+       if (!NT_SUCCESS(Status))
+       {
+               SetLastError (RtlNtStatusToDosError (Status));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
+BOOL
 STDCALL
 MakeSelfRelativeSD (
        PSECURITY_DESCRIPTOR    pAbsoluteSecurityDescriptor,
@@ -258,6 +316,34 @@ MakeSelfRelativeSD (
 }
 
 
+/*
+ * @implemented
+ */
+BOOL
+STDCALL
+SetSecurityDescriptorControl (
+       PSECURITY_DESCRIPTOR            pSecurityDescriptor,
+       SECURITY_DESCRIPTOR_CONTROL     ControlBitsOfInterest,
+       SECURITY_DESCRIPTOR_CONTROL     ControlBitsToSet)
+{
+       NTSTATUS Status;
+
+       Status = RtlSetControlSecurityDescriptor(pSecurityDescriptor,
+                                                ControlBitsOfInterest,
+                                                ControlBitsToSet);
+       if (!NT_SUCCESS(Status))
+       {
+               SetLastError (RtlNtStatusToDosError (Status));
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 SetSecurityDescriptorDacl (
@@ -283,6 +369,9 @@ SetSecurityDescriptorDacl (
 }
 
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 SetSecurityDescriptorGroup (
@@ -306,6 +395,9 @@ SetSecurityDescriptorGroup (
 }
 
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 SetSecurityDescriptorOwner (
@@ -316,7 +408,7 @@ SetSecurityDescriptorOwner (
 {
        NTSTATUS Status;
 
-       Status = RtlSetGroupSecurityDescriptor (pSecurityDescriptor,
+       Status = RtlSetOwnerSecurityDescriptor (pSecurityDescriptor,
                                                pOwner,
                                                bOwnerDefaulted);
        if (!NT_SUCCESS(Status))
@@ -329,6 +421,25 @@ SetSecurityDescriptorOwner (
 }
 
 
+/*
+ * @implemented
+ */
+DWORD
+STDCALL
+SetSecurityDescriptorRMControl (
+       PSECURITY_DESCRIPTOR    SecurityDescriptor,
+       PUCHAR                  RMControl)
+{
+  RtlSetSecurityDescriptorRMControl(SecurityDescriptor,
+                                   RMControl);
+
+  return ERROR_SUCCESS;
+}
+
+
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 SetSecurityDescriptorSacl (
@@ -353,52 +464,120 @@ SetSecurityDescriptorSacl (
        return TRUE;
 }
 
-BOOL STDCALL
-GetUserNameA(LPSTR lpBuffer, LPDWORD nSize)
+
+/*
+ * @unimplemented
+ */
+BOOL
+STDCALL
+ConvertToAutoInheritPrivateObjectSecurity(IN PSECURITY_DESCRIPTOR ParentDescriptor,
+                                          IN PSECURITY_DESCRIPTOR CurrentSecurityDescriptor,
+                                          OUT PSECURITY_DESCRIPTOR* NewSecurityDescriptor,
+                                          IN GUID* ObjectType,
+                                          IN BOOLEAN IsDirectoryObject,
+                                          IN PGENERIC_MAPPING GenericMapping)
 {
-  return(FALSE);
+    UNIMPLEMENTED;
+    return FALSE;
 }
 
-BOOL STDCALL
-GetUserNameW(LPWSTR lpBuffer, LPDWORD nSize)
+
+/*
+ * @unimplemented
+ */
+DWORD
+STDCALL
+BuildSecurityDescriptorW(IN PTRUSTEE_W pOwner  OPTIONAL,
+                         IN PTRUSTEE_W pGroup  OPTIONAL,
+                         IN ULONG cCountOfAccessEntries,
+                         IN PEXPLICIT_ACCESS pListOfAccessEntries  OPTIONAL,
+                         IN ULONG cCountOfAuditEntries,
+                         IN PEXPLICIT_ACCESS pListOfAuditEntries  OPTIONAL,
+                         IN PSECURITY_DESCRIPTOR pOldSD  OPTIONAL,
+                         OUT PULONG pSizeNewSD,
+                         OUT PSECURITY_DESCRIPTOR* pNewSD)
 {
-  return(FALSE);
+    UNIMPLEMENTED;
+    return FALSE;
 }
 
-WINBOOL
+
+/*
+ * @unimplemented
+ */
+DWORD
 STDCALL
-GetFileSecurityA (
-    LPCSTR lpFileName,
-    SECURITY_INFORMATION RequestedInformation,
-    PSECURITY_DESCRIPTOR pSecurityDescriptor,
-    DWORD nLength,
-    LPDWORD lpnLengthNeeded
-    )
+BuildSecurityDescriptorA(IN PTRUSTEE_A pOwner  OPTIONAL,
+                         IN PTRUSTEE_A pGroup  OPTIONAL,
+                         IN ULONG cCountOfAccessEntries,
+                         IN PEXPLICIT_ACCESS pListOfAccessEntries  OPTIONAL,
+                         IN ULONG cCountOfAuditEntries,
+                         IN PEXPLICIT_ACCESS pListOfAuditEntries  OPTIONAL,
+                         IN PSECURITY_DESCRIPTOR pOldSD  OPTIONAL,
+                         OUT PULONG pSizeNewSD,
+                         OUT PSECURITY_DESCRIPTOR* pNewSD)
 {
-  return(FALSE);
+    UNIMPLEMENTED;
+    return FALSE;
 }
 
-WINBOOL
-STDCALL
-GetFileSecurityW (
-    LPCWSTR lpFileName,
-    SECURITY_INFORMATION RequestedInformation,
-    PSECURITY_DESCRIPTOR pSecurityDescriptor,
-    DWORD nLength,
-    LPDWORD lpnLengthNeeded
-    )
+
+/*
+ * @unimplemented
+ */
+BOOL WINAPI DecryptFileW(LPCWSTR lpFileName, DWORD dwReserved)
 {
-  return(FALSE);
+    DPRINT1("%s() not implemented!\n", __FUNCTION__);
+    return ERROR_CALL_NOT_IMPLEMENTED;
 }
 
-WINBOOL
-STDCALL
-SetFileSecurityA (
-    LPCSTR lpFileName,
-    SECURITY_INFORMATION SecurityInformation,
-    PSECURITY_DESCRIPTOR pSecurityDescriptor
-    )
+/*
+ * @unimplemented
+ */
+BOOL WINAPI DecryptFileA(LPCSTR lpFileName, DWORD dwReserved)
+{
+    DPRINT1("%s() not implemented!\n", __FUNCTION__);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL WINAPI EncryptFileW(LPCWSTR lpFileName)
+{
+    DPRINT1("%s() not implemented!\n", __FUNCTION__);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+BOOL WINAPI EncryptFileA(LPCSTR lpFileName)
+{
+    DPRINT1("%s() not implemented!\n", __FUNCTION__);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(
+    PSECURITY_DESCRIPTOR pSecurityDescriptor, 
+    DWORD dword, 
+    SECURITY_INFORMATION SecurityInformation, 
+    LPWSTR* lpwstr,
+    PULONG pulong)
 {
-  return(FALSE);
+    DPRINT1("%s() not implemented!\n", __FUNCTION__);
+    return ERROR_CALL_NOT_IMPLEMENTED;
 }
+
+BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA(
+    PSECURITY_DESCRIPTOR pSecurityDescriptor, 
+    DWORD dword, 
+    SECURITY_INFORMATION SecurityInformation, 
+    LPSTR* lpstr,
+    PULONG pulong)
+{
+    DPRINT1("%s() not implemented!\n", __FUNCTION__);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
 /* EOF */