in SmartCard

PC/SC Winscard SCardTransmit 0x00000016 return error follow up

Refer to the link C/SC Winscard SCardTransmit error 0x00000016 returned, I had resolved the 0x00000016 return error by setting the 2nd parameter as SCARD_PCI_T0 or SCARD_PCI_RAW, however I still encounter error 0x00000016 on SCM Reader, model number SDI010. Refer to the link Re: SCardTransmit returning SCARD_E_NOT_TRANSACTED, the latest code will try all the three types of the parameters, SCARD_PCI_T0, SCARD_PCI_T1, and SCARD_PCI_RAW, the problem was resolved, working properly so far, the code is as below,

if (SCardTransmit(m_hSCard, SCARD_PCI_T0, send, sendLen, NULL, recv, &recvLen)) {
    lErrCode = SCardTransmit(m_hSCard, SCARD_PCI_RAW, send, sendLen, NULL, recv, &recvLen);
    if (lErrCode){
        lErrCode = SCardTransmit(m_hSCard, SCARD_PCI_T1, send, sendLen, NULL, recv, &recvLen);
    }
} else {
    lErrCode = 0x0;
}

Reference

PC/SC Winscard SCardTransmit error 0x00000016 returned
Re: SCardTransmit returning SCARD_E_NOT_TRANSACTED

Write a Comment

Comment