Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have implemented a scardtransmit function to send a APDU command but its giving error 14. i dnt don't knw know wat what dat that means ...code is:-
all the previous functions like scardestablish context n scardconnect are working fine.
i dnt don't knw know the error.... pls please help..
CSS
DWORD dwActiveProtocol, dwSendLength, dwRecvLength;
	SCARD_IO_REQUEST pioRecvPci;
	BYTE pbRecvBuffer[256];
	BYTE pbSendBuffer[] = { (BYTE)0x60,(BYTE) 0x00,(BYTE) 0x02, (BYTE)0x6C, (BYTE)0x35, (BYTE)0x3B, (BYTE)0x03 };
	dwSendLength = sizeof(pbSendBuffer);
	dwRecvLength = sizeof(pbRecvBuffer);
	long result =com(phCard, 0, pbSendBuffer, dwSendLength,&pioRecvPci, pbRecvBuffer, &dwRecvLength);
	if(result!=SCARD_S_SUCCESS){
	cout<<"unable  to transmit the command\n";
	}  


if i remove the (BYTE) from pbSendBuffer then the error is 22...
help...
Posted
Updated 23-May-12 0:08am
v2
Comments
Richard MacCutchan 23-May-12 10:11am    
Whaere does the error code come from and what does the com() function do?
Anil Kumar 23 23-May-12 10:32am    
oh sory.. com() function is acting as SCardTransmit function exported by winscard.dll..

1 solution

SCard specific error codes are here:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa374738(v=vs.85).aspx#smart_card_return_values[^]

Generic system error codes are here:

http://msdn.microsoft.com/en-us/library/ms681382(v=vs.85).aspx[^]

14 = ERROR_OUTOFMEMORY
22 = ERROR_BAD_COMMAND

I suspect that your problem has to do with the pioRecvPci structure. The second element of that structure is a length field which you aren't initializing. It should be initialized to a valid length.

Relevant documentation:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa379804(v=vs.85).aspx[^]

and

http://msdn.microsoft.com/en-us/library/windows/desktop/aa379807(v=vs.85).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900