Skip to content

Commit

Permalink
Merge branch 'feature/windows-11-id'
Browse files Browse the repository at this point in the history
Closes #6162.
  • Loading branch information
irydacea committed Oct 21, 2021
2 parents 9e216c7 + f02f6ef commit 0c7c0a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 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 Expand Up @@ -362,7 +366,7 @@ std::string os_version()
break;
case 1000:
if(v.wProductType == VER_NT_WORKSTATION) {
version = "10";
version = v.dwBuildNumber < 22000 ? "10" : "11";
const auto& release_id = windows_release_id();
if(!release_id.empty()) {
version += ' ';
Expand Down

0 comments on commit 0c7c0a7

Please sign in to comment.