''' 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, Structure, WinDLL) from ctypes.wintypes import DWORD, HANDLE class VS_FIXEDFILEINFO(Structure): _fields_ = [ ("dwSignature", DWORD), ("dwStrucVersion", DWORD), ("dwFileVersionMS", DWORD), ("dwFileVersionLS", DWORD), ("dwProductVersionMS", DWORD), ("dwProductVersionLS", DWORD), ("dwFileFlagsMask", DWORD), ("dwFileFlags", DWORD), ("dwFileOS", DWORD), ("dwFileType", DWORD), ("dwFileSubtype", DWORD), ("dwFileDateMS", DWORD), ("dwFileDateLS", DWORD), ] kernel32 = WinDLL('kernel32') version = WinDLL('version') if len(sys.argv) < 2: print('Usage: validate_ucrtbase.py <ucrtbase|ucrtbased>') sys.exit(2) try: ucrtbased = WinDLL(sys.argv[1]) except OSError: print('Cannot find ucrtbased.dll') # This likely means that VS is not installed, but that is an # obvious enough problem if you're trying to produce a debug # build that we don't need to fail here. sys.exit(0) # 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: name_len *= 2 name = create_unicode_buffer(name_len) actual_len = kernel32.GetModuleFileNameW(HANDLE(ucrtbased._handle), name, len(name)) if not actual_len: print('Failed to get full module name.') sys.exit(2) size = version.GetFileVersionInfoSizeW(name, None) if not size: print('Failed to get size of version info.') sys.exit(2) ver_block = c_buffer(size) if (not version.GetFileVersionInfoW(name, None, size, ver_block) or not ver_block): print('Failed to get version info.') sys.exit(2) pvi = POINTER(VS_FIXEDFILEINFO)() if not version.VerQueryValueW(ver_block, "", byref(pvi), byref(DWORD())): print('Failed to get version value from info.') sys.exit(2) ver = ( pvi.contents.dwProductVersionMS >> 16, pvi.contents.dwProductVersionMS & 0xFFFF, pvi.contents.dwProductVersionLS >> 16, pvi.contents.dwProductVersionLS & 0xFFFF, ) print('{} is version {}.{}.{}.{}'.format(name.value, *ver)) if ver < (10, 0, 10586): print('WARN: ucrtbased contains known issues. ' 'Please update the Windows 10 SDK.') print('See:') print(' http://bugs.python.org/issue27705') print(' https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk') sys.exit(1)
Mode | Type | Size | Ref | File |
---|---|---|---|---|
100644 | blob | 582 | 58471109208922c9ee8c4b06135725f03ed16814 | .bzrignore |
100644 | blob | 545 | fcf9df6a7a698e4bd87ed0c1cc4ed70bad8b9887 | .codecov.yml |
100644 | blob | 255 | 82694d81f276b2c59a0a93a4f678e1852e625052 | .gitattributes |
040000 | tree | - | 206d06f9736ae5b4b403ca9ee21b5f69f5da871c | .github |
100644 | blob | 1397 | 8b54c2c4861389f6e8bbfbab5ae0c8b6bbbad041 | .gitignore |
100644 | blob | 1060 | eb19a6c88d28d05588db25d21525ee2e19c22666 | .hgeol |
100644 | blob | 1358 | 68c607f2e8d420c8dfd0748efcd3b3b5447def16 | .hgignore |
100644 | blob | 8917 | 8f51c2ced49aed46d8b480280b630ea4264c57c3 | .hgtags |
100644 | blob | 1328 | b9be0f11fdb829f16e9de1921257eb7ee45fac57 | .hgtouch |
100644 | blob | 248 | 0614a299b6221dc7faedaa9139ae8b034e618a85 | .mention-bot |
100644 | blob | 3391 | 903950041ad01a3ce56c134f31cbe279d054fffa | .travis.yml |
040000 | tree | - | b1892084a214e5c7dc6028e114226f2733c24822 | Doc |
040000 | tree | - | 5dd6fc9dc09374506491247872c868eca111e256 | Grammar |
040000 | tree | - | dd2026cef5382b34ffeccda33158acfc8b95b252 | Include |
100644 | blob | 12773 | f5d0b39a0cdddb91a31a537052b7d8d31a4aa79f | LICENSE |
040000 | tree | - | a85086db747d5aa23b80f94c9d33952f7c249f0f | Lib |
040000 | tree | - | 1db7415d4375525eaf8d05ddd5b088de3321041c | Mac |
100644 | blob | 58975 | 3da663762972ad28fa2c258fbec9c9bccc5dd1d4 | Makefile.pre.in |
040000 | tree | - | 2af7296a000fbb25b66a08390a9d85f414eea3f3 | Misc |
040000 | tree | - | 3447337d90cebfe891e7cc9b72167d2a32a1ba7e | Modules |
040000 | tree | - | 58fbfb305e29dbec3cd8f52d7546478c8c16261e | Objects |
040000 | tree | - | 4ae710f2a2ebde12551321c59748dc658c00a47d | PC |
040000 | tree | - | 8b827c06bc7d5bd16ae5804bbbf2bf0de3a5964b | PCbuild |
040000 | tree | - | 33139fe0ff83b05ad3f6f5c5b33b84be0f98179a | Parser |
040000 | tree | - | 3efbcc80237ab7c3d4eb5bf31c893ca6de88e747 | Programs |
040000 | tree | - | 0714b1a501341b97b173664f706e14da650c3c49 | Python |
100644 | blob | 9325 | 9c95815d9e9d91b8dae8e05d8bbc696fe19f796b | README.rst |
040000 | tree | - | 26ad7cf78a56bc1b4be84d725afef7937d023dc2 | Tools |
100644 | blob | 10910 | 9a9cc557281571f0d46c506c0e9d1b9fb25e063c | aclocal.m4 |
100755 | blob | 42856 | 1f5c50c0d1529d50b94dc3533ca72a47f0fa5849 | config.guess |
100755 | blob | 35740 | d654d03cdcd2226a5d7584890717e674a8122f4f | config.sub |
100755 | blob | 485286 | 67cd4f4fa37f290573e610cef93f42d826722b09 | configure |
100644 | blob | 160664 | 6e78bb64d7e95192b2d9f9259fcee6ae7428855b | configure.ac |
100755 | blob | 7122 | 0ec27bcd488da5cad6ead13d70accbdbc40d31ef | install-sh |
100644 | blob | 41449 | 21354a5cb84fe5530dd0d460561ba95569abe1d4 | pyconfig.h.in |
100644 | blob | 98743 | 3b3d097454211c790c1602d759918bb65a622c97 | setup.py |