Rob Shearman : advapi32: Allow GetFileSecurityA/ W to work on files that have been opened already with restricted sharing flags .

Alexandre Julliard julliard at winehq.org
Wed Oct 3 06:08:17 CDT 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Oct  2 15:56:35 2007 +0100

advapi32: Allow GetFileSecurityA/W to work on files that have been opened already with restricted sharing flags.

Only use the minimum required access rights for the information being retrieved.

---

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

diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 3d070a3..23e9ad2 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -1819,8 +1819,15 @@ GetFileSecurityW( LPCWSTR lpFileName,
 {
     HANDLE hfile;
     NTSTATUS status;
+    DWORD access = 0;
+
+    if (RequestedInformation & (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|
+                                DACL_SECURITY_INFORMATION))
+        access |= READ_CONTROL;
+    if (RequestedInformation & SACL_SECURITY_INFORMATION)
+        access |= ACCESS_SYSTEM_SECURITY;
 
-    hfile = CreateFileW( lpFileName, GENERIC_READ, FILE_SHARE_READ,
+    hfile = CreateFileW( lpFileName, access, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
                          NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 );
     if ( hfile == INVALID_HANDLE_VALUE )
         return FALSE;




More information about the wine-cvs mailing list