2 messages in net.java.dev.jna.usersRe: JNA with Psapi
FromSent OnAttachments
Timothy WallMay 31, 2007 9:49 am 
Timothy WallMay 31, 2007 10:03 am 
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:Re: JNA with PsapiActions...
From:Timothy Wall (twal@dev.java.net)
Date:May 31, 2007 9:49:30 am
List:net.java.dev.jna.users

If the host system is returning a pointer of any type, then you should use a PointerByReference, and then extract the desired type from the returned Pointer, for example:

PointerByReference ip = new PointerByReference(); IntByReference ic = new InteByRefreence(); callMyOSFunction(ip, ic); Pointer p = ip.getValue(); int[] data = p.getIntArray(0, ic.getValue());

You are of course responsible for whatever memory is allocated by the native call and usually need to pass the returned Pointer to some other native call to free it.

On May 31, 2007, at 12:08 PM, Carlos Domingues wrote:

Dears,

(Sorry my english)

I tested your project with Windows Psapi in order to create a function that lists Windows Proccess (tasks).

I found a different data type: A pointer to Array of Long elements (by reference).

To resolv I extend ByReference class in order to create BufferByReference class. This is applicable to any kind of array or string.

I am sending the solution to you. It´s applicable to your project, I hope (see attachments).

Thank you,

Carlos Domingues car@cjdinfo.com.br

<BufferByReference.java> <Kernel32.java> <PsApi.java> <taskCtrl.java>