VirtualBox

Changeset 101179 in vbox for trunk/src


Ignore:
Timestamp:
Sep 19, 2023 5:04:05 PM (15 months ago)
Author:
vboxsync
Message:

Main: IVirtualBox::getGuestOSType() now will only return the supported guest OS types for the host platform currently running on. This in turn is controlled by ISystemProperties::getSupportedPlatformArchitectures(). bugref:10384

File:
1 edited

Legend:

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

    r101164 r101179  
    13771377{
    13781378    AutoReadLock al(m->allGuestOSTypes.getLockHandle() COMMA_LOCKVAL_SRC_POS);
    1379     aGuestOSTypes.resize(m->allGuestOSTypes.size());
    1380     size_t i = 0;
    1381     for (GuestOSTypesOList::const_iterator it = m->allGuestOSTypes.begin();
    1382          it != m->allGuestOSTypes.end(); ++it, ++i)
    1383          (*it).queryInterfaceTo(aGuestOSTypes[i].asOutParam());
     1379
     1380    com::SafeArray<PlatformArchitecture_T> supportedPlatformArchitectures;
     1381    HRESULT hrc = m->pSystemProperties->COMGETTER(SupportedPlatformArchitectures)(ComSafeArrayAsOutParam(supportedPlatformArchitectures));
     1382    ComAssertComRCRetRC(hrc);
     1383
     1384    aGuestOSTypes.clear();
     1385
     1386    /** @todo We might want to redo this at some point, to better group / hash this. */
     1387
     1388    for (GuestOSTypesOList::const_iterator it = m->allGuestOSTypes.begin(); it != m->allGuestOSTypes.end(); ++it)
     1389    {
     1390        bool fFound = false;
     1391        if (supportedPlatformArchitectures.size() == 0) /* If empty, we add all types we have. */
     1392            fFound = true;
     1393        else
     1394        {
     1395            for (size_t i = 0; i < supportedPlatformArchitectures.size(); i++)
     1396            {
     1397                if (supportedPlatformArchitectures[i] == (*it)->i_platformArchitecture())
     1398                {
     1399                    fFound = true;
     1400                    break;
     1401                }
     1402            }
     1403        }
     1404
     1405        if (fFound)
     1406        {
     1407            ComPtr<IGuestOSType> osType;
     1408            (*it).queryInterfaceTo(osType.asOutParam());
     1409            aGuestOSTypes.push_back(osType);
     1410        }
     1411    }
     1412
    13841413    return S_OK;
    13851414}
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