diff --git a/src/common/log.cpp b/src/common/log.cpp index 653c35cc3b..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), @@ -1075,9 +1076,11 @@ static const wxChar* GetSysErrorMsg(wxChar* szBuf, size_t sizeBuf, unsigned long NULL ) == 0 ) { + wxLogDebug(wxS("FormatMessage failed with error 0x%lx in %s"), + GetLastError(), __WXFUNCTION__ ? __WXFUNCTION__ : ""); // if this happens, something is seriously wrong, so don't use _() here // for safety - wxSprintf(szBuf, wxS("unknown error %lx"), nErrCode); + wxSprintf(szBuf, wxS("unknown error 0x%lx"), nErrCode); return szBuf; }