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 10:03:50 am
List:net.java.dev.jna.users

Given the definition of EnumProcesses:

BOOL WINAPI EnumProcesses( DWORD* pProcessIds, DWORD cb, DWORD* pBytesReturned );

The first argument is not a pointer to an array, but a plain pointer. Since windows is expecting an array of DWORD (32-bits), that is what you should give it, i.e. an array of int. For example:

int[] ids = new int[256]; IntByReference pcount = new IntByReference(); lib.EnumProcesses(ids, ds.length*Integer.SIZE, pcount); int pscount = pcount.getValue()/Integer.SIZE;

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

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).

We can add it to the examples once you get it working properly.