Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Errors
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..
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 23-May-12 0:03am
Edited 23-May-12 0:08am
v2
Comments
Richard MacCutchan at 23-May-12 10:11am
   
Whaere does the error code come from and what does the com() function do?
Hellexx at 23-May-12 10:32am
   
oh sory.. com() function is acting as SCardTransmit function exported by winscard.dll..

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 474
1 Maciej Los 390
2 OriginalGriff 318
3 CHill60 205
4 CPallini 179
0 OriginalGriff 6,152
1 Sergey Alexandrovich Kryukov 5,312
2 Maciej Los 3,279
3 Peter Leow 3,184
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 23 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100