Commit 00bc3d9e authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

advapi32: Allow GetFileSecurityA/W to work on files that have been opened…

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.
parent 1262d7db
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment