diff --git a/reactos/lib/advapi32/advapi32.def b/reactos/lib/advapi32/advapi32.def index bc0881b6426..1209f22496b 100644 --- a/reactos/lib/advapi32/advapi32.def +++ b/reactos/lib/advapi32/advapi32.def @@ -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 diff --git a/reactos/lib/advapi32/sec/misc.c b/reactos/lib/advapi32/sec/misc.c index 05c63584bdb..4b1f2703053 100644 --- a/reactos/lib/advapi32/sec/misc.c +++ b/reactos/lib/advapi32/sec/misc.c @@ -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 */