Hans Leidekker : advapi32: Return a fake security descriptor from CreatePrivateObjectSecurity.

Alexandre Julliard julliard at winehq.org
Fri Mar 30 11:27:06 CDT 2012


Module: wine
Branch: master
Commit: 40427f1a7741fdc65d32db8480415740f8f19374
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=40427f1a7741fdc65d32db8480415740f8f19374

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Mar 30 12:19:23 2012 +0200

advapi32: Return a fake security descriptor from CreatePrivateObjectSecurity.

Based on a patch by Robert Shearman.

---

 dlls/advapi32/security.c |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 172b9a2..9df27db 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -5105,16 +5105,53 @@ BOOL WINAPI CreatePrivateObjectSecurity(
         HANDLE Token,
         PGENERIC_MAPPING GenericMapping )
 {
-    FIXME("%p %p %p %d %p %p - stub\n", ParentDescriptor, CreatorDescriptor,
-          NewDescriptor, IsDirectoryObject, Token, GenericMapping);
+    SECURITY_DESCRIPTOR_RELATIVE *relative;
+    DWORD needed, offset;
+    BYTE *buffer;
 
-    return FALSE;
+    FIXME("%p %p %p %d %p %p - returns fake SECURITY_DESCRIPTOR\n", ParentDescriptor,
+          CreatorDescriptor, NewDescriptor, IsDirectoryObject, Token, GenericMapping);
+
+    needed = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
+    needed += sizeof(sidWorld);
+    needed += sizeof(sidWorld);
+    needed += WINE_SIZE_OF_WORLD_ACCESS_ACL;
+    needed += WINE_SIZE_OF_WORLD_ACCESS_ACL;
+
+    if (!(buffer = HeapAlloc( GetProcessHeap(), 0, needed ))) return FALSE;
+    relative = (SECURITY_DESCRIPTOR_RELATIVE *)buffer;
+    if (!InitializeSecurityDescriptor( relative, SECURITY_DESCRIPTOR_REVISION ))
+    {
+        HeapFree( GetProcessHeap(), 0, buffer );
+        return FALSE;
+    }
+    relative->Control |= SE_SELF_RELATIVE;
+    offset = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
+
+    memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) );
+    relative->Owner = offset;
+    offset += sizeof(sidWorld);
+
+    memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) );
+    relative->Group = offset;
+    offset += sizeof(sidWorld);
+
+    GetWorldAccessACL( (ACL *)(buffer + offset) );
+    relative->Dacl = offset;
+    offset += WINE_SIZE_OF_WORLD_ACCESS_ACL;
+
+    GetWorldAccessACL( (ACL *)(buffer + offset) );
+    relative->Sacl = offset;
+
+    *NewDescriptor = relative;
+    return TRUE;
 }
 
 BOOL WINAPI DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR* ObjectDescriptor )
 {
     FIXME("%p - stub\n", ObjectDescriptor);
 
+    HeapFree( GetProcessHeap(), 0, *ObjectDescriptor );
     return TRUE;
 }
 




More information about the wine-cvs mailing list