E583 bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() … · python/cpython@289c5ea · GitHub
[go: up one dir, main page]

Skip to content

Commit 289c5ea

Browse files
ZackerySpytzzooba
authored andcommitted
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 a656365)
1 parent 58d61ef commit 289c5ea

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Include the ``FORMAT_MESSAGE_IGNORE_INSERTS`` flag in ``FormatMessageW()``
2+
calls.

Modules/_ctypes/callproc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ static TCHAR *FormatError(DWORD code)
242242
{
243243
TCHAR *lpMsgBuf;
244244
DWORD n;
245-
n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
245+
n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
246+
FORMAT_MESSAGE_FROM_SYSTEM |
247+
FORMAT_MESSAGE_IGNORE_INSERTS,
246248
NULL,
247249
code,
248250
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */

PC/bdist_wininst/install.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,8 @@ static BOOL SystemError(int error, char *msg)
895895
LPVOID lpMsgBuf;
896896
FormatMessage(
897897
FORMAT_MESSAGE_ALLOCATE_BUFFER |
898-
FORMAT_MESSAGE_FROM_SYSTEM,
898+
FORMAT_MESSAGE_FROM_SYSTEM |
899+
FORMAT_MESSAGE_IGNORE_INSERTS,
899900
NULL,
900901
error,
901902
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),

0 commit comments

Comments
 (0)
0