aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hoffend <[email protected]>2015-12-06 23:13:59 +0000
committerNIIBE Yutaka <[email protected]>2015-12-15 00:51:56 +0000
commit904fbdccd65e537206c0b603f9576a07defebb29 (patch)
tree098c76f4bb950003bc74abd9b20220cc81e43bee
parentscd: Simplify saving application context. (diff)
downloadgnupg-904fbdccd65e537206c0b603f9576a07defebb29.tar.gz
gnupg-904fbdccd65e537206c0b603f9576a07defebb29.zip
scd: Fix removal of unplugged usb readers on Windows.
* scd/apdu.c (pcsc_error_to_sw): map PCSC_E_NO_SERVICE and PCSC_E_SERVICE_STOPPED to the internal SW_HOST_NO_READER error code. -- Signed-off-by: Daniel Hoffend <[email protected]> GnuPG-bug-id: 2167 In Windows 8 (and later), PC/SC service only runs when reader/token is plugged in. After its removal, it returns PCSC_E_NO_SERVICE error. This error should be handled as no reader. This comment is by gniibe. (backport of commit d1a97585c5e73fbc7d4cf90e38f76ffc5aea305f)
-rw-r--r--scd/apdu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index acca79949..30e5ef9c3 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -224,6 +224,7 @@ static char (* DLSTDCALL CT_close) (unsigned short ctn);
#define PCSC_E_NOT_TRANSACTED 0x80100016
#define PCSC_E_READER_UNAVAILABLE 0x80100017
#define PCSC_E_NO_SERVICE 0x8010001D
+#define PCSC_E_SERVICE_STOPPED 0x8010001E
#define PCSC_W_REMOVED_CARD 0x80100069
/* Fix pcsc-lite ABI incompatibilty. */
@@ -873,6 +874,8 @@ pcsc_error_to_sw (long ec)
case PCSC_E_CANCELLED: rc = SW_HOST_ABORTED; break;
case PCSC_E_NO_MEMORY: rc = SW_HOST_OUT_OF_CORE; break;
case PCSC_E_TIMEOUT: rc = SW_HOST_CARD_IO_ERROR; break;
+ case PCSC_E_NO_SERVICE:
+ case PCSC_E_SERVICE_STOPPED:
case PCSC_E_UNKNOWN_READER: rc = SW_HOST_NO_READER; break;
case PCSC_E_SHARING_VIOLATION: rc = SW_HOST_LOCKING_FAILED; break;
case PCSC_E_NO_SMARTCARD: rc = SW_HOST_NO_CARD; break;