cpython: 605fde022b15 (original) (raw)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -385,6 +385,9 @@ Tests Build ----- +- Issue #26624: Adds validation of ucrtbase[d].dll version with warning

--- a/PC/python_ver_rc.h +++ b/PC/python_ver_rc.h @@ -9,11 +9,10 @@ #define MS_WINDOWS #include "modsupport.h" #include "patchlevel.h" +#include <pythonnt_rc.h> #ifdef _DEBUG -# include <pythonnt_rc_d.h>

define PYTHON_DEBUG_EXT "_d"

#else -# include <pythonnt_rc.h>

define PYTHON_DEBUG_EXT

#endif

new file mode 100644 --- /dev/null +++ b/PC/validate_ucrtbase.py @@ -0,0 +1,88 @@ +''' +This script gets the version number from ucrtbased.dll and checks +whether it is a version with a known issue. +''' + +import sys + +from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,

+from ctypes.wintypes import DWORD, HANDLE + +class VS_FIXEDFILEINFO(Structure):

+ +kernel32 = WinDLL('kernel32') +version = WinDLL('version') + +if len(sys.argv) < 2:

+ +try:

+except OSError:

+ +# We will immediately double the length up to MAX_PATH, but the +# path may be longer, so we retry until the returned string is +# shorter than our buffer. +name_len = actual_len = 130 +while actual_len == name_len:

+ +size = version.GetFileVersionInfoSizeW(name, None) +if not size:

+ +ver_block = c_buffer(size) +if (not version.GetFileVersionInfoW(name, None, size, ver_block) or

+ +pvi = POINTER(VS_FIXEDFILEINFO)() +if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())):

+ +ver = (

+) + +print('{} is version {}.{}.{}.{}'.format(name.value, *ver)) + +if ver < (10, 0, 10586):

--- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -83,6 +83,13 @@