HI!
I have to correct myself here.
It was not the Unicode params, it was the int instead of NativeLong for
the last parameter!
But this is a DWORD in the original definition and those *should* be
mapped to NativeLong, right?
SC_HANDLE WINAPI OpenSCManager(
LPCTSTR lpMachineName,
LPCTSTR lpDatabaseName,
DWORD dwDesiredAccess
)
Thomas
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 am running on Vista 32 bit.