1

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.

Jason
  • 1,313
  • 3
  • 11
  • 13

2 Answers2

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
  • 4
    This 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