I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity* functions.
Asked
Active
Viewed 2,566 times
2 Answers
3
Ok, I figured it out:
SetSecurityInfo(hDir, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);
This will give all permissions to all users for the given directory handle.

Jason
- 1,313
- 3
- 11
- 13
-
4This is really dangerous. It removes all access control and security settings! Much better to follow the answer on this post for allowing full control to the "Users" group: http://stackoverflow.com/questions/690780/how-to-create-directory-with-all-rights-granted-to-everyone – Matt Connolly Dec 13 '11 at 02:45
2
Are you sure this is a good idea? I spend a lot of time removing public access (especially public write access) from files and directories on Unix systems, in part because allowing anyone to remove or add files to a directory is an open invitation to abuse.

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278
-
It is actually a good idea, if file/folder must be accessible by everyone. – Maris B. Jul 06 '11 at 09:30
-
1Making something writable by everyone can be quite different from removing all security and access controls, which is what the above does. – Matt Connolly Dec 13 '11 at 02:46