Index: src/libchcore/TOverlappedDataBufferQueue.cpp =================================================================== diff -u -N -r861eb97e5f43584f9537b4aff0558f6689bd0e38 -r7e407d35b44ec7482a112ef382e4619cf5d96172 --- src/libchcore/TOverlappedDataBufferQueue.cpp (.../TOverlappedDataBufferQueue.cpp) (revision 861eb97e5f43584f9537b4aff0558f6689bd0e38) +++ src/libchcore/TOverlappedDataBufferQueue.cpp (.../TOverlappedDataBufferQueue.cpp) (revision 7e407d35b44ec7482a112ef382e4619cf5d96172) @@ -108,11 +108,14 @@ m_setFullBuffers.erase(m_setFullBuffers.begin()); - // if this is the last part - mark that writing is finished, so that no other buffer will be written - if (pBuffer->IsLastPart()) - m_bDataWritingFinished = true; + if(pBuffer->GetErrorCode() == ERROR_SUCCESS) + { + // if this is the last part - mark that writing is finished, so that no other buffer will be written + if(pBuffer->IsLastPart()) + m_bDataWritingFinished = true; - ++m_ullNextWriteBufferOrder; + ++m_ullNextWriteBufferOrder; + } UpdateWritePossibleEvent(); m_eventAllBuffersAccountedFor.ResetEvent(); Index: src/libchcore/TWin32ErrorFormatter.cpp =================================================================== diff -u -N -r8068e0c351055554340ac9755d1bc846893bf2b8 -r7e407d35b44ec7482a112ef382e4619cf5d96172 --- src/libchcore/TWin32ErrorFormatter.cpp (.../TWin32ErrorFormatter.cpp) (revision 8068e0c351055554340ac9755d1bc846893bf2b8) +++ src/libchcore/TWin32ErrorFormatter.cpp (.../TWin32ErrorFormatter.cpp) (revision 7e407d35b44ec7482a112ef382e4619cf5d96172) @@ -19,6 +19,7 @@ #include "stdafx.h" #include "TWin32ErrorFormatter.h" #include +#include namespace chcore { @@ -57,7 +58,12 @@ strData.ReleaseBufferSetLength(iPos < 0 ? 0 : iPos); } else + { + if(dwPos == 0) + ATLTRACE(L"Cannot format error message. Error code=%lu\n", GetLastError()); + strData.ReleaseBufferSetLength(std::min(dwPos, dwMaxError - 1)); + } strData.TrimRightSelf(_T("\r\n"));