VirtualBox

Ignore:
Timestamp:
Dec 9, 2010 2:19:12 PM (14 years ago)
Author:
vboxsync
Message:

Automatic Guest Additions update/Main: More robust guest OS type detection, fixed va_list logging.

File:
1 edited

Legend:

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

    r34883 r34889  
    171171        va_list va;
    172172        va_start(va, pszText);
    173         HRESULT hr2 = pProgress->notifyComplete(hr,
    174                                                 COM_IIDOF(IGuest),
    175                                                 Guest::getStaticComponentName(),
    176                                                 pszText,
    177                                                 va);
     173        HRESULT hr2 = pProgress->notifyCompleteV(hr,
     174                                                 COM_IIDOF(IGuest),
     175                                                 Guest::getStaticComponentName(),
     176                                                 pszText,
     177                                                 va);
    178178        va_end(va);
    179179        if (hr2 == S_OK) /* If unable to retrieve error, return input error. */
     
    422422        aTask->progress->SetCurrentOperationProgress(10);
    423423
    424         bool fIsWindows = false;
    425         Utf8Str osType = pGuest->mData.mOSTypeId;
    426         if (   osType.contains("Microsoft", Utf8Str::CaseInsensitive)
    427             || osType.contains("Windows", Utf8Str::CaseInsensitive))
    428         {
    429             fIsWindows = true; /* We have a Windows guest. */
    430         }
    431         else /* Everything else is not supported (yet). */
    432             throw TaskGuest::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->progress,
    433                                                   Guest::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
    434                                                   osType.c_str());
    435 
    436424        /*
    437          * Determine guest type to know which installer stuff
    438          * we need. At the moment only Windows guests are supported.
     425         * Determine guest OS type and the required installer image.
     426         * At the moment only Windows guests are supported.
    439427         */
    440428        Utf8Str installerImage;
    441         if (fIsWindows)
    442         {
    443             if (osType.contains("64", Utf8Str::CaseInsensitive))
    444                 installerImage = "VBOXWINDOWSADDITIONS_AMD64.EXE";
    445             else
    446                 installerImage = "VBOXWINDOWSADDITIONS_X86.EXE";
    447             /* Since the installers are located in the root directory,
    448              * no further path processing needs to be done (yet). */
    449         }
     429        Bstr osTypeId;
     430        if (   SUCCEEDED(pGuest-COMGETTER(OSTypeId(osTypeId.asOutParam())))
     431            && !osTypeId.isEmpty())
     432        {
     433            Utf8Str osTypeIdUtf8(osTypeId); /* Needed for .contains(). */
     434            if (   osTypeIdUtf8.contains("Microsoft", Utf8Str::CaseInsensitive)
     435                || osTypeIdUtf8.contains("Windows", Utf8Str::CaseInsensitive))
     436            {
     437                if (osTypeIdUtf8.contains("64", Utf8Str::CaseInsensitive))
     438                    installerImage = "VBOXWINDOWSADDITIONS_AMD64.EXE";
     439                else
     440                    installerImage = "VBOXWINDOWSADDITIONS_X86.EXE";
     441                /* Since the installers are located in the root directory,
     442                 * no further path processing needs to be done (yet). */
     443            }
     444            else /* Everything else is not supported (yet). */
     445                throw TaskGuest::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->progress,
     446                                                      Guest::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),
     447                                                      osTypeIdUtf8.c_str());
     448        }
     449        else
     450            throw TaskGuest::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->progress,
     451                                                  Guest::tr("Could not detected guest OS type/version, please update manually"));
    450452        Assert(!installerImage.isEmpty());
    451453
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