Home
Blog
Contact
Mailing List
Software
Blog
Twitter
|
<< Back To All Blogs
Bitmask values for Win32 File Permissions
Thursday, May 28th, 2009
As I have been doing a large number of work with the Win32 SDK lately, and specifically from within C#, File Permissions are often a very important aspect to check while using the Win32 SDK.
I was not able to find a proper listing of the bitmasks that you use while checking the permission results from SDK calls such as GetEffectiveRightsFromAcl.
I ended up digging into the WinNT.h header file to find these values, and there are many more than I am going to list here, but these are nonetheless the important ones.
I created an Enum for ease of use, and here it is:
public enum Permission : ulong
{
FILE_LIST_DIRECTORY = 0x0001,
FILE_ADD_FILE = 0x0002,
FILE_READ_EA = 0x0008,
FILE_READ_ATTRIBUTES = 0x0080,
READ_CONTROL = 0x00020000L,
FILE_ADD_SUBDIRECTORY = 0x0004,
FILE_WRITE_EA = 0x0010,
FILE_WRITE_ATTRIBUTES = 0x0100,
FILE_TRAVERSE = 0x0020,
DELETE = 0x00010000L,
FILE_DELETE_CHILD = 0x0040,
WRITE_OWNER = 0x00080000L,
WRITE_DAC = 0x00040000L
}
Not too tricky now that I know them, but man did it take me some digging to find them.
BitMaskin' Tom Out.
Tags
PInvoke
Win32
Related Blogs
Retrieving the SID of a user or group account using the Win32 SDK and C#
Retrieving Text from Win32 SDK's GetLastError() in C#
Writing console output from a Windows form in C#
Retrieving Text from Win32 SDK's GetLastError() in C#
Retrieving the SID of a user or group account using the Win32 SDK and C#
Comments
Currently no comments.
Add A Comment
Name:
URL:
Email Address: (not public, used to send notifications on further comments)
Comments:

Enter the text above, except for the 1st and last character:
|