VirtualBox

Changeset 39898 in vbox


Ignore:
Timestamp:
Jan 27, 2012 3:27:29 PM (13 years ago)
Author:
vboxsync
Message:

GuestImpl.cpp: Work around the version/revision mixup bug in the 3.1.0 guest additions. (just happened to be installed in a vm I was running...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestImpl.cpp

    r39890 r39898  
    219219            /*
    220220             * If we're running older guest additions (< 3.2.0) try get it from
    221              * the guest properties.
     221             * the guest properties.  Detected switched around Version and
     222             * Revision in early 3.1.x releases (see r57115).
    222223             */
    223224            ComPtr<IMachine> ptrMachine = mParent->machine();
     
    226227            Bstr bstr;
    227228            hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Version").raw(), bstr.asOutParam());
     229            if (SUCCEEDED(hrc))
     230            {
     231                Utf8Str str(bstr);
     232                if (str.count('.') == 0)
     233                    hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Revision").raw(), bstr.asOutParam());
     234                str = bstr;
     235                if (str.count('.') != 2)
     236                    hrc = E_FAIL;
     237            }
     238
    228239            if (SUCCEEDED(hrc))
    229240                bstr.detachTo(a_pbstrAdditionsVersion);
     
    260271            /*
    261272             * If we're running older guest additions (< 3.2.0) try get it from
    262              * the guest properties.
     273             * the guest properties. Detected switched around Version and
     274             * Revision in early 3.1.x releases (see r57115).
    263275             */
    264276            ComPtr<IMachine> ptrMachine = mParent->machine();
     
    272284                uint32_t uRevision;
    273285                int vrc = RTStrToUInt32Full(str.c_str(), 0, &uRevision);
     286                if (vrc != VINF_SUCCESS && str.count('.') == 2)
     287                {
     288                    hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Version").raw(), bstr.asOutParam());
     289                    if (SUCCEEDED(hrc))
     290                    {
     291                        str = bstr;
     292                        vrc = RTStrToUInt32Full(str.c_str(), 0, &uRevision);
     293                    }
     294                }
    274295                if (vrc == VINF_SUCCESS)
    275296                    *a_puAdditionsRevision = uRevision;
     
    281302                /* Return 0 if we don't know. */
    282303                *a_puAdditionsRevision = 0;
    283                 hrc = 0;
     304                hrc = S_OK;
    284305            }
    285306        }
Note: See TracChangeset for help on using the changeset viewer.

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