Skip to content

Commit

Permalink
desktop/version: Use release version from DisplayVersion if available
Browse files Browse the repository at this point in the history
Reportedly Windows 10 20H2 and later record the feature release id into
DisplayVersion and leave ReleaseId stuck at 2009 for some mysterious
reason. Windows 11 currently will identify itself as Windows 11 21H2
based on this information.
  • Loading branch information
irydacea committed Oct 21, 2021
1 parent 5c8f4ca commit f02f6ef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/desktop/version.cpp
Expand Up @@ -97,7 +97,11 @@ std::string windows_release_id()
char buf[256]{""};
DWORD size = sizeof(buf);

const auto res = RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ReleaseId", RRF_RT_REG_SZ, nullptr, buf, &size);
auto res = RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "DisplayVersion", RRF_RT_REG_SZ, nullptr, buf, &size);
if(res != ERROR_SUCCESS) {
res = RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ReleaseId", RRF_RT_REG_SZ, nullptr, buf, &size);
}

return std::string{res == ERROR_SUCCESS ? buf : ""};
}

Expand Down

0 comments on commit f02f6ef

Please sign in to comment.