Hi all..
I am using VS.net 2003(C#) and OMKEY smart card reader.Up to SardStatus my application working fine. But when i want to read smart card's chip number it's giving an error like "Can not marshal parameter #2: The type definition of this type has no layout information."
part of my code:
[DllImport("WINSCARD.DLL")]
internal static extern uint SCardTransmit(int hCard,
SCARD_IO_REQUEST pioSendPci, byte[] pbSendBuffer, int
cbSendLength, string recvPci,byte[]
pbRecvBuffer, ref int pcbRecvLength);
public string GetChipno(int card_Handle)
{
//00A40000024000
byte[] pbSendBuffer = {0x00,0xCA,0x00,0x00,0x02,0x46,0x00};
//int cbSendLength=13;
//IntPtr SCARD_PCI_IO=GetPciT0();
const uint SCARD_PROTOCOL_T0=1;
SCARD_IO_REQUEST SCARD_PCI_T0=new SCARD_IO_REQUEST();
SCARD_PCI_T0.dwProtocol=SCARD_PROTOCOL_T0;
SCARD_PCI_T0.cbPciLength=8;
SCARD_IO_REQUEST gpioRecevPCI=new SCARD_IO_REQUEST();
gpioRecevPCI.dwProtocol=SCARD_PROTOCOL_T0;
gpioRecevPCI.cbPciLength=8;
int cbSendLength=5;
int pcbRecvLength=2;
byte[] pbRecvBuffer=new byte[50];
try
{
uint errors = SCardTransmit(card_Handle,SCARD_PCI_T0, pbSendBuffer, cbSendLength,null, pbRecvBuffer, ref pcbRecvLength);
System.Text.ASCIIEncoding ascEnd=new System.Text.ASCIIEncoding();
string lreader3=ascEnd.GetString(pbRecvBuffer,0,10);
}
catch(Exception ex)
{
return ex.Message;
}
Plzz help me out......