advapi32: Implement SetFileSecurityW on top of NtSetSecurityObject.

This commit is contained in:
Rob Shearman 2007-10-02 16:34:42 +01:00 committed by Alexandre Julliard
parent 45b6706a32
commit 1262d7dbef
1 changed files with 23 additions and 2 deletions

View File

@ -2096,8 +2096,29 @@ SetFileSecurityW( LPCWSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor )
{
FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
return TRUE;
HANDLE file;
DWORD access = 0;
NTSTATUS status;
TRACE("(%s, 0x%x, %p)\n", debugstr_w(lpFileName), RequestedInformation,
pSecurityDescriptor );
if (RequestedInformation & OWNER_SECURITY_INFORMATION ||
RequestedInformation & GROUP_SECURITY_INFORMATION)
access |= WRITE_OWNER;
if (RequestedInformation & SACL_SECURITY_INFORMATION)
access |= ACCESS_SYSTEM_SECURITY;
if (RequestedInformation & DACL_SECURITY_INFORMATION)
access |= WRITE_DAC;
file = CreateFileW( lpFileName, access, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL );
if (file == INVALID_HANDLE_VALUE)
return FALSE;
status = NtSetSecurityObject( file, RequestedInformation, pSecurityDescriptor );
CloseHandle( file );
return set_ntstatus( status );
}
/******************************************************************************