Hi,
If I get the ACL of a desktop folder, I do not get the right security
settings.
(Directory is the folder on the desktop)
DirectoryInfo^ dir = fileInfo->Directory;
FileSecurity^ fileSecurity = fileInfo->GetAccessControl();
AuthorizationRuleCollection^ acl = nullptr;
acl = fileSecurity->GetAccessRules( true, true,
SecurityIdentifier::typeid );
for (int i = 0; i < acl->Count; i++) {
FileSystemAccessRule^ rule = dynamic_cast<FileSystemAccessRule^>(
acl[i] );
if ( AccessControlType::Allow.Equals( rule->AccessControlType ) )
{
bool bReadAllowed = ( ( (int)rule->FileSystemRights &
(int)FileSystemRights::Read ) == (int)FileSystemRights::Read );
// bReadAllowd becomes FALSE, while this is TRUE when checking
the security in the explorer
}
}
Does anyone know what I am doing wrong here ?
Thanks in advance, martin.