VirtualBox

Changeset 45010 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Mar 12, 2013 5:47:56 PM (12 years ago)
Author:
vboxsync
Message:

GuestCtrl: More code for guest session infrastructure handling (untested, work in progress).

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

Legend:

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

    r44970 r45010  
    89698969    >
    89708970    <desc>
    8971       Guest session statuses.
     8971      Guest session status. This enumeration represents possible values of
     8972      the <link to="IGuestSession::status"/> attribute.
    89728973    </desc>
    89738974    <const name="Undefined"               value="0">
     
    90009001  </enum>
    90019002
     9003  <enum
     9004    name="GuestSessionWaitForFlag"
     9005    uuid="bb7a372a-f635-4e11-a81a-e707f3a52ef5"
     9006    >
     9007    <desc>
     9008      Guest session waiting flags. Multiple flags can be combined.
     9009    </desc>
     9010
     9011    <const name="None"                    value="0">
     9012      <desc>No waiting flags specified. Do not use this.</desc>
     9013    </const>
     9014    <const name="Start"                   value="1">
     9015      <desc>Wait for the guest session being started.</desc>
     9016    </const>
     9017    <const name="Terminate"               value="2">
     9018      <desc>Wait for the guest session being terminated.</desc>
     9019    </const>
     9020    <const name="Status"                  value="4">
     9021      <desc>Wait for the next guest session status change.</desc>
     9022    </const>
     9023  </enum>
     9024 
     9025  <enum
     9026    name="GuestSessionWaitResult"
     9027    uuid="c0f6a8a5-fdb6-42bf-a582-56c6f82bcd2d"
     9028    >
     9029    <desc>
     9030      Guest session waiting results. Depending on the session waiting flags (for
     9031      more information see <link to="GuestSessionWaitForFlag"/>) the waiting result
     9032      can vary based on the session's current status.
     9033
     9034      To wait for a guest session to terminate after it has been
     9035      created by <link to="IGuest::createSession"/> one would specify
     9036      GuestSessionWaitResult_Terminate.
     9037    </desc>
     9038
     9039    <const name="None"                    value="0">
     9040      <desc>No result was returned. Not being used.</desc>
     9041    </const>
     9042    <const name="Start"                   value="1">
     9043      <desc>The guest session has been started.</desc>
     9044    </const>
     9045    <const name="Terminate"               value="2">
     9046      <desc>The guest session has been terminated.</desc>
     9047    </const>
     9048    <const name="Status"                  value="3">
     9049      <desc>
     9050        The guest session has changed its status. The status then can
     9051        be retrieved via <link to="IGuestSession::status"/>.
     9052      </desc>
     9053    </const>
     9054    <const name="Error"                   value="4">
     9055      <desc>Error while executing the process.</desc>
     9056    </const>
     9057    <const name="Timeout"                 value="5">
     9058      <desc>
     9059        The waiting operation timed out. This also will happen
     9060        when no event has been occured matching the
     9061        current waiting flags in a <link to="IGuestSession::waitFor"/> call.
     9062      </desc>
     9063    </const>
     9064    <const name="WaitFlagNotSupported"    value="6">
     9065      <desc>
     9066        A waiting flag specified in the <link to="IGuestSession::waitFor"/> call
     9067        is not supported by the guest.
     9068      </desc>
     9069    </const>
     9070  </enum>
     9071 
    90029072  <enum
    90039073    name="FileSeekType"
     
    90849154      can vary based on the processes' current status.
    90859155
    9086       To wait for a gust process to terminate after it has been
     9156      To wait for a guest process to terminate after it has been
    90879157      created by <link to="IGuestSession::processCreate"/> or <link to="IGuestSession::processCreateEx"/>
    90889158      one would specify ProcessWaitResult_Terminate.
     
    94259495  <interface
    94269496    name="IGuestSession" extends="$unknown"
    9427     uuid="8490516f-9c2c-49e9-b283-35f3ce463f69"
     9497    uuid="56f551a2-f924-43ab-8a69-a954109db878"
    94289498    wsmap="managed"
    94299499    >
     
    1022510295      <param name="file" type="wstring" dir="in">
    1022610296        <desc>Symbolic link to remove.</desc>
     10297      </param>
     10298    </method>
     10299   
     10300    <method name="waitFor">
     10301      <desc>
     10302        Waits for one more events to happen.
     10303      </desc>
     10304      <param name="waitFor" type="unsigned long" dir="in">
     10305        <desc>
     10306          Specifies what to wait for;
     10307          see <link to="GuestSessionWaitForFlag"/> for more information.
     10308        </desc>
     10309      </param>
     10310      <param name="timeoutMS" type="unsigned long" dir="in">
     10311        <desc>
     10312          Timeout (in ms) to wait for the operation to complete.
     10313          Pass 0 for an infinite timeout.
     10314        </desc>
     10315      </param>
     10316      <param name="reason" type="GuestSessionWaitResult" dir="return">
     10317        <desc>
     10318          The overall wait result;
     10319          see <link to="GuestSessionWaitResult"/> for more information.
     10320        </desc>
     10321      </param>
     10322    </method>
     10323
     10324    <method name="waitForArray">
     10325      <desc>
     10326        Waits for one more events to happen.
     10327        Scriptable version of <link to="#waitFor" />.
     10328      </desc>
     10329      <param name="waitFor" type="GuestSessionWaitForFlag" dir="in" safearray="yes">
     10330        <desc>
     10331          Specifies what to wait for;
     10332          see <link to="GuestSessionWaitForFlag"/> for more information.
     10333        </desc>
     10334      </param>
     10335      <param name="timeoutMS" type="unsigned long" dir="in">
     10336        <desc>
     10337          Timeout (in ms) to wait for the operation to complete.
     10338          Pass 0 for an infinite timeout.
     10339        </desc>
     10340      </param>
     10341      <param name="reason" type="GuestSessionWaitResult" dir="return">
     10342        <desc>
     10343          The overall wait result;
     10344          see <link to="GuestSessionWaitResult"/> for more information.
     10345        </desc>
    1022710346      </param>
    1022810347    </method>
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r44935 r45010  
    205205    /** Structure containing the overall result. */
    206206    ProcessWaitResult_T         mResult;
     207};
     208
     209
     210/*
     211 * Class representing a guest control session waiting
     212 * event.
     213 */
     214class GuestSessionWaitEvent : public GuestCtrlEvent
     215{
     216public:
     217
     218    GuestSessionWaitEvent(void);
     219
     220    GuestSessionWaitEvent(uint32_t uWaitFlags);
     221
     222    virtual ~GuestSessionWaitEvent(void);
     223
     224public:
     225
     226    void Destroy(void);
     227
     228    int Init(uint32_t uWaitFlags);
     229
     230    uint32_t GetWaitFlags(void) { return ASMAtomicReadU32(&mFlags); }
     231
     232    GuestSessionWaitResult_T GetWaitResult(void) { return mResult; }
     233
     234    int GetWaitRc(void) { return mRC; }
     235
     236    int Signal(GuestSessionWaitResult_T enmResult, int rc = VINF_SUCCESS);
     237
     238protected:
     239
     240    /** The waiting flag(s). The specifies what to
     241     *  wait for. See GuestSessionWaitFlag_T. */
     242    uint32_t                    mFlags;
     243    /** Structure containing the overall result. */
     244    GuestSessionWaitResult_T    mResult;
    207245};
    208246
  • trunk/src/VBox/Main/include/GuestProcessImpl.h

    r44935 r45010  
    113113        /** The current process status. */
    114114        ProcessStatus_T          mStatus;
     115        /** The last returned process status
     116         *  returned from the guest side. */
    115117        int                      mRC;
    116         /** The mutex for protecting the waiter(s). */
    117         RTSEMMUTEX               mWaitMutex;
    118118        /** How many waiters? At the moment there can only
    119119         *  be one. */
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r44935 r45010  
    311311    STDMETHOD(SymlinkRemoveDirectory)(IN_BSTR aPath);
    312312    STDMETHOD(SymlinkRemoveFile)(IN_BSTR aFile);
     313    STDMETHOD(WaitFor)(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason);
     314    STDMETHOD(WaitForArray)(ComSafeArrayIn(GuestSessionWaitForFlag_T, aFlags), ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason);
    313315    /** @}  */
    314316
     
    347349    static Utf8Str          guestErrorToString(int guestRc);
    348350    int                     onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, GuestCtrlCallback *pCallback, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
    349     int                     openSession(int *pGuestRc);
    350     int                     openSessionAsync(void);
     351    int                     startSessionIntenal(int *pGuestRc);
     352    int                     startSessionAsync(void);
    351353    static DECLCALLBACK(int)
    352                             openSessionThread(RTTHREAD Thread, void *pvUser);
     354                            startSessionThread(RTTHREAD Thread, void *pvUser);
    353355    Guest                  *getParent(void) { return mData.mParent; }
    354356    uint32_t                getProtocolVersion(void) { return mData.mProtocolVersion; }
     
    361363    int                     startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask, ComObjPtr<Progress> &pProgress);
    362364    int                     queryInfo(void);
     365    int                     waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
    363366    /** @}  */
    364367
     
    396399         *  files, ...). */
    397400        uint32_t                    mNumObjects;
     401        /** The last returned session status
     402         *  returned from the guest side. */
     403        int                         mRC;
     404        /** How many waiters? At the moment there can only
     405         *  be one. */
     406        uint32_t                    mWaitCount;
     407        /** The actual session event for doing the waits.
     408         *  At the moment we only support one wait a time. */
     409        GuestSessionWaitEvent      *mWaitEvent;
    398410    } mData;
    399411};
  • trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp

    r44935 r45010  
    174174        Assert(!pSession.isNull());
    175175        int guestRc;
    176         rc = pSession->openSession(&guestRc);
     176        rc = pSession->startSessionIntenal(&guestRc);
    177177        if (RT_FAILURE(rc))
    178178        {
     
    467467         *        the new session.getStatus() API call! */
    468468
    469         /* Open (fork) the session on the guest. */
    470         rc = pSession->openSession(&guestRc);
     469        /* Start (fork) the session on the guest. */
     470        rc = pSession->startSessionIntenal(&guestRc);
    471471        if (RT_SUCCESS(rc))
    472472        {
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r44870 r45010  
    437437
    438438int GuestProcessWaitEvent::Signal(ProcessWaitResult_T enmResult, int rc /*= VINF_SUCCESS*/)
     439{
     440    mResult = enmResult;
     441
     442    return GuestCtrlEvent::Signal(rc);
     443}
     444
     445///////////////////////////////////////////////////////////////////////////////
     446
     447GuestSessionWaitEvent::GuestSessionWaitEvent(void)
     448    : mFlags(0),
     449      mResult(GuestSessionWaitResult_None)
     450{
     451}
     452
     453GuestSessionWaitEvent::GuestSessionWaitEvent(uint32_t uWaitFlags)
     454    : mFlags(uWaitFlags)
     455{
     456    int rc = GuestCtrlEvent::Init();
     457    AssertRC(rc);
     458}
     459
     460GuestSessionWaitEvent::~GuestSessionWaitEvent(void)
     461{
     462    Destroy();
     463}
     464
     465void GuestSessionWaitEvent::Destroy(void)
     466{
     467    GuestCtrlEvent::Destroy();
     468
     469    mFlags = GuestSessionWaitForFlag_None;
     470}
     471
     472int GuestSessionWaitEvent::Signal(GuestSessionWaitResult_T enmResult, int rc /*= VINF_SUCCESS*/)
    439473{
    440474    mResult = enmResult;
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r44945 r45010  
    963963                     mData.mStatus, procStatus, procRc));
    964964
    965 #if 0
    966965    if (procStatus == ProcessStatus_Error)
    967966    {
     
    973972    else
    974973        AssertMsg(RT_SUCCESS(procRc), ("Guest rc must not be an error (%Rrc)\n", procRc));
    975 #endif
    976974
    977975    mData.mStatus = procStatus;
     
    11601158            {
    11611159                int guestRc = pCallbackStart->GetResultCode();
     1160                if (RT_SUCCESS(guestRc))
     1161                {
     1162                    /* Nothing to do here right now. */
     1163                }
     1164                else
     1165                    vrc = VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
     1166
    11621167                if (pGuestRc)
    11631168                    *pGuestRc = guestRc;
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r44935 r45010  
    8888{
    8989    LogFlowThisFunc(("\n"));
     90
     91    mData.mRC = VINF_SUCCESS;
     92    mData.mStatus = GuestSessionStatus_Undefined;
     93
     94    mData.mWaitCount = 0;
     95    mData.mWaitEvent = NULL;
     96
    9097    return BaseFinalConstruct();
    9198}
     
    11231130            break;
    11241131
    1125         case GUEST_SESSION_NOTIFYTYPE_OPEN:
    1126             if (RT_FAILURE(guestRc))
    1127                 mData.mStatus = GuestSessionStatus_Started;
     1132        case GUEST_SESSION_NOTIFYTYPE_STARTED:
     1133            mData.mStatus = GuestSessionStatus_Started;
    11281134            break;
    11291135
    1130         case GUEST_SESSION_NOTIFYTYPE_CLOSE:
    1131             if (RT_FAILURE(guestRc))
    1132                 mData.mStatus = GuestSessionStatus_Terminated;
     1136        case GUEST_SESSION_NOTIFYTYPE_TEN:
     1137        case GUEST_SESSION_NOTIFYTYPE_TES:
     1138        case GUEST_SESSION_NOTIFYTYPE_TEA:
     1139            mData.mStatus = GuestSessionStatus_Terminated;
     1140            break;
     1141
     1142        case GUEST_SESSION_NOTIFYTYPE_TOK:
     1143            mData.mStatus = GuestSessionStatus_TimedOutKilled;
     1144            break;
     1145
     1146        case GUEST_SESSION_NOTIFYTYPE_TOA:
     1147            mData.mStatus = GuestSessionStatus_TimedOutAbnormally;
     1148            break;
     1149
     1150        case GUEST_SESSION_NOTIFYTYPE_DWN:
     1151            mData.mStatus = GuestSessionStatus_Down;
    11331152            break;
    11341153
     
    11671186}
    11681187
    1169 int GuestSession::openSession(int *pGuestRc)
     1188int GuestSession::startSessionIntenal(int *pGuestRc)
    11701189{
    11711190    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    12511270}
    12521271
    1253 int GuestSession::openSessionAsync(void)
     1272int GuestSession::startSessionAsync(void)
    12541273{
    12551274    LogFlowThisFuncEnter();
     
    12641283        AssertReturn(pTask->isOk(), pTask->rc());
    12651284
    1266         vrc = RTThreadCreate(NULL, GuestSession::openSessionThread,
     1285        vrc = RTThreadCreate(NULL, GuestSession::startSessionThread,
    12671286                             (void *)pTask.get(), 0,
    12681287                             RTTHREADTYPE_MAIN_WORKER, 0,
    1269                              "gctlSesOpen");
     1288                             "gctlSesStart");
    12701289        if (RT_SUCCESS(vrc))
    12711290        {
     
    12841303
    12851304/* static */
    1286 DECLCALLBACK(int) GuestSession::openSessionThread(RTTHREAD Thread, void *pvUser)
     1305DECLCALLBACK(int) GuestSession::startSessionThread(RTTHREAD Thread, void *pvUser)
    12871306{
    12881307    LogFlowFunc(("pvUser=%p\n", pvUser));
     
    12971316    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    12981317
    1299     int vrc = pSession->openSession(NULL /* Guest rc, ignored */);
     1318    int vrc = pSession->startSessionIntenal(NULL /* Guest rc, ignored */);
    13001319    /* Nothing to do here anymore. */
    13011320
     
    16031622}
    16041623
     1624int GuestSession::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc)
     1625{
     1626    LogFlowThisFuncEnter();
     1627
     1628    AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER);
     1629
     1630    LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, pGuestRc=%p\n",
     1631                     fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, pGuestRc));
     1632
     1633    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1634
     1635    /* Did some error occur before? Then skip waiting and return. */
     1636    if (mData.mStatus == GuestSessionStatus_Error)
     1637    {
     1638        waitResult = GuestSessionWaitResult_Error;
     1639        AssertMsg(RT_FAILURE(mData.mRC), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mRC));
     1640        if (pGuestRc)
     1641            *pGuestRc = mData.mRC; /* Return last set error. */
     1642        return VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
     1643    }
     1644
     1645    waitResult = GuestSessionWaitResult_None;
     1646    if (fWaitFlags & GuestSessionWaitForFlag_Terminate)
     1647    {
     1648        switch (mData.mStatus)
     1649        {
     1650            case GuestSessionStatus_Terminated:
     1651            case GuestSessionStatus_Down:
     1652                waitResult = GuestSessionWaitResult_Terminate;
     1653                break;
     1654
     1655            case GuestSessionStatus_TimedOutKilled:
     1656            case GuestSessionStatus_TimedOutAbnormally:
     1657                waitResult = GuestSessionWaitResult_Timeout;
     1658                break;
     1659
     1660            case GuestSessionStatus_Error:
     1661                /* Handled above. */
     1662                break;
     1663
     1664            case GuestSessionStatus_Started:
     1665                waitResult = GuestSessionWaitResult_Start;
     1666                break;
     1667
     1668            case GuestSessionStatus_Undefined:
     1669            case GuestSessionStatus_Starting:
     1670                /* Do the waiting below. */
     1671                break;
     1672
     1673            default:
     1674                AssertMsgFailed(("Unhandled session status %ld\n", mData.mStatus));
     1675                return VERR_NOT_IMPLEMENTED;
     1676        }
     1677    }
     1678    else if (fWaitFlags & GuestSessionWaitForFlag_Start)
     1679    {
     1680        switch (mData.mStatus)
     1681        {
     1682            case GuestSessionStatus_Started:
     1683            case GuestSessionStatus_Terminating:
     1684            case GuestSessionStatus_Terminated:
     1685            case GuestSessionStatus_Down:
     1686                waitResult = GuestSessionWaitResult_Start;
     1687                break;
     1688
     1689            case GuestSessionStatus_Error:
     1690                waitResult = GuestSessionWaitResult_Error;
     1691                break;
     1692
     1693            case GuestSessionStatus_TimedOutKilled:
     1694            case GuestSessionStatus_TimedOutAbnormally:
     1695                waitResult = GuestSessionWaitResult_Timeout;
     1696                break;
     1697
     1698            case GuestSessionStatus_Undefined:
     1699            case GuestSessionStatus_Starting:
     1700                /* Do the waiting below. */
     1701                break;
     1702
     1703            default:
     1704                AssertMsgFailed(("Unhandled session status %ld\n", mData.mStatus));
     1705                return VERR_NOT_IMPLEMENTED;
     1706        }
     1707    }
     1708
     1709    LogFlowThisFunc(("sessionStatus=%ld, sessionRc=%Rrc, waitResult=%ld\n",
     1710                     mData.mStatus, mData.mRC, waitResult));
     1711
     1712    /* No waiting needed? Return immediately using the last set error. */
     1713    if (waitResult != GuestSessionWaitResult_None)
     1714    {
     1715        if (pGuestRc)
     1716            *pGuestRc = mData.mRC; /* Return last set error (if any). */
     1717        return RT_SUCCESS(mData.mRC) ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
     1718    }
     1719
     1720    if (mData.mWaitCount > 0) /* We only support one waiting caller a time at the moment. */
     1721        return VERR_ALREADY_EXISTS;
     1722    mData.mWaitCount++;
     1723
     1724    int vrc = VINF_SUCCESS;
     1725    try
     1726    {
     1727        Assert(mData.mWaitEvent == NULL);
     1728        mData.mWaitEvent = new GuestSessionWaitEvent(fWaitFlags);
     1729    }
     1730    catch(std::bad_alloc &)
     1731    {
     1732        vrc = VERR_NO_MEMORY;
     1733    }
     1734
     1735    if (RT_SUCCESS(vrc))
     1736    {
     1737        GuestSessionWaitEvent *pEvent = mData.mWaitEvent;
     1738        AssertPtr(pEvent);
     1739
     1740        alock.release(); /* Release lock before waiting. */
     1741
     1742        vrc = pEvent->Wait(uTimeoutMS);
     1743        LogFlowThisFunc(("Waiting completed with rc=%Rrc\n", vrc));
     1744        if (RT_SUCCESS(vrc))
     1745        {
     1746            waitResult = pEvent->GetWaitResult();
     1747            int waitRc = pEvent->GetWaitRc();
     1748
     1749            LogFlowThisFunc(("Waiting event returned rc=%Rrc\n", waitRc));
     1750
     1751            if (pGuestRc)
     1752                *pGuestRc = waitRc;
     1753
     1754            vrc = RT_SUCCESS(waitRc) ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
     1755        }
     1756
     1757        alock.acquire(); /* Get the lock again. */
     1758
     1759        /* Note: The caller always is responsible of deleting the
     1760         *       stuff it created before. See close() for more information. */
     1761        delete mData.mWaitEvent;
     1762        mData.mWaitEvent = NULL;
     1763    }
     1764
     1765    Assert(mData.mWaitCount);
     1766    mData.mWaitCount--;
     1767
     1768    LogFlowFuncLeaveRC(vrc);
     1769    return vrc;
     1770}
     1771
    16051772// implementation of public methods
    16061773/////////////////////////////////////////////////////////////////////////////
     
    26642831}
    26652832
     2833STDMETHODIMP GuestSession::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
     2834{
     2835#ifndef VBOX_WITH_GUEST_CONTROL
     2836    ReturnComNotImplemented();
     2837#else
     2838    LogFlowThisFuncEnter();
     2839
     2840    CheckComArgOutPointerValid(aReason);
     2841
     2842    AutoCaller autoCaller(this);
     2843    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     2844
     2845    /*
     2846     * Note: Do not hold any locks here while waiting!
     2847     */
     2848    HRESULT hr = S_OK;
     2849
     2850    int guestRc; GuestSessionWaitResult_T waitResult;
     2851    int vrc = waitFor(aWaitFlags, aTimeoutMS, waitResult, &guestRc);
     2852    if (RT_SUCCESS(vrc))
     2853    {
     2854        *aReason = waitResult;
     2855    }
     2856    else
     2857    {
     2858        switch (vrc)
     2859        {
     2860            case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
     2861                hr = GuestSession::setErrorExternal(this, guestRc);
     2862                break;
     2863
     2864            case VERR_TIMEOUT:
     2865                *aReason = GuestSessionWaitResult_Timeout;
     2866                break;
     2867
     2868            default:
     2869            {
     2870                const char *pszSessionName = mData.mSession.mName.c_str();
     2871                hr = setError(VBOX_E_IPRT_ERROR,
     2872                              tr("Waiting for guest session \"%s\" failed: %Rrc"),
     2873                                 pszSessionName ? pszSessionName : tr("Unnamed"), vrc);
     2874                break;
     2875            }
     2876        }
     2877    }
     2878
     2879    LogFlowFuncLeaveRC(vrc);
     2880    return hr;
     2881#endif /* VBOX_WITH_GUEST_CONTROL */
     2882}
     2883
     2884STDMETHODIMP GuestSession::WaitForArray(ComSafeArrayIn(GuestSessionWaitForFlag_T, aFlags), ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
     2885{
     2886#ifndef VBOX_WITH_GUEST_CONTROL
     2887    ReturnComNotImplemented();
     2888#else
     2889    LogFlowThisFuncEnter();
     2890
     2891    CheckComArgOutPointerValid(aReason);
     2892
     2893    AutoCaller autoCaller(this);
     2894    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     2895
     2896    /*
     2897     * Note: Do not hold any locks here while waiting!
     2898     */
     2899    uint32_t fWaitFor = GuestSessionWaitForFlag_None;
     2900    com::SafeArray<GuestSessionWaitForFlag_T> flags(ComSafeArrayInArg(aFlags));
     2901    for (size_t i = 0; i < flags.size(); i++)
     2902        fWaitFor |= flags[i];
     2903
     2904    return WaitFor(fWaitFor, aTimeoutMS, aReason);
     2905#endif /* VBOX_WITH_GUEST_CONTROL */
     2906}
     2907
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r44935 r45010  
    186186    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    187187
    188     int vrc = pSession->openSession(pGuestRc);
     188    int vrc = pSession->startSessionIntenal(pGuestRc);
    189189    /* Nothing to do here anymore. */
    190190
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