Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
GetExplicitEntriesFromAcl (advapi32)
 
.
Summary
TODO - a short description

C# Signature:

[DllImport("advapi32.dll", SetLastError=true)]
static extern TODO GetExplicitEntriesFromAcl(TODO);

VB Signature:

    Declare Auto Function GetExplicitEntriesFromAcl Lib "AdvAPI32.DLL" ( _
    ByVal pacl As IntPtr, _
    ByRef pcCountOfExplicitEntries As Integer, _
    ByRef pListOfExplicitEntries As IntPtr _
    ) As Integer

User-Defined Types:

None.

Notes:

    'DWORD GetExplicitEntriesFromAcl(
    '  PACL pacl,
    '  PULONG pcCountOfExplicitEntries,
    '  PEXPLICIT_ACCESS* pListOfExplicitEntries
    ');

Tips & Tricks:

Please add some!

VB.Net Sample Code:

    Dim pSecDesc, pDACL, ACE_ptr, iPtr, StringPtr As IntPtr
    Dim i, num, Ptr_num As Integer
    Dim SidString, NameBuf As String

    ' get the Security Descriptor and DACL
    If GetNamedSecurityInfo(Path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, Nothing, Nothing, pDACL, Nothing, pSecDesc) <> 0 Then
        Exit Sub
    End If

    ' Get an array of ACEs
    If GetExplicitEntriesFromAcl(pDACL, num, ACE_ptr) <> 0 Then
        Exit Sub
    End If

    Marshal.FreeHGlobal(ACE_ptr)
    Marshal.FreeHGlobal(pSecDesc)

Alternative Managed API:

If you have .NET v2.0:

For Files

System.Security.AccessControl.FileSecurity

For Registry Keys

System.Security.AccessControl.RegistrySecurity

For Directories

System.Security.AccessControl.DirectorySecurity
System.Security

Sample Code

These classes require .NET v2.0

  {
    System.Security.AccessControl.FileSecurity secDesc =
      new System.Security.AccessControl.FileSecurity(Path,
      System.Security.AccessControl.AccessControlSections.Access);
    System.Security.AccessControl.AuthorizationRuleCollection aceCollection =
      pSecDesc.GetAccessRules(true, false, typeof(System.Security.Principal.NTAccount));
  }

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions