VirtualBox

Changeset 31436 in vbox


Ignore:
Timestamp:
Aug 6, 2010 11:39:39 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64502
Message:

Guest Additions version lookup/status: Moved actual version string lookup/fallback to Main to support all other frontends, build up version string using revision number.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

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

    r31282 r31436  
    468468            VBoxGlobal::tr ("Disabled", "details report (Nested Paging)");
    469469        QString addVersionStr = console.GetGuest().GetAdditionsVersion();
    470         if (addVersionStr.isEmpty())
    471         {
    472             /*
    473              * If we got back an empty string from GetAdditionsVersion() we either
    474              * really don't have the Guest Additions version yet or the guest is running
    475              * older Guest Additions (< 3.2.0) which don't provide VMMDevReq_ReportGuestInfo2,
    476              * so get the version + revision from the (hopefully) provided guest properties
    477              * instead.
    478              */
    479             QString addVersion = m.GetGuestPropertyValue("/VirtualBox/GuestAdd/Version");
    480             QString addRevision = m.GetGuestPropertyValue("/VirtualBox/GuestAdd/Revision");
    481             if (!addVersion.isEmpty() && !addRevision.isEmpty())
    482             {
    483                 /* Some Guest Additions versions had interchanged version + revision values,
    484                  * so check if the version value at least has a dot to identify it and change
    485                  * both values to reflect the right content. */
    486                 if (!addVersion.contains("."))
    487                 {
    488                     QString addTemp = addVersion;
    489                     addVersion = addRevision;
    490                     addRevision = addTemp;
    491                 }
    492 
    493                 addVersionStr = addVersion
    494                               + "r"
    495                               + addRevision;
    496             }
    497         }
    498470        if (addVersionStr.isEmpty())
    499471            addVersionStr = tr ("Not Detected", "guest additions");
  • trunk/src/VBox/Main/GuestImpl.cpp

    r31433 r31436  
    185185    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    186186
    187     mData.mAdditionsVersion.cloneTo(aAdditionsVersion);
    188 
    189     return S_OK;
     187    HRESULT hr = S_OK;
     188    if (   mData.mAdditionsVersion.isEmpty()
     189        && mData.mAdditionsActive) /* Only try alternative way if GA are active! */
     190    {
     191        /*
     192         * If we got back an empty string from GetAdditionsVersion() we either
     193         * really don't have the Guest Additions version yet or the guest is running
     194         * older Guest Additions (< 3.2.0) which don't provide VMMDevReq_ReportGuestInfo2,
     195         * so get the version + revision from the (hopefully) provided guest properties
     196         * instead.
     197         */
     198        Bstr addVersion;
     199        ULONG64 u64Timestamp;
     200        Bstr flags;
     201        hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Version"),
     202                                                  addVersion.asOutParam(), &u64Timestamp, flags.asOutParam());
     203        if (hr == S_OK)
     204        {
     205            Bstr addRevision;
     206            hr = mParent->machine()->GetGuestProperty(Bstr("/VirtualBox/GuestAdd/Revision"),
     207                                                      addRevision.asOutParam(), &u64Timestamp, flags.asOutParam());
     208            if (   hr == S_OK
     209                && !addVersion.isEmpty()
     210                && !addVersion.isEmpty())
     211            {
     212                /* Some Guest Additions versions had interchanged version + revision values,
     213                 * so check if the version value at least has a dot to identify it and change
     214                 * both values to reflect the right content. */
     215                if (!Utf8Str(addVersion).contains("."))
     216                {
     217                    Bstr addTemp = addVersion;
     218                    addVersion = addRevision;
     219                    addRevision = addTemp;
     220                }
     221
     222                Bstr additionsVersion = BstrFmt("%lsr%ls",
     223                                                addVersion.raw(), addRevision.raw());
     224                additionsVersion.cloneTo(aAdditionsVersion);
     225            }
     226        }
     227        else
     228        {
     229            /* If getting the version + revision above fails or they simply aren't there
     230             * because of *really* old Guest Additions we only can report the interface
     231             * version to at least have something. */
     232            mData.mInterfaceVersion.cloneTo(aAdditionsVersion);
     233        }
     234    }
     235    else
     236        mData.mAdditionsVersion.cloneTo(aAdditionsVersion);
     237
     238    return hr;
    190239}
    191240
     
    14561505    /*
    14571506     * Note: The Guest Additions API (interface) version is deprecated
    1458      * and will not be used anymore!
     1507     * and will not be used anymore!  We might need it to at least report
     1508     * something as version number if *really* ancient Guest Additions are
     1509     * installed (without the guest version + revision properties having set).
    14591510     */
     1511    mData.mInterfaceVersion = aInterfaceVersion;
    14601512
    14611513    /*
     
    14761528    /*
    14771529     * Older Additions didn't have this finer grained capability bit,
    1478      * so enable it by default.  Newer Additions will disable it immediately
    1479      * if relevant.
     1530     * so enable it by default.  Newer Additions will not enable this here
     1531     * and use the setSupportedFeatures function instead.
    14801532     */
    14811533    mData.mSupportsGraphics = mData.mAdditionsActive;
     
    14971549 * @param aVersionName
    14981550 */
    1499 void Guest::setAdditionsInfo2(Bstr aAdditionsVersion, Bstr aVersionName)
     1551void Guest::setAdditionsInfo2(Bstr aAdditionsVersion, Bstr aVersionName, Bstr aRevision)
    15001552{
    15011553    AutoCaller autoCaller(this);
     
    15051557
    15061558    if (!aVersionName.isEmpty())
    1507         mData.mAdditionsVersion = BstrFmt("%ls %ls", aAdditionsVersion.raw(), aVersionName.raw());
    1508     else
     1559        /*
     1560         * aVersionName could be "x.y.z_BETA1_FOOBAR", so append revision manually to
     1561         * become "x.y.z_BETA1_FOOBARr12345".
     1562         */
     1563        mData.mAdditionsVersion = BstrFmt("%lsr%ls", aVersionName.raw(), aRevision.raw());
     1564    else /* aAdditionsVersion is in x.y.zr12345 format. */
    15091565        mData.mAdditionsVersion = aAdditionsVersion;
    15101566}
  • trunk/src/VBox/Main/VMMDevInterface.cpp

    r31364 r31436  
    228228         */
    229229        guest->setAdditionsInfo(Bstr(), guestInfo->osType); /* Clear interface version + OS type. */
    230         guest->setAdditionsInfo2(Bstr(), Bstr()); /* Clear Guest Additions version. */
     230        guest->setAdditionsInfo2(Bstr(), Bstr(), Bstr()); /* Clear Guest Additions version. */
    231231        guest->setAdditionsStatus(VBoxGuestStatusFacility_All,
    232232                                  VBoxGuestStatusCurrent_Disabled,
     
    266266                                                              guestInfo->additionsBuild,
    267267                                                              guestInfo->additionsRevision);
    268         guest->setAdditionsInfo2(Bstr(version), Bstr(guestInfo->szName));
     268        char revision[16];
     269        RTStrPrintf(revision, sizeof(revision), "%ld", guestInfo->additionsRevision);
     270        guest->setAdditionsInfo2(Bstr(version), Bstr(guestInfo->szName), Bstr(revision));
    269271
    270272        /*
  • trunk/src/VBox/Main/include/GuestImpl.h

    r31241 r31436  
    110110    // Public methods that are not in IDL (only called internally).
    111111    void setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType);
    112     void setAdditionsInfo2(Bstr aAdditionsVersion, Bstr aVersionName);
     112    void setAdditionsInfo2(Bstr aAdditionsVersion, Bstr aVersionName, Bstr aRevision);
    113113    void setAdditionsStatus(VBoxGuestStatusFacility Facility, VBoxGuestStatusCurrent Status, ULONG ulFlags);
    114114    void setSupportedFeatures(ULONG64 ulCaps, ULONG64 ulActive);
     
    172172        BOOL  mAdditionsActive;
    173173        Bstr  mAdditionsVersion;
     174        Bstr  mInterfaceVersion;
    174175        BOOL  mSupportsSeamless;
    175176        BOOL  mSupportsGraphics;
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