Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
C#
typedef long (__stdcall *Transmit)(SCARDHANDLE ,const SCARD_IO_REQUEST *,LPCBYTE,DWORD ,SCARD_IO_REQUEST *,LPBYTE,LPDWORD );

Transmit com=0;
hinDLL = LoadLibrary( L"C:\\WINDOWS\\system32\\WinSCard.dll");
if (hinDLL != 0 ){
com=(Transmit) GetProcAddress(hinDLL,"SCardTransmit");
}
BYTE sendCommand[]={0x00,0x0A4,0x00,0x00,0x02,0x3F,0x00};
	 BYTE recvCommand[10];
	 
	 long result,lngres,sendlen=sizeof(sendCommand);
	DWORD recvlen;
	 SCARD_IO_REQUEST pioSendPci;
	
	 pioSendPci.dwProtocol=SCARD_PROTOCOL_T0;
	 pioSendPci.cbPciLength= sizeof(pioSendPci);
result= com(phCard,&pioSendPci,sendCommand,sendlen,NULL,recvCommand, &recvlen);

 if(result!=SCARD_S_SUCCESS){
 printf("command not  transmitted\n");
 }
 getch();


The output of com is 22. It should be 0 and as msdn says error 22 is for bad command but i m unable to find any bad command in my code.... Please tell the problem with my code...
Posted
Updated 28-May-12 8:19am
v2

1 solution

Hello the solution was quite simple.. I changed the protocol to T0 and access mode to share mode....
 
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