Чтение информации с карты.
BOOL Receive(LPSC_COMMAND_RECORD lpCommand, LPBYTE lpReceiveBuffer, DWORD dwBufferSize, WORD &wStatus)
{
WORD wReceiveStatus;
LPBYTE lpBuf;
BOOL bRet = TRUE;
DWORD dwSize = dwBufferSize + sizeof(WORD);
UINT lRet = sizeof(SC_COMMAND_RECORD);
LPCSCARD_IO_REQUEST lpIORequest;
lpBuf = (LPBYTE) new BYTE[dwSize];
if( lpBuf != NULL )
{
memset( lpBuf,0,dwSize );
if( m_dwReaderProtocol == SCARD_PROTOCOL_T0 )
lpIORequest = SCARD_PCI_T0;
else
lpIORequest = SCARD_PCI_T1;
lRet = SCardTransmit( m_hCardHandle,lpIORequest,(const unsigned char*)lpCommand,5,NULL,(LPBYTE)lpBuf,&dwSize);
wReceiveStatus = *(LPWORD)&lpBuf[dwBufferSize];
if( lRet == SCARD_S_SUCCESS )
memcpy( lpReceiveBuffer,lpBuf,dwBufferSize );
else
bRet = FALSE;
delete lpBuf;
}
else
bRet = FALSE;
return bRet;
}