C ++中的SCardTransmit错误...无法解决... [由OP解决] [英] Error in SCardTransmit in c++... unable to solve... [Solved by OP]

查看:151
本文介绍了C ++中的SCardTransmit错误...无法解决... [由OP解决]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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();



com的输出为22.应该为0,并且msdn表示错误22是针对错误的命令,但是我无法在我的代码中找到任何错误的命令....请告诉我的代码问题...



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...

推荐答案

您好,解决方案非常简单.我将协议更改为T0,将访问模式更改为共享模式....
Hello the solution was quite simple.. I changed the protocol to T0 and access mode to share mode....


这篇关于C ++中的SCardTransmit错误...无法解决... [由OP解决]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆