better handling of empty reader list; refs #11
This commit is contained in:
@@ -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)));
|
||||
|
Reference in New Issue
Block a user