Smart Card Development (SCardTransmit)

R

Rob Trainer

Sorry, slippery fingers.

I am looking for some help with getting SCardTransmit to work. I have
created a set of classes that work great on a regular Win32 platform for
manipulating a smart card. I am trying to port this over to a CE device.
Most stuff was pretty easy and everything up to the card transmit works
great, i.e. EstablishContext, ConnectCard, etc. Below is my code that calls
SCardTransmit

[DllImport("Winscard.dll")]
private static extern Int32 SCardTransmit(int hCard, IntPtr pioSendRequest,
byte[] sendBuffer, uint sendLength, IntPtr pioRecvRequest, byte[]
receiveBuffer, ref int receiveLength);

public static int CardTransmit(int Card, byte[] SendBuffer, ref byte[]
RecvBuffer, ref int RecvLength)
{
IntPtr SCARD_IO_REQUEST = GetProcAddress(LoadLibrary("Winscard.dll"),
"g_rgSCardT0Pci");
RecvLength = RecvBuffer.Length;

return(SCardTransmit(Card, SCARD_IO_REQUEST, SendBuffer,
(uint)SendBuffer.Length, IntPtr.Zero, RecvBuffer, ref RecvLength));
}

This all works great on my laptop, but returns an Invalid Parameter (0x57)
error on the windows CE device. Any help would be greatly appreciated.

Rob Trainer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top