Windows: Use FORMAT_MESSAGE_IGNORE_INSERTS for qt_error_string().

This will cause FormatMessage() to return messages with placeholders
as well even though we do not pass the message parameters (for
example: "The operating system cannot run %1." for ERROR_INVALID_ORDINAL).

Task-number: QTBUG-43164
Change-Id: Ib95c1c0fabb543bbe4e8ab2bd8f244f73dff5fa4
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-04-01 16:04:14 +02:00
parent 5322200076
commit 06671a3cbd

View File

@ -2988,7 +2988,7 @@ QString qt_error_string(int errorCode)
// Retrieve the system error message for the last-error code.
# ifndef Q_OS_WINRT
wchar_t *string = 0;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL,
errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),