Reputation: 2682
My C++ application stores some common user data in %CSIDL_COMMON_APPDATA%\Company\Product
. I want to make sure the Users group has write permissions to this folder which on Vista it does not. How would do I do this?
Upvotes: 2
Views: 1228
Reputation: 2682
Figured it out myself using ATL...
CDacl oDacl;
AtlGetDacl(strFolder, SE_FILE_OBJECT, &oDacl);
oDacl.RemoveAces(Sids::Users()); // Remove existing "Users" access
oDacl.AddAllowedAce(Sids::Users(), FILE_ALL_ACCESS, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE);
AtlSetDacl(strFolder, SE_FILE_OBJECT, oDacl);
Of course my real code contains error checking.
Upvotes: 5