Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-95000

QSysInfo Does not work very well with Windows Server

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14
    • Core: Other
    • None
    • Windows

    Description

      Tested against the Server 2022 preview:
      QSysInfo::productVersion() returns "server2016"
      QSysInfo::prettyProductName() returns "Windows Server 2016 (10.0)".


      Looking at the code in qoperatingsystemversion_win.cpp, it looks like the returned OSVERSIONINFOEX only supports up to Server 2016 (documentation).

      I think a better solution may be to pull the name from the register using something like (semi-psudocode):

      QString sPlatform;
      DWORD dataSize = 100 * sizeof(wchar_t);
      LONG retCode = ::RegGetValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"ProductName", RRF_RT_REG_SZ, nullptr, &sPlatform[0], &dataSize);
      if (retCode != ERROR_SUCCESS) {
      	sPlatform = "Unknown Windows platform";
      }
      

      Some examples of what this returns:

      Windows Server 2022 Standard Evaluation
      Windows Server 2008 R2 Enterprise
      Windows 10 Pro
      

      Given the nature of Windows 10, and how Windows 10 in 2015 is very different to Windows 10 in 2021 it may be good to also include some more info (ie: 21H1, 2004, redstone1, basically one of the columns here)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            owolff Oliver Wolff
            tlander Tim Lander
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes