trying to work with WinSCard

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ray

    trying to work with WinSCard

    I am having a problem with issuing commands to my smartcard, I converted the
    call to SCardTransmit as follows:

    [C#]

    [DllImport("WinS Card.dll", EntryPoint="SCa rdTransmit",
    CharSet=CharSet .Unicode, CallingConventi on=CallingConve ntion.StdCall)]
    public static extern uint SCardTransmit(
    [In] uint hCard,
    [In] byte[] pioSendPci,
    [In] byte[] pbSendBuffer,
    [In] int cbSendLength,
    ref byte[] pioRecvPci,
    [Out] byte[] pbRecvBuffer,
    ref int pcbRecvLength);

    and created byte arrays of the lengths needed to mimic each of the structs
    that are supposed to be passed in/out, but when I call SCardTransmit, i get
    an return value which means Invalid Parameter. I've tried several different
    approaches, none of which worked any better. (first I actually had structs
    created with all the layout sizes and offsets defined, but I decided to just
    try this instead, but all give me the same response) If anyone has a clue
    to what I am doing incorrectly here, please lemme know.

    (BTW, I have called SCardEstablishC ontext, and SCardConnect before this call
    successfully)

    Thanks.

    Ray



Working...