Using .NET, you might think that determining the permissions assigned to a directory / file should be fairly simple, as it is determined that the FileSystemRights Enum contains all possible permissions that a file / directory can have and calling AccessRule.FileSystemRights returns a combination of these values. However, you will soon come across some permissions when the value in this property does not match any of the values ββin the FileSystemRights Enum (I would like them to not name some properties with the same name as Type, but hey).
The end result of this is that for some files / directories you simply cannot determine what rights are assigned to them. If you do this AccessRule.FileSystemRights.ToString, then for these values ββall that you see is a number, not a description (for example, Modify, Delete, FullControl, etc.). The common numbers you can see are:
-1610612736, -536805376 and 268435456
To determine what these permissions really exist, you need to look at what bits are set when you treat this number as 32 separate bits and not as an integer (since integers are 32 bits long) and compare them to this diagram: http: // msdn.microsoft.com/en-us/library/aa374896(v=vs.85).aspx
So, for example, -1610612736 has the first bit and third bit, which means GENERIC_READ in combination with GENERIC_EXECUTE. Now you can convert these general permissions to a specific system permissions file that they correspond to.
You can see what permissions are allowed for each general permission: http://msdn.microsoft.com/en-us/library/aa364399.aspx . Just know that STANDARD_RIGHTS_READ, STANDARD_RIGHTS_EXECUTE and STANDARD_RIGHTS_WRITE are the same thing (I donβt know why, it seems strange to me) and practically all are equal. FileSystemRights.ReadPermissions value.