If you have some DACL permissions on a file, you can use SetFileSecurity() to change the permissions to something else, but what happens when someone deletes all of the DACL? Now you no longer have WRITE_DAC permissions, so you can not modify any discretionary ACE's to it. I have administrative permissions, so how do I restore WRITE_DAC privileges to myself?
Thank you for help :)

If you are the owner, you can still re-write the Dacl and recover that way. Also, you may resort to enabling the privileges SE_RESTORE_NAME and SE_BACKUP_NAME and you should be good to go (take ownership etc).

A handy open source utility for you to study might be SetACL

PS. If you mean, that you have a NULL-Dacl instead of an empty one, then everyone has full access to the object.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.