

![]() | 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: |
1 message in net.java.dev.jna.usersRe: [jna-dev] Problem using the Scard...| From | Sent On | Attachments |
|---|---|---|
| Timothy Wall | Mar 13, 2008 5:52 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: | Re: [jna-dev] Problem using the Scard32.dll | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Mar 13, 2008 5:52:04 am | |
| List: | net.java.dev.jna.users | |
In addition to what Albert noted about case-sensitivity, you haven't mapped the native argument types to the recommended Java types. Hint: "LP" on windows stands for "(Long) Pointer".
See https://jna.dev.java.net/#mapping See https://jna.dev.java.net/nonav/javadoc/overview- summary.html#marshalling See https://jna.dev.java.net/#char_buffer
On Mar 13, 2008, at 4:28 AM, LUCKY LUCKE wrote:
Hi all
I have a card reader (SCR335) i have downloaded its driver, its wrapper, installed them, and im trying to read a card using the jna API. The dll im trying to load is the Scard32 (im sure this is the right dll i have to use) which has only one function the ScardComand (the spelling is right though the prefix comand is written with single m). The Scard32 uses the stdcall calling convention. Here is the definition of the ScardComand
Response=SCardComand (Handle, Cmd, CmdLen, DataIn, DataInLen, DataOut, DataOutLen) LPINT Handle /* pointer to a signed 32 bit integer */ LPSTR Cmd /* string pointer */ LPINT CmdLen /* pointer to a signed 32 bit integer */ LPSTR DataIn /* pointer to a string array */ LPINT DataInLen /* pointer to a signed 32 bit integer */ LPSTR DataOut /* pointer to a string array */ LPINT DataOutLen /* pointer to a signed 32 bit integer */
The code i wrote to load the dll and mirror its function is the following
public interface Scard32 extends StdCallLibrary { //StdCallFunctionMapper mapper = new StdCallFunctionMapper(); Scard32 INSTANCE = (Scard32) Native.loadLibrary("Scard32", Scard32.class);
public int ScardComand(int Handle, String Cmd, int CmdLen, String dataIn, int dataInLen, String dataOut, int dataoutlen);
}
....main.... Scard32 lib = Scard32.INSTANCE;
try { String output = " ";
lib.ScardComand(0, "Card,MemRead,128,6", 0, new String(), 0, output, 0);
} catch (UnsatisfiedLinkError e) {
e.printStackTrace(); }
here is what i get when i run the code
java.lang.UnsatisfiedLinkError: Error looking up function 'ScardComand': ??? ???? ?????? ?? ?????????? ? ??????????? ??????????.
at com.sun.jna.Function.<init>(Function.java:126) at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java: 219) at com.sun.jna.Library$Handler.invoke(Library.java:191) at $Proxy0.ScardComand(Unknown Source)
Unfortunately i always get this exception which means that the dll is properly loaded but i dont do the right function mapping. I tried passing integer values as values to the function, with simple string variables, IntByValue values with WString values for the strings, but with no luck (also tried the char array for strings). I tried to use callbacks but i suppose in the wrong way.
I have no time left to put on this anymore, so could you please send me a code sample with the mapping of the ScardComand i should use?
Any answers would be gratefully appreciated. Thank you for your time.
evsav
Χρησιμοποιείτε Yahoo! Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr







