In Windows, I have an application that needs to set the access control to the user/group 'Everybody' only. And sets permissions to Read-Only. Under Linux a Simple open()
call with octal 004
permissions is sufficient. On Windows, how do I accomplish the same thing? Preferably in the call to CreateFile()
.
Create a SECURITY_DESCRIPTOR
with the proper attributes. The functions linked to from there are a good starting point for creating the proper security descriptor (it's far from trivial). This page shows a good example of creating one, including how to get the SID for the "Everybody" group (pEveryoneSID
in the code).
Then, just pass in that security descriptor to CreateFile
as the lpSecurityAttributes
parameter.