473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Bug in dotnet 2.0 ? Retrieving properties for desktop folders

Hi,

If I get the ACL of a desktop folder, I do not get the 'right' security
settings. For example the right Read is true when I check using the security
properties
in the windows explorer.

The strange thing is that in comparison with a normal folder (say c:\temp)
in the code below bReadAllowed is reached twice. The first thime
bReadAllowed
is set to true (correct), the second time bReadAllowed becomes false ?

For a normal folder (say "c:\temp") function GetAccessRules returns 5 values
but for a desktop folder GetAccessRules returns 6 values ? What extra value
could I test this extra right on a desktop folder ?

(Directory is the folder on the desktop)

DirectoryInfo^ dir = DirInfo->Directory;
DirectorySecurity^ dirSecurity = DirInfo->GetAccessControl();
AuthorizationRuleCollection^ acl = nullptr;
acl = dirSecurity->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.

Apr 20 '07 #1
1 1229
Martin jensson wrote:
<cut>

NT, XP and above have multiple desktop folders per user. You are
probably getting "default desktop" as in "all users" folder.
Apr 20 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeff Mikels | last post by:
Here is a python script to synchronize Palm Desktop Datebook files with Outlook's Calendar I'm releasing it under the Python license as version 0.1. ...
1
by: Colin Steadman | last post by:
I'm just starting out writing Python scripts (in PSP), and need to find the location of Windows special folders such as 'My Documents' and 'Desktop' so that I can save files in the right place. Is...
6
by: Dave Hopper | last post by:
Hi I am using the following SQL to retrieve a value in a list box using a unique ID held in the list box call cntID. The list box is used on an order form to list appointments that have been...
1
by: Mike Preston | last post by:
Has anybody used something like DSOFile to read and write properties of folders on an NTFS drive? This will be for my own use, so things like security don't really matter to the project at hand. ...
41
by: Mountain Bikn' Guy | last post by:
What is the current preferred way to save user preferences in dotnet? Is the registry the right place to do this? Can anyone recommend a good article (or book) for this topic? Thanks.
0
by: AvecFromage | last post by:
Hi, I'd like to be able to read the positions of all the Icons on my WinXP desktop. I've had a look around to see how to do it and I've come up with the code below...but it doesn't work. :o( ...
0
by: Klaki | last post by:
I'm trying to create an instance of Outlook using VB.net and every time I run the site, I get the following error: Retrieving the COM class factory for component with CLSID...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
1
by: Martin jensson | last post by:
Hi, If I get the ACL of a desktop folder, I do not get the 'right' security settings. For example the right Read is true when I check using the security properties in the windows explorer. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.