GetEffectiveRightsFromAcl (advapi32)
Last changed: egray1@hot.rr.com-24.26.210.211

.
Summary
TODO - a short description

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
static extern uint GetEffectiveRightsFromAcl(IntPtr pDacl, ref TRUSTEE pTrustee, ref int pAccessRights);

VB Signature:

     Private Declare Auto Function GetEffectiveRightsFromAcl Lib "advapi32.dll" ( _
    ByVal pacl As IntPtr, _
    ByVal pTrustee As IntPtr, _
    ByRef pAccessRights As Integer _
    ) As Integer

User-Defined Types:

TRUSTEE

Notes:

    'DWORD GetEffectiveRightsFromAcl(
    '  PACL pacl,
    '  PTRUSTEE pTrustee,
    '  PACCESS_MASK pAccessRights
    ');

Tips & Tricks:

Please add some!

VB.Net Sample Code:

    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)

Alternative Managed API:

Do you know one? Please contribute it!

Documentation