summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-09 09:50:30 (GMT)
committerGitHub <noreply@github.com>2019-09-09 09:50:30 (GMT)
commite103732f5df13a97f610a8b80883895f7a273573 (patch)
tree096e25c0407f7cc42a2d7da9fa5356931adc01a4 /Modules
parent6e3809c7ce9fbee11c3a3f89dd7e89829b7581ac (diff)
downloadcpython-e103732f5df13a97f610a8b80883895f7a273573.zip
cpython-e103732f5df13a97f610a8b80883895f7a273573.tar.gz
cpython-e103732f5df13a97f610a8b80883895f7a273573.tar.bz2
bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-14462)
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 a6563650c835d50f7302971a5b145e94f9d0dc68) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/callproc.c4
-rw-r--r--Modules/overlapped.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 1de86e4..d9bdd98 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -242,7 +242,9 @@ static WCHAR *FormatError(DWORD code)
{
WCHAR *lpMsgBuf;
DWORD n;
- n = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ n = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index 44a0a5a..52ed0bc 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -500,7 +500,8 @@ overlapped_FormatMessage(PyObject *ignore, PyObject *args)
return NULL;
n = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),