Display the accurate OS version in DebugInfo (for Windows build 21H1 and greater)

Query for DisplayVersion as well instead of using only ReleaseId.

Windows deprecated the ReleaseID registry entry (now it is no longer updated and on newer Windows 10/11 builds will remain the same) and moved to use DisplayVersion.
Attempt now to first query DisplayVersion and in case that is missing, fall back to ReleaseID for older Windows 10 builds.

Close #11714
This commit is contained in:
Edoardo Lolletti 2022-05-23 11:00:07 +02:00 committed by Don Ho
parent ddbb75f0f7
commit 3b208743bd
1 changed files with 5 additions and 1 deletions

View File

@ -220,7 +220,11 @@ intptr_t CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
szProductName[sizeof(szProductName) / sizeof(TCHAR) - 1] = '\0'; szProductName[sizeof(szProductName) / sizeof(TCHAR) - 1] = '\0';
dataSize = sizeof(szReleaseId); dataSize = sizeof(szReleaseId);
RegQueryValueExW(hKey, TEXT("ReleaseId"), NULL, NULL, reinterpret_cast<LPBYTE>(szReleaseId), &dataSize); if(RegQueryValueExW(hKey, TEXT("DisplayVersion"), NULL, NULL, reinterpret_cast<LPBYTE>(szReleaseId), &dataSize) != ERROR_SUCCESS)
{
dataSize = sizeof(szReleaseId);
RegQueryValueExW(hKey, TEXT("ReleaseId"), NULL, NULL, reinterpret_cast<LPBYTE>(szReleaseId), &dataSize);
}
szReleaseId[sizeof(szReleaseId) / sizeof(TCHAR) - 1] = '\0'; szReleaseId[sizeof(szReleaseId) / sizeof(TCHAR) - 1] = '\0';
dataSize = sizeof(szCurrentBuildNumber); dataSize = sizeof(szCurrentBuildNumber);