Hi,
you need to modify read to make this work. An example can be found
here:
https://github.com/java-native-access/jna/blob/365629530635440381f63939f7891456992fe91b/contrib/platform/src/com/sun/jna/platform/win32/Ddeml.java#L359-L443
In the example (MONHSZSTRUCT) the structure has a dynamic size. The
size is declared as the first parameter. For the read case, that field
is read first, then the structure updates its size info to the just
read info and runs the base read implementation with that.
Another example can be found here:
https://github.com/java-native-access/jna/blob/365629530635440381f63939f7891456992fe91b/contrib/platform/src/com/sun/jna/platform/win32/Winspool.java#L755-L807
I'm pretty sure, that the array allocation in 797 should be done
differently (using "new PRINTER_NOTIFY_INFO_DATA().toArray(count)"),
but it should transfer the idea:
When the Count indicates, that the array of PRINTER_NOTIFY_INFO_DATA
would be empty, the non-array fields are read directly and thus the
problem of reading an empty in JNA is worked around. If the array is
filled, the normal read implementation takes over.
Hint: The unittests and the mappings in the platform project can be a
good source for examples and possible options. They should be read with
a critical eye, but still...
HTH
Matthias
> --
> You received this message because you are subscribed to the Google Groups "Java Native Access" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
jna-users+...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/jna-users/38cca395-fdf8-41ee-918d-b6f03ca159fcn%40googlegroups.com.