From d2eec4bd90f145917a9afbebdf7cab897ee77012 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Fri, 10 May 2019 17:15:53 +0300 Subject: [PATCH] Fix occassionally failing FormatMessage call Call FormatMessage with the IGNORE_INSERTS flag. Without the flag, the FormatMessage() call will fail when the error message contains inserts (such as %1), as we are not providing any arguments. Various Windows system error messages contain inserts; e.g. error 193. See also: https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353 --- src/common/log.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/log.cpp b/src/common/log.cpp index 838e526a7e..fe169a6b45 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -1066,7 +1066,8 @@ static const wxChar* GetSysErrorMsg(wxChar* szBuf, size_t sizeBuf, unsigned long LPVOID lpMsgBuf; if ( ::FormatMessage ( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, nErrCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),