Hi,
I am trying to map a dll library to java. I have tested some functions,
they work properly. But one function doesn't and I am unable to get it
to work.
C-Declaration in header file:
#ifdef SFMPQAPI_EXPORTS
#define SFMPQAPI __declspec(dllexport)
#else
#define SFMPQAPI __declspec(dllimport)
#endif
typedef HANDLE MPQHANDLE;
BOOL SFMPQAPI WINAPI SFileOpenArchive(LPCSTR lpFileName, DWORD
dwPriority, DWORD dwFlags, MPQHANDLE *hMPQ);
it opens an archive file and puts it into the hMPQ handle. It returns
its success.
Proper use in c:
HANDLE hMpq = NULL;
const char *name = "test.w3x";
int success = SFileOpenArchive(name, 0, 0, &hMpq)
it is always successful i.e. success = true
using it under java it always fails (success = false). I am currently
using this declaration:
boolean SFileOpenArchive(String lpFileName, long dwPriority,
long dwFlags, PointerByReference hMPQ);
and use it like this:
PointerByReference pref = new PointerByReference();
boolean b = CLibrary.INSTANCE.SFileOpenArchive("test.w3x",0,0,
pref);
System.out.println(b);
b is always false, i.e. the function failed.
what do I do wrong? I think it is something with the by-reference call
of hMPQ.
Thanks for help.