smaller bugfixes and type adaptions; refs #33

master
Marc Wäckerlin 10 years ago
parent 8b704279b0
commit 40f64d476e
  1. 2
      src/cryptoki.hxx
  2. 17
      src/pcsc.hxx

@ -2027,7 +2027,7 @@ namespace cryptoki {
if (!check(_session._slot.library()->C_GetAttributeValue if (!check(_session._slot.library()->C_GetAttributeValue
(_session._session, _object, &attr, 1), (_session._session, _object, &attr, 1),
CRYPTOKI_FN_LOG("C_GetAttributeValue")) CRYPTOKI_FN_LOG("C_GetAttributeValue"))
|| !(long)attr.ulValueLen>0l) || !((long)attr.ulValueLen>0l))
//! Without exception handling, size and type must be checked too. //! Without exception handling, size and type must be checked too.
return res; return res;
try { try {

@ -210,8 +210,9 @@ namespace pcsc {
//! State and attribute list of a reader. //! State and attribute list of a reader.
class Status { class Status {
public: public:
Status(unsigned long s, const std::string& a): state(s), atr(a) {} Status(unsigned DWORD s, const std::string& a):
const unsigned long state; state(s), atr(a) {}
const unsigned DWORD state;
const std::string atr; const std::string atr;
}; };
@ -318,7 +319,7 @@ namespace pcsc {
/*! /*!
* @note Take care: Strings may contain embedded @c 0. * @note Take care: Strings may contain embedded @c 0.
*/ */
std::string control(unsigned long controlCode, std::string control(unsigned DWORD controlCode,
std::string in) { std::string in) {
DWORD len(256); // arbitrary DWORD len(256); // arbitrary
UCHAR dataBuffer[256]; UCHAR dataBuffer[256];
@ -398,7 +399,7 @@ namespace pcsc {
//! Sets state and throws an exception if neccessary. //! Sets state and throws an exception if neccessary.
/*! @throw access_error if it is instanciated for exceptions and /*! @throw access_error if it is instanciated for exceptions and
an error occured in the last command. */ an error occured in the last command. */
bool check(long state, const std::string context="") { bool check(DWORD state, const std::string context="") {
_state = state; _state = state;
return _connection->check(state, context); return _connection->check(state, context);
} }
@ -585,7 +586,7 @@ namespace pcsc {
//! Throws an exception if neccessary. //! Throws an exception if neccessary.
/*! @throw access_error if it is instanciated for exceptions and /*! @throw access_error if it is instanciated for exceptions and
an error occured in the last command. */ an error occured in the last command. */
bool check(long s, const std::string& context="") { bool check(DWORD s, const std::string& context="") {
_state = s; _state = s;
return check(context); return check(context);
} }
@ -980,11 +981,11 @@ namespace pcsc {
return ss.str(); return ss.str();
} }
//! set state //! set state
void state(long s) { void state(DWORD s) {
_state = s; _state = s;
} }
//! @returns state //! @returns state
long state() { DWORD state() {
return _state; return _state;
} }
//! @returns connection id //! @returns connection id
@ -1000,7 +1001,7 @@ namespace pcsc {
bool _exc; bool _exc;
SCARDCONTEXT _id; SCARDCONTEXT _id;
Scope _s; Scope _s;
long _state; DWORD _state;
}; };

Loading…
Cancel
Save