Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2004

Tip: Looking for answers? Try searching our database.

GetExplicitEntriesFromAcl works now what

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Coate - 28 Sep 2004 17:38 GMT
Hi,

I am attempting to use APIs via vb.net to view and ultimately modify
file permissions. I made it part way and got stuck. I am able to use
GetExplicitEntriesFromAcl and get the number of ACEs, but I can not
find a way to get at the individual ACEs in the returned array.

Here is a snippet of the code:

<DllImport("Advapi32.DLL", CharSet:=CharSet.Auto, SetLastError:=True)>
_
Public Shared Function GetExplicitEntriesFromAcl( _
  ByVal pacl As IntPtr, _
  ByRef pcCountOfExplicitEntries As UInt32, _
  ByRef pListOfExplicitEntries() As EXPLICIT_ACCESS) As Int32
End Function

<StructLayout(LayoutKind.Sequential, Pack:=1)> _
Public Structure EXPLICIT_ACCESS
  Public grfAccessPermissions As UInt32
  Public grfAccessMode As ACCESS_MODE
  Public grfInheritance As UInt32
  Public Trustee As TRUSTEE
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1)> _
Public Structure TRUSTEE
  Public pMultipleTrustee As IntPtr
  Public MultipleTrusteeOperation As MULTIPLE_TRUSTEE_OPERATION
  Public TrusteeForm As TRUSTEE_FORM
  Public TrusteeType As TRUSTEE_TYPE
  Public ptstrName As String
End Structure

Dim nACE As UInt32
Dim ACEs() As EXPLICIT_ACCESS
Dim ACE As EXPLICIT_ACCESS

' Obtain the array of ACEs from the DACL.
ACECount = Convert.ToUInt32(0)
Result = GetExplicitEntriesFromAcl(DACL, _
    nACE, _
    ACEs)

In my program nACE returns the correct number for the file I am
testing. I can add and subtract users and groups from the Explorer
interface and this number increases and decreases as expected.
However, I can not figure out how to get information from an
individual ACE in the ACEs array. What do I do now?

Thanks,
Dave
Mattias Sj?gren - 28 Sep 2004 20:25 GMT
Dave,

See if this helps

http://dotnetinterop.com/faq/?q=CalleeAllocatedStructArray

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Dave Coate - 30 Sep 2004 17:41 GMT
Mattias,

That is exactly what I was looking for. I was able to adapt it for my
purposes quite easily.

Thanks!
Dave

Mattias Sjögren <mattias.dont.want.spam@mvps.org> wrote in message news:<eZbRtCZpEHA.592@TK2MSFTNGP11.phx.gbl>...
> Dave,
>
[quoted text clipped - 3 lines]
>
> Mattias

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.