2 messages in net.java.dev.jna.usersWIN32_FIND_DATA mapping
FromSent OnAttachments
jean-michel TSep 11, 2007 7:42 am 
Timothy WallSep 11, 2007 9:21 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:WIN32_FIND_DATA mappingActions...
From:jean-michel T (jmto@yahoo.fr)
Date:Sep 11, 2007 7:42:24 am
List:net.java.dev.jna.users

Hi. I'm trying to call with jna a dll.

I have problems with one of the functions:

-------------------------------------- /* This function allows to find the first file in a repository * Message ID : LIBCOMM_FS_FINDFIRSTFILE * @param handle OUT The handle to the find object * @param directory IN The directory to find (absolute path from root)
: exemple : /mydirectory/* or /* * @param findData OUT The object that receive the first file find * @return The following values: * * -- LIBCOMM_OK The function succed. Check the
handle value: * -- handle = NULL: The function
fail to find the directory * -- handle != NULL: The
directory have been found. The findData structure have been fill * -- LIBCOMM_ERROR_INTERN An internal error occurs * -- LIBCOMM_ERROR_STATE The key is not in a correct
state * */ LIBCOMM_API sint32 LIBCOMM_CALL_METHOD libcomm_fs_find_first_file( HANDLE
*handle, wchar8 *directory, WIN32_FIND_DATA *findData);

------------------------------------------------

My problem might come from my Structure WIN32_FIND_DATA described on the msdn
like the following:

typedef struct _WIN32_FIND_DATA { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; TCHAR cFileName[MAX_PATH]; TCHAR cAlternateFileName[14]; } WIN32_FIND_DATA, *PWIN32_FIND_DATA, *LPWIN32_FIND_DATA;

What I coded is :

For the Structure: ---- public static class WIN32_FIND_DATA extends Structure {

public int dwFileAttributes; public long ftCreationTime; public long ftLastAccessTime; public long ftLastWriteTime; public int nFileSizeHigh; public int nFileSizeLow; public int dwReserved0; public int dwReserved1; public String cFileName; public String cAlternateFileName;

}

-------------------------------

for the method:

public int libcomm_fs_find_first_file(int[] handle, char[] directory,
WIN32_FIND_DATA[] findData);

------------------------------------

I tried other things but always get some memory exception or jvm crashes.

If someone could help me....

By advance thanks a lot.

Jean-Michel Tonneau