VirtualBox

Changeset 40539 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Mar 19, 2012 2:27:50 PM (13 years ago)
Author:
vboxsync
Message:

Main/VirtualBox: new method to get the state of several machines

File:
1 edited

Legend:

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

    r40525 r40539  
    16361636
    16371637    return rc;
     1638}
     1639
     1640STDMETHODIMP VirtualBox::GetMachineStates(ComSafeArrayIn(IMachine *, aMachines), ComSafeArrayOut(MachineState_T, aStates))
     1641{
     1642    CheckComArgSafeArrayNotNull(aMachines);
     1643    CheckComArgOutSafeArrayPointerValid(aStates);
     1644
     1645    com::SafeIfaceArray<IMachine> saMachines(ComSafeArrayInArg(aMachines));
     1646    com::SafeArray<MachineState_T> saStates(saMachines.size());
     1647    for (size_t i = 0; i < saMachines.size(); i++)
     1648    {
     1649        ComPtr<IMachine> pMachine = saMachines[i];
     1650        MachineState_T state = MachineState_Null;
     1651        if (!pMachine.isNull())
     1652        {
     1653            HRESULT rc = pMachine->COMGETTER(State)(&state);
     1654            if (rc = E_ACCESSDENIED)
     1655                rc = S_OK;
     1656            AssertComRC(rc);
     1657        }
     1658        saStates[i] = state;
     1659    }
     1660    saStates.detachTo(ComSafeArrayOutArg(aStates));
     1661
     1662    return S_OK;
    16381663}
    16391664
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