VirtualBox

Changeset 19070 in vbox


Ignore:
Timestamp:
Apr 21, 2009 12:29:36 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
46207
Message:

Main,VBoxManage: Implemented IHost::OperatingSystem and IHost::OSVersion using RTSystemQueryOSInfo. TODO: review error reporting.

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r19068 r19070  
    417417            RTPrintf("Memory available: %lu MByte\n", memoryAvailable);
    418418
    419 #if 0 /* not yet implemented in Main */
    420419            Bstr operatingSystem;
    421420            CHECK_ERROR (Host, COMGETTER(OperatingSystem)(operatingSystem.asOutParam()));
     
    425424            CHECK_ERROR (Host, COMGETTER(OSVersion)(oSVersion.asOutParam()));
    426425            RTPrintf("Operating system version: %lS\n", oSVersion.raw());
    427 #endif
    428426        }
    429427        break;
  • trunk/src/VBox/Main/HostImpl.cpp

    r18704 r19070  
    110110#include <iprt/env.h>
    111111#include <iprt/mem.h>
     112#include <iprt/system.h>
    112113#ifdef RT_OS_SOLARIS
    113114# include <iprt/path.h>
     
    11521153    AutoWriteLock alock (this);
    11531154    CHECK_READY();
    1154     /** @todo */
    1155     ReturnComNotImplemented();
     1155
     1156    char szOSName[80];
     1157    int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szOSName, sizeof(szOSName));
     1158    if (RT_FAILURE(vrc))
     1159        return E_FAIL; /** @todo error reporting? */
     1160    Bstr (szOSName).cloneTo (aOs);
     1161    return S_OK;
    11561162}
    11571163
     
    11671173    AutoWriteLock alock (this);
    11681174    CHECK_READY();
    1169     /** @todo */
    1170     ReturnComNotImplemented();
     1175
     1176    /* Get the OS release. Reserve some buffer space for the service pack. */
     1177    char szOSRelease[128];
     1178    int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szOSRelease, sizeof(szOSRelease) - 32);
     1179    if (RT_FAILURE(vrc))
     1180        return E_FAIL; /** @todo error reporting? */
     1181
     1182    /* Append the service pack if present. */
     1183    char szOSServicePack[80];
     1184    vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szOSServicePack, sizeof(szOSServicePack));
     1185    if (RT_FAILURE(vrc))
     1186    {
     1187        if (vrc != VERR_NOT_SUPPORTED)
     1188            return E_FAIL; /** @todo error reporting? */
     1189        szOSServicePack[0] = '\0';
     1190    }
     1191    if (szOSServicePack[0] != '\0')
     1192    {
     1193        char *psz = strchr(szOSRelease, '\0');
     1194        RTStrPrintf(psz, &szOSRelease[sizeof(szOSRelease)] - psz, "sp%s", szOSServicePack);
     1195    }
     1196
     1197    Bstr (szOSRelease).cloneTo (aVersion);
     1198    return S_OK;
    11711199}
    11721200
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