CCID通信和HID通信代码相似,借用微软API接口,可以查询到UKEY
所需特殊的头文件:winscard.h
http://blog.csdn.net/xiven/article/details/4747084
1:查询设备并进行连接
SCardTransmit(ghCard, &pioSendPci, bCmd, cmdLen, NULL, pBuf, &lRecLen);
<span style="white-space:pre"> </span>(1)SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &ghContext);
<span style="white-space:pre"> </span>获得系统中CCID类设备列表
<span style="white-space:pre"> </span>(2)SCardListReaders(ghContext, NULL, NULL, &dwReaders);
<span style="white-space:pre"> </span> <span style="white-space:pre"> </span>mszReaders = (LPTSTR)malloc(dwReaders);
<span style="white-space:pre"> </span>rv = SCardListReaders(ghContext, NULL, mszReaders, &dwReaders);
<span style="white-space:pre"> </span>两次调用<span style="font-family: Arial, Helvetica, sans-serif;">SCardListReaders</span>获得CCID设备列表中所有设备信息,第一次获得存储信息的所需内存大小,第二次获取存储的信息
<span style="white-space:pre"> </span>mszReaders中存储的是读卡器的名字,找到设备然后连接设备
<span style="white-space:pre"> <span style="white-space: pre;">(</span>3)SCardConnect(ghContext, szCcidPath, SCARD_SHARE_SHARED, SCARD_PROTOCOL_