VirtualBox

Ignore:
Timestamp:
Apr 4, 2014 7:47:18 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93146
Message:

UIUpdateStepVirtualBox::platformInfo: Use RTSystemQueryOSInfo on windows as the home cooked code here isn't really doing the right things. Also, make the linux code fall back on RTSystemQueryOSInfo code as it's way better than nothing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp

    r46884 r50977  
    267267
    268268        /* Add more system information: */
    269 #if defined (Q_OS_WIN)
    270         OSVERSIONINFO versionInfo;
    271         ZeroMemory(&versionInfo, sizeof(OSVERSIONINFO));
    272         versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    273         GetVersionEx(&versionInfo);
    274         int iMajor = versionInfo.dwMajorVersion;
    275         int iMinor = versionInfo.dwMinorVersion;
    276         int iBuild = versionInfo.dwBuildNumber;
    277         QString strVersionInfo = QString::fromUtf16((ushort*)versionInfo.szCSDVersion);
    278 
    279         QString strDistributiveInfo;
    280         if (iMajor == 6)
    281         {
    282             if (iMinor >= 3)
    283                 strDistributiveInfo = QString("Windows 8.1 %1");
    284             else if (iMinor == 2)
    285                 strDistributiveInfo = QString("Windows 8 %1");
    286             else if (iMinor == 1)
    287                 strDistributiveInfo = QString("Windows 7 %1");
    288             else
    289                 strDistributiveInfo = QString("Windows Vista %1");
    290         }
    291         else if (iMajor == 5)
    292         {
    293             if (iMinor == 2)
    294                 strDistributiveInfo = QString("Windows Server 2003 %1");
    295             else if (iMinor == 1)
    296                 strDistributiveInfo = QString("Windows XP %1");
    297             else if (iMinor == 0)
    298                 strDistributiveInfo = QString("Windows 2000 %1");
    299             else
    300                 strDistributiveInfo = QString("Unknown %1");
    301         }
    302         else if (iMajor == 4)
    303         {
    304             if (iMinor == 90)
    305                 strDistributiveInfo = QString("Windows Me %1");
    306             else if (iMinor == 10)
    307                 strDistributiveInfo = QString("Windows 98 %1");
    308             else if (iMinor == 0)
    309                 strDistributiveInfo = QString("Windows 95 %1");
    310             else
    311                 strDistributiveInfo = QString("Unknown %1");
    312         }
    313         else strDistributiveInfo = QString("Unknown %1");
    314         // TODO: Windows Server 2008 == Vista? */
    315         strDistributiveInfo = strDistributiveInfo.arg(strVersionInfo);
    316         QString strVersion = QString("%1.%2").arg(iMajor).arg(iMinor);
    317         QString strKernel = QString("%1").arg(iBuild);
    318         strPlatform += QString(" [Distribution: %1 | Version: %2 | Build: %3]")
    319             .arg(strDistributiveInfo).arg(strVersion).arg(strKernel);
    320 #elif defined (Q_OS_LINUX)
     269        int vrc;
     270#if defined(Q_OS_LINUX)
     271        /* On linux we wish to send information about the distribution
     272           and such like, so we try invoke a helper script that retrives
     273           and formats it for us. */
     274
    321275        /* Get script path: */
    322276        char szAppPrivPath[RTPATH_MAX];
    323         int rc = RTPathAppPrivateNoArch(szAppPrivPath, sizeof(szAppPrivPath)); NOREF(rc);
    324         AssertRC(rc);
    325         /* Run script: */
    326         QByteArray result = QIProcess::singleShot(QString(szAppPrivPath) + "/VBoxSysInfo.sh");
    327         if (!result.isNull())
    328             strPlatform += QString(" [%1]").arg(QString(result).trimmed());
    329 #else
    330         /* Use RTSystemQueryOSInfo: */
    331         char szTmp[256];
    332         QStringList components;
    333         int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
    334         if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    335             components << QString("Product: %1").arg(szTmp);
    336         vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
    337         if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    338             components << QString("Release: %1").arg(szTmp);
    339         vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
    340         if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    341             components << QString("Version: %1").arg(szTmp);
    342         vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
    343         if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    344             components << QString("SP: %1").arg(szTmp);
    345         if (!components.isEmpty())
    346             strPlatform += QString(" [%1]").arg(components.join(" | "));
     277        vrc = RTPathAppPrivateNoArch(szAppPrivPath, sizeof(szAppPrivPath)); AssertRC(rc);
     278        if (RT_SUCCESS(vrc))
     279        {
     280            /* Run script: */
     281            QByteArray result = QIProcess::singleShot(QString(szAppPrivPath) + "/VBoxSysInfo.sh");
     282            if (!result.isNull())
     283                strPlatform += QString(" [%1]").arg(QString(result).trimmed());
     284            else
     285                vrc = VERR_TRY_AGAIN; /* (take the fallback path) */
     286        }
     287        if (RT_FAILURE(vrc))
    347288#endif
     289        {
     290            /* Use RTSystemQueryOSInfo: */
     291            char szTmp[256];
     292            QStringList components;
     293
     294            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
     295            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
     296                components << QString("Product: %1").arg(szTmp);
     297
     298            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
     299            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
     300                components << QString("Release: %1").arg(szTmp);
     301
     302            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
     303            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
     304                components << QString("Version: %1").arg(szTmp);
     305
     306            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
     307            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
     308                components << QString("SP: %1").arg(szTmp);
     309
     310            if (!components.isEmpty())
     311                strPlatform += QString(" [%1]").arg(components.join(" | "));
     312        }
    348313
    349314        return strPlatform;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette