resolved problem with proprietary KOBIL windoze driver
This commit is contained in:
19
src/pcsc.hxx
19
src/pcsc.hxx
@@ -368,14 +368,14 @@ namespace pcsc {
|
||||
Strings res;
|
||||
std::string grp(join(groups));
|
||||
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),
|
||||
"(1) smartcard list readers of groups "+grp))
|
||||
"smartcard get size of readers of groups "+grp))
|
||||
return res;
|
||||
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),
|
||||
"(2) smartcard list readers of groups "+grp))
|
||||
"smartcard list reader names of groups "+grp))
|
||||
return res;
|
||||
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.
|
||||
Strings split(const std::string& in) {
|
||||
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)
|
||||
res.push_back(in.substr(pos).c_str());
|
||||
return res;
|
||||
@@ -676,9 +676,12 @@ namespace pcsc {
|
||||
//! Joins a vector of strings into a buffer with 0 separators.
|
||||
std::string join(const Strings& in) {
|
||||
std::string res;
|
||||
for (Strings::const_iterator it(in.begin());
|
||||
it!=in.end(); ++it)
|
||||
res+=*it+'\0';
|
||||
if (in.size()) {
|
||||
for (Strings::const_iterator it(in.begin());
|
||||
it!=in.end(); ++it)
|
||||
res+=*it+'\0';
|
||||
res+='\0';
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user