[common] windebug: pass FORMAT_MESSAGE_IGNORE_INSERTS to FormatMessage

This avoids problems when the error message we are told to format contains
inserts like %1.

See https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353 for
details (or for fun).
This commit is contained in:
Quantum 2021-08-17 01:34:42 -04:00 committed by Geoffrey McRae
parent 2ff32b230e
commit ccda264648

View File

@ -25,7 +25,7 @@ void DebugWinError(const char * file, const unsigned int line, const char * func
{
char *buffer;
FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
status,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),