VirtualBox

Changeset 105917 in vbox


Ignore:
Timestamp:
Sep 2, 2024 2:30:09 PM (5 months ago)
Author:
vboxsync
Message:

Unattended: ​bugref:10511, ​bugref:10384. Check if the detected guest OS type is supported by the host system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/UnattendedImpl.cpp

    r103109 r105917  
    341341{
    342342    HRESULT       hrc;
     343    HRESULT       getSupportedGuestOSTypesRC;
     344    /* Get a list of guest OS Type Ids supported by the host. */
     345    ComPtr<ISystemProperties> pSystemProperties;
     346    com::SafeIfaceArray<IGuestOSType> supportedGuestOSTypes;
     347
     348    hrc = mParent->COMGETTER(SystemProperties)(pSystemProperties.asOutParam());
     349    if (SUCCEEDED(hrc))
     350    {
     351        ComPtr<IPlatformProperties> pPlatformProperties;
     352        hrc = pSystemProperties->COMGETTER(Platform)(pPlatformProperties.asOutParam());
     353        if (SUCCEEDED(hrc))
     354        {
     355            getSupportedGuestOSTypesRC = pPlatformProperties->COMGETTER(SupportedGuestOSTypes)(ComSafeArrayAsOutParam(supportedGuestOSTypes));
     356        }
     357    }
     358
    343359    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    344360
    345 /** @todo once UDF is implemented properly and we've tested this code a lot
    346  *        more, replace E_NOTIMPL with E_FAIL. */
     361    /** @todo once UDF is implemented properly and we've tested this code a lot
     362     *        more, replace E_NOTIMPL with E_FAIL. */
    347363
    348364    /*
     
    490506    }
    491507
     508    if (SUCCEEDED(getSupportedGuestOSTypesRC))
     509    {
     510        bool fSupported = false;
     511        for (size_t i = 0; i < supportedGuestOSTypes.size() && !fSupported; ++i)
     512        {
     513            ComPtr<IGuestOSType> guestOSType = supportedGuestOSTypes[i];
     514
     515            Bstr guestId;
     516            guestOSType->COMGETTER(Id)(guestId.asOutParam());
     517            if (guestId == mStrDetectedOSTypeId)
     518                fSupported = true;
     519        }
     520        if (!fSupported)
     521        {
     522            mStrDetectedOSTypeId.setNull();
     523            mStrDetectedOSVersion.setNull();
     524            mStrDetectedOSFlavor.setNull();
     525            mDetectedOSLanguages.clear();
     526            mStrDetectedOSHints.setNull();
     527            mDetectedImages.clear();
     528        }
     529    }
    492530    /** @todo implement actual detection logic. */
    493531    return hrc;
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