Reputation: 11
I am writing some C++ code for the Windows(XP/7) platform to check the permission associated to a file. I want to verify that the file I am reading cannot be written by accounts with non elevated privileges. This is what I am currently doing:
This code is working perfectly for the Users group. What about the other groups such as Everyone, Guests, or other specific users which may have specific write access on the file? I would like to find a solution where I don't need to enumerate all possible SID and check against all of them. Is there a SID I could use such as "anything but not admin"?
Regards, Ant
Upvotes: 1
Views: 1556
Reputation: 179779
I'd take a slightly different approach:
GetExplicitEntriesFromAcl
, for the file and all its parentsGRANT_ACCESS
and SET_ACCESS
ACE'sGetEffectiveRightsFromAcl
is probably the easiest solution here.You'll want to think specifically what you want to do with the OWNER. He can alter the rights at any time.
Upvotes: 1