[DllImport("advapi32.dll", SetLastError=true)]
static extern uint GetEffectiveRightsFromAcl(IntPtr pDacl, ref TRUSTEE pTrustee, ref int pAccessRights);
Private Declare Auto Function GetEffectiveRightsFromAcl Lib "advapi32.dll" ( _
ByVal pacl As IntPtr, _
ByVal pTrustee As IntPtr, _
ByRef pAccessRights As Integer _
) As Integer
'DWORD GetEffectiveRightsFromAcl(
' PACL pacl,
' PTRUSTEE pTrustee,
' PACCESS_MASK pAccessRights
');
Please add some!
Dim pDACL, pSD As IntPtr
Dim Mask, ret As Integer
Dim Win32Error As Win32Exception
' Get the DACL from the file
ret = GetNamedSecurityInfo(_Path, SE_OBJECT_TYPE.SE_FILE_OBJECT, SECURITY_INFORMATION.DACL_SECURITY_INFORMATION, Nothing, Nothing, pDACL, Nothing, pSD)
If ret <> 0 Then
Win32Error = New Win32Exception(ret)
Throw New Exception(Win32Error.Message)
End If
' Get the Access Mask using the supplied user account
ret = GetEffectiveRightsFromAcl(pDACL, pTrustee, Mask)
If ret <> 0 Then
Win32Error = New Win32Exception(ret)
Throw New Exception(Win32Error.Message)
End If
Marshal.FreeHGlobal(pSD)
Do you know one? Please contribute it!