gh-152433: Windows: fix errors in sys.getwindowsversion() for UWP build - #152604
gh-152433: Windows: fix errors in sys.getwindowsversion() for UWP build#152604thexai wants to merge 2 commits into
Conversation
|
For more context, the actual issue with e.g: in Windows 11 25H2 return (but not directly observable because only is used as second fallback on With this change, it will be possible use In UWP, it would be the primary method because WMI is not available and Related to #129294 |
sys.getwindowsversion() use RtlGetVersion for Desktop|
Updated with alternative fix: // Obtain the build number from Windows registry in case of Windows 10/11
if (realMajor == 10 && realMinor == 0) {
wchar_t currentBuild[32] = {0};
DWORD len = sizeof(currentBuild);
if (ERROR_SUCCESS == RegGetValueW(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, L"CurrentBuild",
RRF_RT_REG_SZ, NULL, ¤tBuild, &len))
{
realBuild = _wtol(currentBuild);
}
} |
|
|
Okay, we'll take it one step at a time... |
|
PR updated: only fixes things in UWP build, not touches anything in regular Windows desktop build. |
Is that Registry key actually documented? If not, using it directly seems at least as bad as using |
Fixes errors in
sys.getwindowsversion()only for UWP build, not changes behavior in Windows desktop.