PDA

View Full Version : SetObjectPermissions - having problems; InstallScript project



ZygoCorp
11-03-2011, 11:02 AM
I am having 2 problems using SetObjectPermissions and could really use a quick answer to both problems!

(1) We have a directory under C:\ProgramData (C:\ProgramData\Cfg). In that directory is a file we want ALL USERS to have full access to. I coded this:
SetObjectPermissions(szFilename, IS_PERMISSIONS_TYPE_FILE, "", "Users", FILE_ALL_ACCESS, 0);

where szFilename is the fully qualified file name. Even though the above line returns 0, when you login in as a user, permission is denied to change the file. I really don't see what I did wrong. Is "Users" not the correct parameter?

(2) Similiar problem, also an InstallScript project, different product. We want all users to be able to have full access to a folder created under C:\Users. I coded this:
SetObjectPermissions(szFilename, IS_PERMISSIONS_TYPE_FOLDER, "", "Users", FILE_ALL_ACCESS, 0);

where szFilename is "C:\Users". this doesn't work either. If you manually set the permissions on the folder it works.

please help.
Thank you!