1

问题:我的程序可以区分两种类型的卡:智能卡和简单的 eeprom 卡(Typ AT24C02SC)。

我在 Windows 系统事件日志中收到以下错误:

智能卡读卡器“SCM Microsystems Inc. SCR33x USB 智能卡读卡器 0”被拒绝 IOCTL 0x3136b0:不支持该请求。如果此错误仍然存​​在,您的智能卡或读卡器可能无法正常工作。

命令头:86 XX XX XX

伪代码(我使用 winscard.dll 和 MCSCM.dll):

void readCard()
{
   winscard.SCardEstablishContext();
   winscard.SCardListReaders();
   winscard.SCardGetStatusChange();

   while (card is not present)
   {
   }

   // test if card is eeprom card
   if (MCSCM.MCardInitialize() == 0)
   {
      if (MCSCM.MCardConnect() == 0)
      {
         MCSCM.MCardReadMemory();
         isMCard = true;
      }
   }
   MCSCM.MCardDisconnect();
   MCSCM.MCardShutdown();

   // if not, try if it is smartcard
   if (winscard.SCardConnect() == true && isMCard == false)
   {
      winscard.SCardConnect();
      ...
      // send apdus
   }
   winscard.SCardDisconnect();
   winscard.SCardReleaseContext();
   }

当我的读卡器中有智能卡时出现此错误,我检查它是否是带有ConnectMCard(). 我必须首先检查 eeprom 卡的两种不同卡类型,因为 winscard.dll 函数SCardConnect()为每张卡(eeprom 或智能卡)返回 0(成功)。

这是有效的,但应该有更好的方法。

4

0 回答 0