Hi Trevor,
Am Freitag, den 28.09.2018, 02:34 -0700 schrieb Trevor Maggs:
>
> Thanks for your response the other day. I was trying to work on
> getting information from the Security Descriptor from Windows as
> simple as possible. Unfortunately, it is not that simple since
> several C++ native functions are involved to reach the information I
> want.
>
You want to have a deeper look at the unittests in Advapi32Test. These
demonstrate accessing the DACL and SACLs. Attached to this email you
find a sample, that opens the key (HKEY_CURRENT_USER/Demo) and outputs
the ACLs. I added auditing to that key to get a good sample. The
output:
----------- DACL ---------------
S-1-5-21-3178902164-3053647283-518304804-1001: true
S-1-5-18: true
S-1-5-32-544: true
S-1-5-12: true
----------- SACL ---------------
2 - -62 - 20
S-1-1-0
The ACEs of the DACL are expected to be ACCESS_ALLOWED_ACE. The ACEs of
the SACL can be any type, only ACEs of type SYSTEM_AUDIT_ACE are
decoded.
>
> [Plan: create native library to extract ACL information]
>
> int n = 4;
> VALUEACE *jnaStruct = new VALUEACE[n];
>
> Then assign values (whatever) to each item in the array.
>
>
> The above code is just an example I am hoping to create for JNA to
> read.
>
> My question, is it possible to obtain an array of struct(s) in JNA
> and then iterate through it in Java easily? Do you have any
> suggestion or just point to some example codes that might help me to
> get the solution?
https://java-native-access.github.io/jna/4.5.2/javadoc/com/sun/jna/Structure.html#toArray-int-
By I would not go down that road - from my POV it looks as if
everything you need is already bound.
Greetings
Matthias