Error when using AddAccessAllowedAceEx api

Posted on 2005-04-18
Last Modified: 2008-01-09
I am trying to use the AddAccessAllowedAceEx api in VB 6 to set permissions on a folder so that new ACEs can be inherited by files. However, I keep getting the following error when I compile the program: Compile error: User-defined type not defined.

I am using the following declaration in a module:

Declare Function AddAccessAllowedAceEx Lib "advapi32.dll" (ByVal pAcl As Struct_MembersOf_PACL, ByVal dwAceRevision As Long, ByVal AceFlags As Long, ByVal AccessMask As Long, ByRef pSid As SID) As Long

Any help would be appreciated.
Question by:MattBoon
    LVL 13

    Assisted Solution

    I think you are missing the declaration of Struct_MembersOf_PACL & SID.

    I haven't worked with AddAccessAllowedAceEx but maybe you can get something good from this example:
    LVL 5

    Accepted Solution

    One of the parameters of the API references a structure -> Struct_MembersOf_PACL

    You need to define this!


    Private Type Struct_MembersOf_PACL

        ?? as string
        ?? as long

    End Type

    Author Comment

    Thanks to both of you for your help. I was having problems with the definition of Struct_MembersOf_PACL and the example from rettiseert helped sort this out.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now