Dmitry Timoshkov : advapi32: Thunk GetFileSecurityW to NtQuerySecurityObject.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 23 08:39:14 CDT 2007


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

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Sat Apr 21 18:12:36 2007 +0900

advapi32: Thunk GetFileSecurityW to NtQuerySecurityObject.

---

 dlls/advapi32/security.c |   64 ++++++---------------------------------------
 1 files changed, 9 insertions(+), 55 deletions(-)

diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 1dbc5e3..80dd89f 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -1746,64 +1746,18 @@ GetFileSecurityW( LPCWSTR lpFileName,
                     PSECURITY_DESCRIPTOR pSecurityDescriptor,
                     DWORD nLength, LPDWORD lpnLengthNeeded )
 {
-    DWORD		nNeeded;
-    LPBYTE	pBuffer;
-    DWORD		iLocNow;
-    SECURITY_DESCRIPTOR_RELATIVE *pSDRelative;
+    HANDLE hfile;
+    NTSTATUS status;
 
-    if(INVALID_FILE_ATTRIBUTES == GetFileAttributesW(lpFileName))
+    hfile = CreateFileW( lpFileName, GENERIC_READ, FILE_SHARE_READ,
+                         NULL, OPEN_EXISTING, 0, 0 );
+    if ( hfile == INVALID_HANDLE_VALUE )
         return FALSE;
 
-    FIXME("(%s) : returns fake SECURITY_DESCRIPTOR\n", debugstr_w(lpFileName) );
-
-    nNeeded = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
-    if (RequestedInformation & OWNER_SECURITY_INFORMATION)
-	nNeeded += sizeof(sidWorld);
-    if (RequestedInformation & GROUP_SECURITY_INFORMATION)
-	nNeeded += sizeof(sidWorld);
-    if (RequestedInformation & DACL_SECURITY_INFORMATION)
-	nNeeded += WINE_SIZE_OF_WORLD_ACCESS_ACL;
-    if (RequestedInformation & SACL_SECURITY_INFORMATION)
-	nNeeded += WINE_SIZE_OF_WORLD_ACCESS_ACL;
-
-    *lpnLengthNeeded = nNeeded;
-
-    if (nNeeded > nLength)
-	    return TRUE;
-
-    if (!InitializeSecurityDescriptor(pSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
-	return FALSE;
-
-    pSDRelative = (PISECURITY_DESCRIPTOR_RELATIVE) pSecurityDescriptor;
-    pSDRelative->Control |= SE_SELF_RELATIVE;
-    pBuffer = (LPBYTE) pSDRelative;
-    iLocNow = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
-
-    if (RequestedInformation & OWNER_SECURITY_INFORMATION)
-    {
-	memcpy(pBuffer + iLocNow, &sidWorld, sizeof(sidWorld));
-	pSDRelative->Owner = iLocNow;
-	iLocNow += sizeof(sidWorld);
-    }
-    if (RequestedInformation & GROUP_SECURITY_INFORMATION)
-    {
-	memcpy(pBuffer + iLocNow, &sidWorld, sizeof(sidWorld));
-	pSDRelative->Group = iLocNow;
-	iLocNow += sizeof(sidWorld);
-    }
-    if (RequestedInformation & DACL_SECURITY_INFORMATION)
-    {
-	GetWorldAccessACL((PACL) (pBuffer + iLocNow));
-	pSDRelative->Dacl = iLocNow;
-	iLocNow += WINE_SIZE_OF_WORLD_ACCESS_ACL;
-    }
-    if (RequestedInformation & SACL_SECURITY_INFORMATION)
-    {
-	GetWorldAccessACL((PACL) (pBuffer + iLocNow));
-	pSDRelative->Sacl = iLocNow;
-	/* iLocNow += WINE_SIZE_OF_WORLD_ACCESS_ACL; */
-    }
-    return TRUE;
+    status = NtQuerySecurityObject( hfile, RequestedInformation, pSecurityDescriptor,
+                                    nLength, lpnLengthNeeded );
+    CloseHandle( hfile );
+    return set_ntstatus( status );
 }
 
 




More information about the wine-cvs mailing list