Fix compilation on Windows with /DUNICODE
parent
50d1ea8314
commit
b976663016
2
dll.cpp
2
dll.cpp
|
|
@ -121,7 +121,7 @@ static void SetNewAndDeleteFunctionPointers()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputDebugString("Crypto++ DLL was not able to obtain new and delete function pointers.\n");
|
OutputDebugStringA("Crypto++ DLL was not able to obtain new and delete function pointers.\n");
|
||||||
throw 0;
|
throw 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
fipstest.cpp
10
fipstest.cpp
|
|
@ -328,21 +328,21 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Crypto++ DLL loaded at base address 0x" << std::hex << h << ".\n";
|
oss << "Crypto++ DLL loaded at base address 0x" << std::hex << h << ".\n";
|
||||||
OutputDebugString(oss.str().c_str());
|
OutputDebugStringA(oss.str().c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Crypto++ DLL integrity check may fail. Expected module base address is 0x";
|
oss << "Crypto++ DLL integrity check may fail. Expected module base address is 0x";
|
||||||
oss << std::hex << g_BaseAddressOfMAC << ", but module loaded at 0x" << h << ".\n";
|
oss << std::hex << g_BaseAddressOfMAC << ", but module loaded at 0x" << h << ".\n";
|
||||||
OutputDebugString(oss.str().c_str());
|
OutputDebugStringA(oss.str().c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!moduleStream)
|
if (!moduleStream)
|
||||||
{
|
{
|
||||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||||
OutputDebugString("Crypto++ DLL integrity check failed. Cannot open file for reading.");
|
OutputDebugStringA("Crypto++ DLL integrity check failed. Cannot open file for reading.");
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -436,7 +436,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
|
||||||
// hash from disk instead
|
// hash from disk instead
|
||||||
if (!VerifyBufsEqual(expectedModuleMac, actualMac, macSize))
|
if (!VerifyBufsEqual(expectedModuleMac, actualMac, macSize))
|
||||||
{
|
{
|
||||||
OutputDebugString("Crypto++ DLL in-memory integrity check failed. This may be caused by debug breakpoints or DLL relocation.\n");
|
OutputDebugStringA("Crypto++ DLL in-memory integrity check failed. This may be caused by debug breakpoints or DLL relocation.\n");
|
||||||
moduleStream.clear();
|
moduleStream.clear();
|
||||||
moduleStream.seekg(0);
|
moduleStream.seekg(0);
|
||||||
verifier.Initialize(MakeParameters(Name::OutputBuffer(), ByteArrayParameter(actualMac, (unsigned int)actualMac.size())));
|
verifier.Initialize(MakeParameters(Name::OutputBuffer(), ByteArrayParameter(actualMac, (unsigned int)actualMac.size())));
|
||||||
|
|
@ -455,7 +455,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
|
||||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||||
std::string hexMac;
|
std::string hexMac;
|
||||||
HexEncoder(new StringSink(hexMac)).PutMessageEnd(actualMac, actualMac.size());
|
HexEncoder(new StringSink(hexMac)).PutMessageEnd(actualMac, actualMac.size());
|
||||||
OutputDebugString((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + ".\n").c_str());
|
OutputDebugStringA((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + ".\n").c_str());
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
network.cpp
12
network.cpp
|
|
@ -287,7 +287,7 @@ size_t NetworkSource::DoPump(lword &byteCount, bool blockingOutput, unsigned lon
|
||||||
|
|
||||||
unsigned int recvResult = receiver.GetReceiveResult();
|
unsigned int recvResult = receiver.GetReceiveResult();
|
||||||
#if CRYPTOPP_TRACE_NETWORK
|
#if CRYPTOPP_TRACE_NETWORK
|
||||||
OutputDebugString((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
|
OutputDebugStringA((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
|
||||||
#endif
|
#endif
|
||||||
m_dataEnd += recvResult;
|
m_dataEnd += recvResult;
|
||||||
m_waitingForResult = false;
|
m_waitingForResult = false;
|
||||||
|
|
@ -315,13 +315,13 @@ ReceiveNoWait:
|
||||||
// call Receive repeatedly as long as data is immediately available,
|
// call Receive repeatedly as long as data is immediately available,
|
||||||
// because some receivers tend to return data in small pieces
|
// because some receivers tend to return data in small pieces
|
||||||
#if CRYPTOPP_TRACE_NETWORK
|
#if CRYPTOPP_TRACE_NETWORK
|
||||||
OutputDebugString((IntToString((unsigned int)this) + ": Receiving " + IntToString(m_buf.size()-m_dataEnd) + " bytes\n").c_str());
|
OutputDebugStringA((IntToString((unsigned int)this) + ": Receiving " + IntToString(m_buf.size()-m_dataEnd) + " bytes\n").c_str());
|
||||||
#endif
|
#endif
|
||||||
while (receiver.Receive(m_buf+m_dataEnd, m_buf.size()-m_dataEnd))
|
while (receiver.Receive(m_buf+m_dataEnd, m_buf.size()-m_dataEnd))
|
||||||
{
|
{
|
||||||
unsigned int recvResult = receiver.GetReceiveResult();
|
unsigned int recvResult = receiver.GetReceiveResult();
|
||||||
#if CRYPTOPP_TRACE_NETWORK
|
#if CRYPTOPP_TRACE_NETWORK
|
||||||
OutputDebugString((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
|
OutputDebugStringA((IntToString((unsigned int)this) + ": Received " + IntToString(recvResult) + " bytes\n").c_str());
|
||||||
#endif
|
#endif
|
||||||
m_dataEnd += recvResult;
|
m_dataEnd += recvResult;
|
||||||
if (receiver.EofReceived() || m_dataEnd > m_buf.size() /2)
|
if (receiver.EofReceived() || m_dataEnd > m_buf.size() /2)
|
||||||
|
|
@ -391,7 +391,7 @@ float NetworkSink::ComputeCurrentSpeed()
|
||||||
m_maxObservedSpeed = STDMAX(m_currentSpeed, m_maxObservedSpeed * 0.98f);
|
m_maxObservedSpeed = STDMAX(m_currentSpeed, m_maxObservedSpeed * 0.98f);
|
||||||
m_byteCountSinceLastTimerReset = 0;
|
m_byteCountSinceLastTimerReset = 0;
|
||||||
m_speedTimer.StartTimer();
|
m_speedTimer.StartTimer();
|
||||||
// OutputDebugString(("max speed: " + IntToString((int)m_maxObservedSpeed) + " current speed: " + IntToString((int)m_currentSpeed) + "\n").c_str());
|
// OutputDebugStringA(("max speed: " + IntToString((int)m_maxObservedSpeed) + " current speed: " + IntToString((int)m_currentSpeed) + "\n").c_str());
|
||||||
}
|
}
|
||||||
return m_currentSpeed;
|
return m_currentSpeed;
|
||||||
}
|
}
|
||||||
|
|
@ -497,7 +497,7 @@ lword NetworkSink::DoFlush(unsigned long maxTime, size_t targetSize)
|
||||||
|
|
||||||
unsigned int sendResult = sender.GetSendResult();
|
unsigned int sendResult = sender.GetSendResult();
|
||||||
#if CRYPTOPP_TRACE_NETWORK
|
#if CRYPTOPP_TRACE_NETWORK
|
||||||
OutputDebugString((IntToString((unsigned int)this) + ": Sent " + IntToString(sendResult) + " bytes\n").c_str());
|
OutputDebugStringA((IntToString((unsigned int)this) + ": Sent " + IntToString(sendResult) + " bytes\n").c_str());
|
||||||
#endif
|
#endif
|
||||||
m_buffer.Skip(sendResult);
|
m_buffer.Skip(sendResult);
|
||||||
totalFlushSize += sendResult;
|
totalFlushSize += sendResult;
|
||||||
|
|
@ -515,7 +515,7 @@ lword NetworkSink::DoFlush(unsigned long maxTime, size_t targetSize)
|
||||||
const byte *block = m_buffer.Spy(contiguousSize);
|
const byte *block = m_buffer.Spy(contiguousSize);
|
||||||
|
|
||||||
#if CRYPTOPP_TRACE_NETWORK
|
#if CRYPTOPP_TRACE_NETWORK
|
||||||
OutputDebugString((IntToString((unsigned int)this) + ": Sending " + IntToString(contiguousSize) + " bytes\n").c_str());
|
OutputDebugStringA((IntToString((unsigned int)this) + ": Sending " + IntToString(contiguousSize) + " bytes\n").c_str());
|
||||||
#endif
|
#endif
|
||||||
sender.Send(block, contiguousSize);
|
sender.Send(block, contiguousSize);
|
||||||
m_needSendResult = true;
|
m_needSendResult = true;
|
||||||
|
|
|
||||||
2
wait.cpp
2
wait.cpp
|
|
@ -373,7 +373,7 @@ bool WaitObjectContainer::Wait(unsigned long milliseconds)
|
||||||
if (milliseconds > 0)
|
if (milliseconds > 0)
|
||||||
{
|
{
|
||||||
unsigned long timeAfterWait = t.ElapsedTime();
|
unsigned long timeAfterWait = t.ElapsedTime();
|
||||||
OutputDebugString(("Handles " + IntToString(m_handles.size()) + ", Woke up by " + IntToString(result-WAIT_OBJECT_0) + ", Busied for " + IntToString(timeBeforeWait-lastTime) + " us, Waited for " + IntToString(timeAfterWait-timeBeforeWait) + " us, max " + IntToString(milliseconds) + "ms\n").c_str());
|
OutputDebugStringA(("Handles " + IntToString(m_handles.size()) + ", Woke up by " + IntToString(result-WAIT_OBJECT_0) + ", Busied for " + IntToString(timeBeforeWait-lastTime) + " us, Waited for " + IntToString(timeAfterWait-timeBeforeWait) + " us, max " + IntToString(milliseconds) + "ms\n").c_str());
|
||||||
lastTime = timeAfterWait;
|
lastTime = timeAfterWait;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue