

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.java.dev.jna.usersmapping problem| From | Sent On | Attachments |
|---|---|---|
| LUCKY LUCKE | Mar 22, 2008 5:05 pm | |
| LUCKY LUCKE | Mar 22, 2008 5:30 pm | |
| Timothy Wall | Mar 22, 2008 6:04 pm | |
| LUCKY LUCKE | Mar 24, 2008 4:07 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | mapping problem | Actions... |
|---|---|---|
| From: | LUCKY LUCKE (evsa...@yahoo.gr) | |
| Date: | Mar 22, 2008 5:05:56 pm | |
| List: | net.java.dev.jna.users | |
Hi Timothy
Your having been so patient with my questions gives me the courage to post again
Despite the many trial and error attempts, i have not been able so far to read a
memory card or write to it
as i dont do the right mapping of the native function parameters. Unfortunately
i dont have any manufacturer manual.
The only thing i know for sure is that the dataIn and dataOut params of the
SCardComand
are pointers to string arrays and are of type LPCSTR. I use the following code
to map the dataIn parameter
StringArray sarray = new StringArray(new WString[]{new WString("hello")});
Isn't this a pointer to a string array mapping? (StringArray extends Memory).
But when i try to write the above "hello" to the card with the command
lib.SCardComand(handle, new WString("Card,MemWrite,48,208"), new
NativeLong(), sarray, new NativeLong(208), new ArrayPointer(1), new
NativeLong());
i get a JVirtualMachine crash. Handle is a NativeLong variable, and ArrayPointer
is a Memory subclassing.
public static class ArrayPointer extends Memory {
public ArrayPointer(int size) { super(size); } }
My questions are: Isn't Memory type an eligible one to retrieve or pass a string
from / to a native function? Do i have to put the declarations of StringArray
and ArrayPointer into the scope of SCard32 interface in order to have an
efficient and working mapping?
public interface SCard32 extends StdCallLibrary {
SCard32 INSTANCE = (SCard32) Native.loadLibrary("SCard32",
SCard32.class);
public int SCardComand(NativeLong Handle, WString Cmd, NativeLong
CmdLen, Memory dataIn, NativeLong dataInLen, Memory dataOut, NativeLong
dataoutlen);
}
Dont forget to mention that
System.out.println(Native.toString(sarray.getByteArray(0, 8))); only prints 'h'
---
I tried every possible combination of jna types but i cant map the pointer to
string array (LPCSTR) type.
I managed though to efficiently communicate with the card using Visual Basic!!!
Is it possible to load an ActiveX dll using JNA?
Is this a satisfactory solution???
Should i use C++ to build a bridge between my application and the hardware
driver????
(Giving up is not an option)
I have dried up!!!
I need your expertise Timothy. How would you map such a function with LPCSTRs
and LPINTs (this is the only info i have about the native function)
Thank you evsav
___________________________________________________________ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr







