OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
SCARD_E_COMM_DATA_LOST by ScardTransmit

From: SUSCRIBE SmartCardSDK M.Thiru (thirumarban_mYAHOO.COM.SG)
Date: Wed Apr 09 2003 - 23:11:14 CDT


Hi,
after succesfully executing Select file ,when I try to get
response,ScardTransmit give this error, SCARD_E_COMM_DATA_LOST
((DWORD)0x8010002FL). But when I try use the same command before selcting
file,no error is returned . Can anyone help me to fix this problem.

The code is as below.
main()
{
     //After establish context and connect, I tied to select file and get
     //its response

       //Select DF 0200
 FileID[0] = 0x03;
 FileID[1] = 0x00;
 lReturn = SelectDF(hCardHandle,FileID);

 //Get Response from Card
 Len = 14;
 GetResp(hCardHandle,RespBuff,Len);

}

LONG GetResp(SCARDHANDLE hCardHandle,char *RespBuff,int Len)
{
 unsigned char SendData[5];
 int SendLen;
 unsigned char RespData[40];
 unsigned long RespLen;
 LONG lReturn;
 SCARD_IO_REQUEST PioRecvPci;

 SendData[0] = 0x00;
 SendData[1] = 0xE0;
 SendData[2] = 0x00;
 SendData[3] = 0x00;
 SendData[4] = Len;

 RespLen = sizeof(RespData);
 PioRecvPci.dwProtocol = SCARD_PROTOCOL_T0;

 lReturn= SCardTransmit( hCardHandle, SCARD_PCI_T0 ,
               SendData, sizeof(SendData), NULL, RespData,
               &RespLen );

 memcpy(RespBuff,RespData,Len);

 return lReturn;

}

Thanks
M.Thiru