Check access to file/directory

Check access to file/directory

Secure Home | Search | About
 Microsoft Applications Security    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content add this group's latest topics to your Google content
Subject Author Date
Check access to file/directory hoenes1 09-26-2005
Posted by hoenes1 on September 26, 2005, 3:17 am
If you were  Registered and logged in, you could reply and use other advanced thread options
Hi,

I'm trying to check whether a user has access to certain
files/directories and which class of access he has. As I've read in
other posts, it is not adviced to use the "high-level access control
API". So I've tried to get my information using the following code
(simplified):

        ACE_HEADER hdr;
        SECURITY_DESCRIPTOR secDesc[15];
        DWORD size;
        size = BUF_SIZE;
        DWORD secDescSize = sizeof(secDesc);
        ZeroMemory((void *)secDesc, secDescSize);
        result = GetFileSecurity("d:\rehm\fluss\f2d_1031.dll",
DACL_SECURITY_INFORMATION, secDesc, secDescSize, &size);
        result = GetSecurityDescriptorDacl(secDesc, &present, &pDACL,
&defaulted);
        GetAce(pDACL, 0, (void **)&hdr);
        PACCESS_ALLOWED_ACE pAllowedAce;
        pAllowedAce = (PACCESS_ALLOWED_ACE)&hdr;

GetAce() yields strange values for hdr.AceType (something like 0xD4)
instead of ACCESS_ALLOWED_ACE_TYPE which should be returned. Anybody
has made similar experiences? I also found the function AccessCheck().
Anybody used it? Some sample code would be great.
Thanks in advance!

Hannes


Posted by Dave Patrick on September 26, 2005, 10:20 am
If you were  Registered and logged in, you could reply and use other advanced thread options
Try asking them here.

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.languages.vc&cat=en_US_e0896eea-b99a-41a4-8d11-9ee01d5c3b3d&lang=en&cr=US

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"hoenes1" wrote:
| Hi,
|
| I'm trying to check whether a user has access to certain
| files/directories and which class of access he has. As I've read in
| other posts, it is not adviced to use the "high-level access control
| API". So I've tried to get my information using the following code
| (simplified):
|
| ACE_HEADER hdr;
| SECURITY_DESCRIPTOR secDesc[15];
| DWORD size;
| size = BUF_SIZE;
| DWORD secDescSize = sizeof(secDesc);
| ZeroMemory((void *)secDesc, secDescSize);
| result = GetFileSecurity("d:\rehm\fluss\f2d_1031.dll",
| DACL_SECURITY_INFORMATION, secDesc, secDescSize, &size);
| result = GetSecurityDescriptorDacl(secDesc, &present, &pDACL,
| &defaulted);
| GetAce(pDACL, 0, (void **)&hdr);
| PACCESS_ALLOWED_ACE pAllowedAce;
| pAllowedAce = (PACCESS_ALLOWED_ACE)&hdr;
|
| GetAce() yields strange values for hdr.AceType (something like 0xD4)
| instead of ACCESS_ALLOWED_ACE_TYPE which should be returned. Anybody
| has made similar experiences? I also found the function AccessCheck().
| Anybody used it? Some sample code would be great.
| Thanks in advance!
|
| Hannes
|



Similar ThreadsPosted
Check access to file/directory September 26, 2005, 3:18 am
RADIUS IAS CRL CHECK August 28, 2008, 3:08 am
I Update and Check Daily August 6, 2005, 1:58 pm
How to Check SQL 7 Encryption is Working? November 24, 2005, 2:27 pm
How to check for computer abuse? February 2, 2006, 8:03 am
Check it out...Followhere...Playbingo...How to get rid of this!! April 2, 2006, 11:05 am
Password quality check May 24, 2006, 2:08 am
Check if specific updates are installed June 19, 2005, 7:16 pm
Account Locked out but Not Logs to Check December 28, 2006, 7:54 pm
how to check .pfx certificates in personal store remotely April 5, 2006, 11:50 am

The site map in XML format XML site map

Contact Us | Privacy Policy