tags:

views:

91

answers:

2

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.

+1  A: 

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
A: 

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