resolved problem with proprietary KOBIL windoze driver
This commit is contained in:
13
src/pcsc.hxx
13
src/pcsc.hxx
@@ -368,14 +368,14 @@ namespace pcsc {
|
|||||||
Strings res;
|
Strings res;
|
||||||
std::string grp(join(groups));
|
std::string grp(join(groups));
|
||||||
DWORD num(0);
|
DWORD num(0);
|
||||||
if (!check(SCardListReaders(_id, grp.size()?strconv(grp).data():0, 0,
|
if (!check(SCardListReaders(_id, groups.size()?strconv(grp).data():0, 0,
|
||||||
&num),
|
&num),
|
||||||
"(1) smartcard list readers of groups "+grp))
|
"smartcard get size of readers of groups "+grp))
|
||||||
return res;
|
return res;
|
||||||
std::auto_ptr<char_t> nm(new char_t[num]);
|
std::auto_ptr<char_t> nm(new char_t[num]);
|
||||||
if (!check(SCardListReaders(_id, grp.size()?strconv(grp).data():0,
|
if (!check(SCardListReaders(_id, groups.size()?strconv(grp).data():0,
|
||||||
nm.get(), &num),
|
nm.get(), &num),
|
||||||
"(2) smartcard list readers of groups "+grp))
|
"smartcard list reader names of groups "+grp))
|
||||||
return res;
|
return res;
|
||||||
return res = split(strconv(string(nm.get(), num-1)));
|
return res = split(strconv(string(nm.get(), num-1)));
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,7 @@ namespace pcsc {
|
|||||||
//! Splits a buffer with 0 separators into a vector of strings.
|
//! Splits a buffer with 0 separators into a vector of strings.
|
||||||
Strings split(const std::string& in) {
|
Strings split(const std::string& in) {
|
||||||
Strings res;
|
Strings res;
|
||||||
for (std::string::size_type pos(0); pos<in.size();
|
for (std::string::size_type pos(0); pos<in.size() && in[pos]!=0;
|
||||||
pos+=res.rbegin()->size()+1)
|
pos+=res.rbegin()->size()+1)
|
||||||
res.push_back(in.substr(pos).c_str());
|
res.push_back(in.substr(pos).c_str());
|
||||||
return res;
|
return res;
|
||||||
@@ -676,9 +676,12 @@ namespace pcsc {
|
|||||||
//! Joins a vector of strings into a buffer with 0 separators.
|
//! Joins a vector of strings into a buffer with 0 separators.
|
||||||
std::string join(const Strings& in) {
|
std::string join(const Strings& in) {
|
||||||
std::string res;
|
std::string res;
|
||||||
|
if (in.size()) {
|
||||||
for (Strings::const_iterator it(in.begin());
|
for (Strings::const_iterator it(in.begin());
|
||||||
it!=in.end(); ++it)
|
it!=in.end(); ++it)
|
||||||
res+=*it+'\0';
|
res+=*it+'\0';
|
||||||
|
res+='\0';
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user