VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/PCSCException.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/PCSCException.cpp')
-rw-r--r--src/Common/PCSCException.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Common/PCSCException.cpp b/src/Common/PCSCException.cpp
index 93fff181..dc5eead3 100644
--- a/src/Common/PCSCException.cpp
+++ b/src/Common/PCSCException.cpp
@@ -113,68 +113,71 @@ namespace VeraCrypt
if (!GetDictionaryValue(errorString.c_str()))
{
if (errorString.find("SCARD_E_") == 0 || errorString.find("SCARD_F_") == 0 || errorString.find("SCARD_W_") == 0)
{
errorString = errorString.substr(8);
for (size_t i = 0; i < errorString.size(); ++i)
{
if (errorString[i] == '_')
errorString[i] = ' ';
}
}
wchar_t err[8192];
StringCbPrintfW(err, sizeof(err), L"%s:\n\n%hs%s", GetString("PCSC_ERROR"), errorString.c_str());
ErrorDirect(err, parent);
}
else
{
wstring err = GetString(errorString.c_str());
ErrorDirect(err.c_str(), parent);
}
}
}
#endif // TC_HEADER_Common_Exception
#ifdef TC_HEADER_Platform_Exception
void PCSCException::Deserialize(shared_ptr <Stream> stream)
{
Exception::Deserialize(stream);
Serializer sr(stream);
- sr.Deserialize("ErrorCode", ErrorCode);
+ int64 v;
+ sr.Deserialize("ErrorCode", v);
+ ErrorCode = (LONG_PCSC)v;
}
void PCSCException::Serialize(shared_ptr <Stream> stream) const
{
Exception::Serialize(stream);
Serializer sr(stream);
- sr.Serialize("ErrorCode", ErrorCode);
+ int64 v = (int64)ErrorCode;
+ sr.Serialize("ErrorCode", v);
}
# define TC_EXCEPTION(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
# undef TC_EXCEPTION_NODECL
# define TC_EXCEPTION_NODECL(TYPE) TC_SERIALIZER_FACTORY_ADD(TYPE)
TC_SERIALIZER_FACTORY_ADD_EXCEPTION_SET(PCSCException);
#endif
CommandAPDUNotValid::operator string() const
{
return string(ErrorStr);
}
#ifdef TC_HEADER_Common_Exception
void CommandAPDUNotValid::Show(HWND parent) const
{
string msgBody = "Command APDU invalid.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + SrcPos + "\nLast Error = " + ErrorStr + ")";
MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
}
#endif // TC_HEADER_Common_Exception
#ifdef TC_HEADER_Platform_Exception
void CommandAPDUNotValid::Deserialize(shared_ptr <Stream> stream)
{
Exception::Deserialize(stream);
Serializer sr(stream);
sr.Deserialize("SrcPos", SrcPos);