Allow keep trying if SCard service is unavailable

This commit is contained in:
Martin Endler
2017-01-26 19:10:48 +01:00
parent 848da7b1f1
commit 11f939ff32
2 changed files with 20 additions and 8 deletions

View File

@@ -287,6 +287,11 @@ LONG PCSCLite::get_card_readers(PCSCLite* pcsclite, AsyncResult* async_result) {
result = get_card_readers(pcsclite, async_result);
}
#endif
if (result == SCARD_E_NO_SERVICE || result == SCARD_E_SERVICE_STOPPED) {
SCardReleaseContext(pcsclite->m_card_context);
SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &pcsclite->m_card_context);
result = get_card_readers(pcsclite, async_result);
}
} else {
/* Store the readers_name in the baton */
async_result->readers_name = readers_name;