Error when using AddAccessAllowedAceEx api

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.
Who is Participating?
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
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:
MattBoonAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.