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.
MattBoonAsked:
Who is Participating?
 
RainUKCommented:
One of the parameters of the API references a structure -> Struct_MembersOf_PACL

You need to define this!

e.g.

Private Type Struct_MembersOf_PACL

    ?? as string
    ?? as long

End Type
0
 
rettiseertCommented:
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:

http://64.233.187.104/search?q=cache:u8zv0iCggYQJ:spotlight.de/zforen/amvb/m/amvb-1014024013-15131.html+%22declare+function+AddAccessAllowedAceEx%22&hl=en
0
 
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.
0
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.