VirtualBox

Changeset 40539 in vbox


Ignore:
Timestamp:
Mar 19, 2012 2:27:50 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76928
Message:

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

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r40429 r40539  
    33<!--
    44
    5     Copyright (C) 2006-2011 Oracle Corporation
     5    Copyright (C) 2006-2012 Oracle Corporation
    66
    77    This file is part of VirtualBox Open Source Edition (OSE), as
     
    13981398  <interface
    13991399    name="IVirtualBox" extends="$unknown"
    1400     uuid="c28be65f-1a8f-43b4-81f1-eb60cb516e66"
     1400    uuid="8bf22775-a3c1-4f81-80d3-138584474fb3"
    14011401    wsmap="managed"
    14021402    >
     
    17841784      <param name="machine" type="IMachine" dir="return">
    17851785        <desc>Machine object, if found.</desc>
     1786      </param>
     1787    </method>
     1788
     1789    <method name="getMachineStates">
     1790      <desc>
     1791        Gets the state of several machines in a single operation.
     1792      </desc>
     1793      <param name="machines" type="IMachine" dir="in" safearray="yes">
     1794        <desc>Array with the machine references.</desc>
     1795      </param>
     1796      <param name="states" type="MachineState" dir="return" safearray="yes">
     1797        <desc>Machine states, corresponding to the machines.</desc>
    17861798      </param>
    17871799    </method>
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r40524 r40539  
    134134    STDMETHOD(RegisterMachine)(IMachine *aMachine);
    135135    STDMETHOD(FindMachine)(IN_BSTR aNameOrId, IMachine **aMachine);
     136    STDMETHOD(GetMachineStates)(ComSafeArrayIn(IMachine *, aMachines), ComSafeArrayOut(MachineState_T, aStates));
    136137    STDMETHOD(CreateAppliance)(IAppliance **anAppliance);
    137138
  • 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.

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