diff --git a/src/cardreader.h b/src/cardreader.h index f643314..77524dc 100644 --- a/src/cardreader.h +++ b/src/cardreader.h @@ -11,6 +11,10 @@ #include #endif +#ifdef _WIN32 +#define MAX_ATR_SIZE 33 +#endif + static v8::Persistent name_symbol; static v8::Persistent connected_symbol; diff --git a/src/common.h b/src/common.h index 75f5a42..3666aa9 100644 --- a/src/common.h +++ b/src/common.h @@ -3,7 +3,26 @@ #define ERR_MSG_MAX_LEN 512 +#ifdef _WIN32 +#include +#else +#include +#define Sleep(x) usleep((x)*1000) +#endif + +#ifdef _WIN32 +#define snprintf _snprintf +#endif + namespace { + +#ifdef _WIN32 + + const char *pcsc_stringify_error(const LONG) { + return ""; + } +#endif + std::string error_msg(const char* method, LONG result) { char msg[ERR_MSG_MAX_LEN]; snprintf(msg, diff --git a/src/pcsclite.cpp b/src/pcsclite.cpp index 173fe38..e6abf87 100644 --- a/src/pcsclite.cpp +++ b/src/pcsclite.cpp @@ -1,4 +1,3 @@ -#include #include "pcsclite.h" #include "common.h" @@ -193,7 +192,7 @@ void PCSCLite::HandlerFunction(void* arg) { uv_mutex_unlock(&pcsclite->m_mutex); } else { /* If PnP is not supported, just wait for 1 second */ - sleep(1); + Sleep(1000); } }