From b82d367a4baef016677e0d0201a2bbd7a1a2ec52 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 22 Jun 2010 13:06:16 +0000 Subject: [PATCH] Translate the response to control code 3400 as it contains embedded control codes in the local encoding. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1598 423420c4-83ab-492f-b58f-81f9feb106b5 --- scard.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scard.c b/scard.c index 4951b14..7ddc2ba 100644 --- a/scard.c +++ b/scard.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifndef MAKE_PROTO #ifdef __APPLE__ #include @@ -2090,6 +2091,24 @@ TS_SCardControl(STREAM in, STREAM out) DEBUG_SCARD(("SCARD: -> Success (out: %d bytes)\n", (int) nBytesReturned)); } +#ifdef PCSCLITE_VERSION_NUMBER + if (dwControlCode == SCARD_CTL_CODE(3400)) + { + int i; + SERVER_DWORD cc; + + for (i = 0; i < nBytesReturned / 6; i++) + { + memcpy(&cc, pOutBuffer + 2 + i * 6, 4); + cc = ntohl(cc); + cc = cc - 0x42000000; + cc = (49 << 16) | (cc << 2); + cc = htonl(cc); + memcpy(pOutBuffer + 2 + i * 6, &cc, 4); + } + } +#endif + out_uint32_le(out, nBytesReturned); out_uint32_le(out, 0x00000004); out_uint32_le(out, nBytesReturned);