Commit 289c5ea7 authored by Zackery Spytz's avatar Zackery Spytz Committed by Steve Dower

bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-15822)

If FormatMessageW() is passed the FORMAT_MESSAGE_FROM_SYSTEM flag
without FORMAT_MESSAGE_IGNORE_INSERTS, it will fail if there are
insert sequences in the message definition.
(cherry picked from commit a6563650)
parent 58d61efd
Include the ``FORMAT_MESSAGE_IGNORE_INSERTS`` flag in ``FormatMessageW()``
calls.
...@@ -242,7 +242,9 @@ static TCHAR *FormatError(DWORD code) ...@@ -242,7 +242,9 @@ static TCHAR *FormatError(DWORD code)
{ {
TCHAR *lpMsgBuf; TCHAR *lpMsgBuf;
DWORD n; DWORD n;
n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, NULL,
code, code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
......
...@@ -895,7 +895,8 @@ static BOOL SystemError(int error, char *msg) ...@@ -895,7 +895,8 @@ static BOOL SystemError(int error, char *msg)
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, NULL,
error, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment