12 messages in net.java.dev.jna.usersRe: [jna-users] Re: GetlastError alwa...
FromSent OnAttachments
Timothy WallAug 7, 2007 7:52 am 
Thomas BörkelAug 8, 2007 5:15 am 
Timothy WallAug 8, 2007 6:35 am 
Thomas BörkelAug 8, 2007 6:45 am 
Kim ValentineAug 8, 2007 7:02 am 
Timothy WallAug 8, 2007 7:26 am 
Timothy WallAug 8, 2007 7:34 am 
Timothy WallAug 8, 2007 7:42 am 
Thomas BörkelAug 8, 2007 8:00 am 
Thomas BörkelAug 8, 2007 8:05 am 
Thomas BörkelAug 8, 2007 8:21 am 
Timothy WallAug 8, 2007 8:50 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-users] Re: GetlastError always returns 0Actions...
From:Thomas Börkel (tho@boerkel.de)
Date:Aug 8, 2007 8:00:06 am
List:net.java.dev.jna.users

HI!

Timothy Wall wrote:

Here's my definition and usage, which returns nonzero for GetLastError. I'm using the W32API default options, which uses wide native strings (unicode) mapping for all java strings, and auto-maps the function name to the "W" suffix:

public static interface Advapi32 extends W32API { Advapi32 INSTANCE = (Advapi32)Native.loadLibrary("advapi32", Advapi32.class, DEFAULT_OPTIONS); Pointer OpenSCManager(String lpMachineName, String lpDatabaseName, int dwDesiredAccess); }

Pointer h = Advapi32.INSTANCE.OpenSCManager("localhost", null, 0xF003F); int code = kernel.GetLastError();

I changed my definition to use Unicode params and names as default and that alone did the trick! Now I also get 5 as error.

I'm running on XP.

I am running on Vista 32 bit.

Thomas