diff --git a/src/ConEmuHk/Ansi.cpp b/src/ConEmuHk/Ansi.cpp index 70e0e35d45..bd643bb31c 100644 --- a/src/ConEmuHk/Ansi.cpp +++ b/src/ConEmuHk/Ansi.cpp @@ -3831,6 +3831,8 @@ void CEAnsi::StorePromptBegin() //static CEAnsi* CEAnsi::Object(bool bForceCreate /*= false*/) { + CLastErrorGuard errGuard; + if (!AnsiTlsIndex) { AnsiTlsIndex = TlsAlloc(); diff --git a/src/common/HandleKeeper.cpp b/src/common/HandleKeeper.cpp index 5bf6f850b2..4fdbf4f788 100644 --- a/src/common/HandleKeeper.cpp +++ b/src/common/HandleKeeper.cpp @@ -30,6 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "HandleKeeper.h" +#include "WErrGuard.h" #ifdef _DEBUG #include "MStrDup.h" @@ -280,6 +281,8 @@ bool HandleKeeper::AllocHandleInfo(HANDLE h, HandleSource source, DWORD access, bool HandleKeeper::QueryHandleInfo(HANDLE h, HandleInformation& Info, bool AnsiOutExpected) { + CLastErrorGuard errGuard; + if (!h || (h == INVALID_HANDLE_VALUE)) return false; bool bFound = false; diff --git a/src/common/WCodePage.cpp b/src/common/WCodePage.cpp index 9d1fdb338b..21faa739c0 100644 --- a/src/common/WCodePage.cpp +++ b/src/common/WCodePage.cpp @@ -30,6 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define HIDE_USE_EXCEPTION_INFO #include "Common.h" #include "WCodePage.h" +#include "WErrGuard.h" void CpCvt::ResetBuffer() { @@ -38,6 +39,8 @@ void CpCvt::ResetBuffer() CpCvtResult CpCvt::SetCP(UINT anCP) { + CLastErrorGuard errGuard; + if (bInitialized && (nCP == anCP)) return ccr_OK; @@ -93,7 +96,7 @@ CpCvtResult CpCvt::Convert(char c, wchar_t& wc) } goto wrap; } - + // Continuation byte (10xxxxxx)? if (blen && ((bt & 0xC0/*11xxxxxx*/) != 0x80/*10xxxxxx*/)) {