6 messages in net.java.dev.jna.usersPointer to structure arrays ?
FromSent OnAttachments
Jean-Baptiste BugeaudMay 16, 2007 7:08 am 
Timothy WallMay 17, 2007 10:40 am 
Timothy WallMay 17, 2007 11:20 am 
Jean-Baptiste BugeaudMay 18, 2007 5:55 am 
Timothy WallMay 18, 2007 6:51 am 
Jean-Baptiste BugeaudMay 18, 2007 1:11 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Pointer to structure arrays ?Actions...
From:Jean-Baptiste Bugeaud (buge@gmail.com)
Date:May 16, 2007 7:08:52 am
List:net.java.dev.jna.users

Hello all,

I am trying to access the GetRawInputDeviceList from Windows's User32.dll

see http://msdn2.microsoft.com/en-us/library/ms645598.aspx

What is the prefered equivalence of the p/invoke Marshal.PtrToStructure under JNA ? IE, getting a Structure from a raw Pointer, enabling some pointer computation to get an structure array, given a number of element ?

I am able to access the pRawInputDeviceList "array" using a Memory with signature : int GetRawInputDeviceList(Pointer pRawInputDeviceList, IntByReference puiNumDevices, int cbSize); doing manual field access (direct offset computing)... working, but very painfull and dumping lots of interrest of using JNA :(

But neither accesing with a Structure like : int GetRawInputDeviceList(RAWINPUTDEVICE pRawInputDeviceList, IntByReference puiNumDevices, int cbSize); nor with an array structure like : int GetRawInputDeviceList(RAWINPUTDEVICE[] pRawInputDeviceList, IntByReference puiNumDevices, int cbSize); is working (assuming the array is filled to the right size) !

When passing a Structure, I am able to get the first one (of index 0), but requesting toArray() on the Structure would then fail (even making the underlying memory of the structure allocated to the array required size).

Any ideas/solutions ?

Second question, is there any formal plan to integrate nlink to JNA ? IE, use annotations, genericity ... to get simpler and more intuitive code ?

Last question, coud you provide the sources and the javadocs as JAR files on the website ? This would be very handy ;-)