better handling of empty reader list; refs #11

This commit is contained in:
Marc Wäckerlin
2011-04-15 09:42:11 +00:00
parent 372e7a3268
commit 17cbc8827d
6 changed files with 6 additions and 2646 deletions

View File

@@ -314,6 +314,7 @@ namespace pcsc {
SCARD_IO_REQUEST rPci;
rPci.dwProtocol = pci()->dwProtocol;
rPci.cbPciLength = sizeof(rPci);
// don't log; could log pins
//PCSC_LOG("SCardTransmit: "<<crypto::hex(in));
check(SCardTransmit(_id, &rPci,
(unsigned char*)in.c_str(), in.size(),
@@ -485,12 +486,14 @@ namespace pcsc {
"smartcard get size of readers of groups "+grp))
return res;
PCSC_LOG("size of readers: "<<num);
if (!num) return res;
std::auto_ptr<char_t> nm(new char_t[num]);
if (!check(SCardListReaders(_id, groups.size()?strconv(grp).data():0,
nm.get(), &num),
"smartcard list reader names of groups "+grp))
return res;
PCSC_LOG("got all readers, size is "<<num);
if (!num) return res;
PCSC_LOG("list of readers: "
<<crypto::readable(std::string(nm.get(), num-1)));
return res = split(strconv(string(nm.get(), num-1)));