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