VirtualBox

Changeset 71299 in vbox for trunk


Ignore:
Timestamp:
Mar 12, 2018 11:30:08 AM (7 years ago)
Author:
vboxsync
Message:

Guest Control: Renaming (guestRc -> rcGuest).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestProcessImpl.h

    r71281 r71299  
    188188{
    189189    /** Return code from the guest side for executing the process tool. */
    190     int  guestRc;
     190    int  rcGuest;
    191191    /** The process tool's returned exit code. */
    192192    int32_t iExitCode;
  • trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp

    r69500 r71299  
    546546    {
    547547        Assert(!pSession.isNull());
    548         int guestRc;
    549         rc = pSession->i_startSessionInternal(&guestRc);
     548        int rcGuest;
     549        rc = pSession->i_startSessionInternal(&rcGuest);
    550550        if (RT_FAILURE(rc))
    551551        {
    552             /** @todo Handle guestRc! */
     552            /** @todo Handle rcGuest! */
    553553
    554554            hr = setError(VBOX_E_IPRT_ERROR, tr("Could not open guest session: %Rrc"), rc);
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r71267 r71299  
    935935
    936936int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx,
    937                                        int guestRc, const GuestWaitEventPayload *pPayload)
    938 {
    939     if (RT_SUCCESS(guestRc))
     937                                       int rcGuest, const GuestWaitEventPayload *pPayload)
     938{
     939    if (RT_SUCCESS(rcGuest))
    940940        return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS,
    941941                                         0 /* Guest rc */, pPayload);
    942942
    943943    return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR,
    944                                      guestRc, pPayload);
     944                                     rcGuest, pPayload);
    945945}
    946946
    947947int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx,
    948                                          int rc, int guestRc,
     948                                         int rc, int rcGuest,
    949949                                         const GuestWaitEventPayload *pPayload)
    950950{
     
    958958        if (itEvent != mWaitEvents.end())
    959959        {
    960             LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc, guestRc=%Rrc, pPayload=%p) ...\n",
    961                              itEvent->second, itEvent->first, rc, guestRc, pPayload));
     960            LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc, rcGuest=%Rrc, pPayload=%p) ...\n",
     961                             itEvent->second, itEvent->first, rc, rcGuest, pPayload));
    962962            GuestWaitEvent *pEvent = itEvent->second;
    963963            AssertPtr(pEvent);
    964             rc2 = pEvent->SignalInternal(rc, guestRc, pPayload);
     964            rc2 = pEvent->SignalInternal(rc, rcGuest, pPayload);
    965965        }
    966966        else
     
    11641164}
    11651165
    1166 int GuestWaitEventBase::SignalInternal(int rc, int guestRc,
     1166int GuestWaitEventBase::SignalInternal(int rc, int rcGuest,
    11671167                                       const GuestWaitEventPayload *pPayload)
    11681168{
     
    11721172#ifdef VBOX_STRICT
    11731173    if (rc == VERR_GSTCTL_GUEST_ERROR)
    1174         AssertMsg(RT_FAILURE(guestRc), ("Guest error indicated but no actual guest error set (%Rrc)\n", guestRc));
     1174        AssertMsg(RT_FAILURE(rcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", rcGuest));
    11751175    else
    1176         AssertMsg(RT_SUCCESS(guestRc), ("No guest error indicated but actual guest error set (%Rrc)\n", guestRc));
     1176        AssertMsg(RT_SUCCESS(rcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", rcGuest));
    11771177#endif
    11781178
     
    11851185    {
    11861186        mRc = rc;
    1187         mGuestRc = guestRc;
     1187        mGuestRc = rcGuest;
    11881188
    11891189        rc2 = RTSemEventSignal(mEventSem);
  • trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp

    r71272 r71299  
    209209
    210210/* static */
    211 Utf8Str GuestDirectory::i_guestErrorToString(int guestRc)
     211Utf8Str GuestDirectory::i_guestErrorToString(int rcGuest)
    212212{
    213213    Utf8Str strError;
    214214
    215215    /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
    216     switch (guestRc)
     216    switch (rcGuest)
    217217    {
    218218        case VERR_DIR_NOT_EMPTY:
     
    221221
    222222        default:
    223             strError += Utf8StrFmt("%Rrc", guestRc);
     223            strError += Utf8StrFmt("%Rrc", rcGuest);
    224224            break;
    225225    }
     
    247247 *
    248248 * @return VBox status code.
    249  * @param  pGuestRc             Where to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned.
    250  */
    251 int GuestDirectory::i_closeInternal(int *pGuestRc)
    252 {
    253     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
    254 
    255     int rc = mData.mProcessTool.terminate(30 * 1000 /* 30s timeout */, pGuestRc);
     249 * @param  prcGuest             Where to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned.
     250 */
     251int GuestDirectory::i_closeInternal(int *prcGuest)
     252{
     253    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
     254
     255    int rc = mData.mProcessTool.terminate(30 * 1000 /* 30s timeout */, prcGuest);
    256256    if (RT_FAILURE(rc))
    257257        return rc;
     
    271271 * @return VBox status code. Will return VERR_NO_MORE_FILES if no more entries are available.
    272272 * @param  fsObjInfo            Where to store the read directory entry.
    273  * @param  pGuestRc             Where to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned.
    274  */
    275 int GuestDirectory::i_readInternal(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pGuestRc)
    276 {
    277     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     273 * @param  prcGuest             Where to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned.
     274 */
     275int GuestDirectory::i_readInternal(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *prcGuest)
     276{
     277    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    278278
    279279    /* Create the FS info object. */
     
    284284    GuestProcessStreamBlock curBlock;
    285285    int rc = mData.mProcessTool.waitEx(GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK,
    286                                          &curBlock, pGuestRc);
     286                                         &curBlock, prcGuest);
    287287    if (RT_SUCCESS(rc))
    288288    {
     
    320320
    321321/* static */
    322 HRESULT GuestDirectory::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
     322HRESULT GuestDirectory::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest)
    323323{
    324324    AssertPtr(pInterface);
    325     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
    326 
    327     return pInterface->setError(VBOX_E_IPRT_ERROR, GuestDirectory::i_guestErrorToString(guestRc).c_str());
     325    AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n"));
     326
     327    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestDirectory::i_guestErrorToString(rcGuest).c_str());
    328328}
    329329
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r71173 r71299  
    355355}
    356356
    357 int GuestFile::i_closeFile(int *pGuestRc)
     357int GuestFile::i_closeFile(int *prcGuest)
    358358{
    359359    LogFlowThisFunc(("strFile=%s\n", mData.mOpenInfo.mFileName.c_str()));
     
    386386    if (RT_SUCCESS(vrc))
    387387        vrc = i_waitForStatusChange(pEvent, 30 * 1000 /* Timeout in ms */,
    388                                     NULL /* FileStatus */, pGuestRc);
     388                                    NULL /* FileStatus */, prcGuest);
    389389    unregisterWaitEvent(pEvent);
    390390
     
    394394
    395395/* static */
    396 Utf8Str GuestFile::i_guestErrorToString(int guestRc)
     396Utf8Str GuestFile::i_guestErrorToString(int rcGuest)
    397397{
    398398    Utf8Str strError;
    399399
    400400    /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
    401     switch (guestRc)
     401    switch (rcGuest)
    402402    {
    403403        case VERR_ALREADY_EXISTS:
     
    418418
    419419        default:
    420             strError += Utf8StrFmt("%Rrc", guestRc);
     420            strError += Utf8StrFmt("%Rrc", rcGuest);
    421421            break;
    422422    }
     
    443443    pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.rc);
    444444
    445     int guestRc = (int)dataCb.rc; /* uint32_t vs. int. */
    446 
    447     LogFlowFunc(("uType=%RU32, guestRc=%Rrc\n",
    448                  dataCb.uType, guestRc));
    449 
    450     if (RT_FAILURE(guestRc))
    451     {
    452         int rc2 = i_setFileStatus(FileStatus_Error, guestRc);
     445    int rcGuest = (int)dataCb.rc; /* uint32_t vs. int. */
     446
     447    LogFlowFunc(("uType=%RU32, rcGuest=%Rrc\n",
     448                 dataCb.uType, rcGuest));
     449
     450    if (RT_FAILURE(rcGuest))
     451    {
     452        int rc2 = i_setFileStatus(FileStatus_Error, rcGuest);
    453453        AssertRC(rc2);
    454454
    455455        rc2 = signalWaitEventInternal(pCbCtx,
    456                                       guestRc, NULL /* pPayload */);
     456                                      rcGuest, NULL /* pPayload */);
    457457        AssertRC(rc2);
    458458
     
    464464        case GUEST_FILE_NOTIFYTYPE_ERROR:
    465465        {
    466             int rc2 = i_setFileStatus(FileStatus_Error, guestRc);
     466            int rc2 = i_setFileStatus(FileStatus_Error, rcGuest);
    467467            AssertRC(rc2);
    468468
     
    481481
    482482                /* Set the process status. */
    483                 int rc2 = i_setFileStatus(FileStatus_Open, guestRc);
     483                int rc2 = i_setFileStatus(FileStatus_Open, rcGuest);
    484484                AssertRC(rc2);
    485485            }
     
    492492        case GUEST_FILE_NOTIFYTYPE_CLOSE:
    493493        {
    494             int rc2 = i_setFileStatus(FileStatus_Closed, guestRc);
     494            int rc2 = i_setFileStatus(FileStatus_Closed, rcGuest);
    495495            AssertRC(rc2);
    496496
     
    592592    {
    593593        GuestWaitEventPayload payload(dataCb.uType, &dataCb, sizeof(dataCb));
    594         int rc2 = signalWaitEventInternal(pCbCtx, guestRc, &payload);
     594        int rc2 = signalWaitEventInternal(pCbCtx, rcGuest, &payload);
    595595        AssertRC(rc2);
    596596    }
    597597
    598     LogFlowThisFunc(("uType=%RU32, guestRc=%Rrc\n",
     598    LogFlowThisFunc(("uType=%RU32, rcGuest=%Rrc\n",
    599599                     dataCb.uType, dataCb.rc));
    600600
     
    642642}
    643643
    644 int GuestFile::i_openFile(uint32_t uTimeoutMS, int *pGuestRc)
     644int GuestFile::i_openFile(uint32_t uTimeoutMS, int *prcGuest)
    645645{
    646646    LogFlowThisFuncEnter();
     
    688688    if (RT_SUCCESS(vrc))
    689689        vrc = i_waitForStatusChange(pEvent, uTimeoutMS,
    690                                     NULL /* FileStatus */, pGuestRc);
     690                                    NULL /* FileStatus */, prcGuest);
    691691
    692692    unregisterWaitEvent(pEvent);
     
    860860
    861861/* static */
    862 HRESULT GuestFile::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
     862HRESULT GuestFile::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest)
    863863{
    864864    AssertPtr(pInterface);
    865     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
    866 
    867     return pInterface->setError(VBOX_E_IPRT_ERROR, GuestFile::i_guestErrorToString(guestRc).c_str());
     865    AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n"));
     866
     867    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestFile::i_guestErrorToString(rcGuest).c_str());
    868868}
    869869
     
    985985
    986986int GuestFile::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
    987                                      FileStatus_T *pFileStatus, int *pGuestRc)
     987                                     FileStatus_T *pFileStatus, int *prcGuest)
    988988{
    989989    AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
     
    10211021            vrc = VERR_GSTCTL_GUEST_ERROR;
    10221022
    1023         if (pGuestRc)
    1024             *pGuestRc = (int)lGuestRc;
     1023        if (prcGuest)
     1024            *prcGuest = (int)lGuestRc;
    10251025    }
    10261026
     
    11831183
    11841184    /* Close file on guest. */
    1185     int guestRc;
    1186     int rc = i_closeFile(&guestRc);
     1185    int rcGuest;
     1186    int rc = i_closeFile(&rcGuest);
    11871187    /* On failure don't return here, instead do all the cleanup
    11881188     * work first and then return an error. */
     
    11961196    {
    11971197        if (rc == VERR_GSTCTL_GUEST_ERROR)
    1198             return GuestFile::i_setErrorExternal(this, guestRc);
     1198            return GuestFile::i_setErrorExternal(this, rcGuest);
    11991199
    12001200        return setError(VBOX_E_IPRT_ERROR,
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r71272 r71299  
    282282
    283283    /* Terminate process if not already done yet. */
    284     int guestRc = VINF_SUCCESS;
    285     int vrc = i_terminateProcess(30 * 1000, &guestRc); /** @todo Make timeouts configurable. */
     284    int rcGuest = VINF_SUCCESS;
     285    int vrc = i_terminateProcess(30 * 1000, &rcGuest); /** @todo Make timeouts configurable. */
    286286    /* Note: Don't return here yet; first uninit all other stuff in
    287287     *       case of failure. */
     
    295295    baseUninit();
    296296
    297     LogFlowThisFunc(("Returning rc=%Rrc, guestRc=%Rrc\n",
    298                      vrc, guestRc));
     297    LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n",
     298                     vrc, rcGuest));
    299299    RT_NOREF_PV(vrc);
    300300}
     
    495495
    496496/* static */
    497 Utf8Str GuestProcess::i_guestErrorToString(int guestRc)
     497Utf8Str GuestProcess::i_guestErrorToString(int rcGuest)
    498498{
    499499    Utf8Str strError;
    500500
    501501    /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
    502     switch (guestRc)
     502    switch (rcGuest)
    503503    {
    504504        case VERR_FILE_NOT_FOUND: /* This is the most likely error. */
     
    549549
    550550        default:
    551             strError += Utf8StrFmt("%Rrc", guestRc);
     551            strError += Utf8StrFmt("%Rrc", rcGuest);
    552552            break;
    553553    }
     
    851851
    852852int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS,
    853                              void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc)
    854 {
    855     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, pGuestRc=%p\n",
    856                      mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, pGuestRc));
     853                             void *pvData, size_t cbData, uint32_t *pcbRead, int *prcGuest)
     854{
     855    LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, prcGuest=%p\n",
     856                     mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, prcGuest));
    857857    AssertReturn(uSize, VERR_INVALID_PARAMETER);
    858858    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     
    874874        if (pcbRead)
    875875            *pcbRead = 0;
    876         if (pGuestRc)
    877             *pGuestRc = VINF_SUCCESS;
     876        if (prcGuest)
     877            *prcGuest = VINF_SUCCESS;
    878878        return VINF_SUCCESS; /* Nothing to read anymore. */
    879879    }
     
    996996
    997997/* static */
    998 HRESULT GuestProcess::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
     998HRESULT GuestProcess::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest)
    999999{
    10001000    AssertPtr(pInterface);
    1001     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
    1002 
    1003     return pInterface->setError(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(guestRc).c_str());
    1004 }
    1005 
    1006 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *pGuestRc)
     1001    AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n"));
     1002
     1003    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest).c_str());
     1004}
     1005
     1006int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *prcGuest)
    10071007{
    10081008    LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n",
     
    10321032        return vrc;
    10331033
    1034     vrc = i_startProcessInner(cMsTimeout, alock, pEvent, pGuestRc);
     1034    vrc = i_startProcessInner(cMsTimeout, alock, pEvent, prcGuest);
    10351035
    10361036    unregisterWaitEvent(pEvent);
     
    10401040}
    10411041
    1042 int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pGuestRc)
     1042int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *prcGuest)
    10431043{
    10441044    GuestSession *pSession = mSession;
     
    11471147    if (RT_SUCCESS(vrc))
    11481148        vrc = i_waitForStatusChange(pEvent, cMsTimeout,
    1149                                     NULL /* Process status */, pGuestRc);
     1149                                    NULL /* Process status */, prcGuest);
    11501150    return vrc;
    11511151}
     
    12051205}
    12061206
    1207 int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *pGuestRc)
    1208 {
    1209     /* pGuestRc is optional. */
     1207int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *prcGuest)
     1208{
     1209    /* prcGuest is optional. */
    12101210    LogFlowThisFunc(("uTimeoutMS=%RU32\n", uTimeoutMS));
    12111211
     
    12551255            if (RT_SUCCESS(vrc))
    12561256                vrc = i_waitForStatusChange(pEvent, uTimeoutMS,
    1257                                             NULL /* ProcessStatus */, pGuestRc);
     1257                                            NULL /* ProcessStatus */, prcGuest);
    12581258            unregisterWaitEvent(pEvent);
    12591259        }
     
    13761376
    13771377int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
    1378                             ProcessWaitResult_T &waitResult, int *pGuestRc)
     1378                            ProcessWaitResult_T &waitResult, int *prcGuest)
    13791379{
    13801380    AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER);
     
    13821382    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    13831383
    1384     LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, pGuestRc=%p\n",
    1385                      fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, pGuestRc));
     1384    LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, prcGuest=%p\n",
     1385                     fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, prcGuest));
    13861386
    13871387    /* Did some error occur before? Then skip waiting and return. */
     
    13921392        AssertMsg(RT_FAILURE(mData.mLastError),
    13931393                             ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError));
    1394         if (pGuestRc)
    1395             *pGuestRc = mData.mLastError; /* Return last set error. */
    1396         LogFlowThisFunc(("Process is in error state (guestRc=%Rrc)\n", mData.mLastError));
     1394        if (prcGuest)
     1395            *prcGuest = mData.mLastError; /* Return last set error. */
     1396        LogFlowThisFunc(("Process is in error state (rcGuest=%Rrc)\n", mData.mLastError));
    13971397        return VERR_GSTCTL_GUEST_ERROR;
    13981398    }
     
    14031403    if (waitResult != ProcessWaitResult_None)
    14041404    {
    1405         if (pGuestRc)
    1406             *pGuestRc = mData.mLastError; /* Return last set error (if any). */
    1407         LogFlowThisFunc(("Nothing to wait for (guestRc=%Rrc)\n", mData.mLastError));
     1405        if (prcGuest)
     1406            *prcGuest = mData.mLastError; /* Return last set error (if any). */
     1407        LogFlowThisFunc(("Nothing to wait for (rcGuest=%Rrc)\n", mData.mLastError));
    14081408        return RT_SUCCESS(mData.mLastError) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR;
    14091409    }
     
    14511451                                    uTimeoutMS == RT_INDEFINITE_WAIT
    14521452                                    ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS,
    1453                                     &newStatus, pGuestRc);
     1453                                    &newStatus, prcGuest);
    14541454        if (RT_SUCCESS(vrc))
    14551455        {
     
    15981598
    15991599int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
    1600                                         ProcessStatus_T *pProcessStatus, int *pGuestRc)
     1600                                        ProcessStatus_T *pProcessStatus, int *prcGuest)
    16011601{
    16021602    AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
    16031603    /* pProcessStatus is optional. */
    1604     /* pGuestRc is optional. */
     1604    /* prcGuest is optional. */
    16051605
    16061606    VBoxEventType_T evtType;
     
    16281628        ComAssertComRC(hr);
    16291629
    1630         LogFlowThisFunc(("Got procStatus=%RU32, guestRc=%RI32 (%Rrc)\n",
     1630        LogFlowThisFunc(("Got procStatus=%RU32, rcGuest=%RI32 (%Rrc)\n",
    16311631                         procStatus, lGuestRc, lGuestRc));
    16321632
     
    16341634            vrc = VERR_GSTCTL_GUEST_ERROR;
    16351635
    1636         if (pGuestRc)
    1637             *pGuestRc = (int)lGuestRc;
     1636        if (prcGuest)
     1637            *prcGuest = (int)lGuestRc;
    16381638    }
    16391639
     
    16771677
    16781678int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags,
    1679                               void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc)
    1680 {
    1681     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, pGuestRc=%p\n",
    1682                      mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, pGuestRc));
     1679                              void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *prcGuest)
     1680{
     1681    LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, prcGuest=%p\n",
     1682                     mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, prcGuest));
    16831683    /* All is optional. There can be 0 byte writes. */
    16841684    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    16881688        if (puWritten)
    16891689            *puWritten = 0;
    1690         if (pGuestRc)
    1691             *pGuestRc = VINF_SUCCESS;
     1690        if (prcGuest)
     1691            *prcGuest = VINF_SUCCESS;
    16921692        return VINF_SUCCESS; /* Not available for writing (anymore). */
    16931693    }
     
    17391739        if (RT_SUCCESS(vrc))
    17401740        {
    1741             /** @todo Set guestRc. */
     1741            /** @todo Set rcGuest. */
    17421742
    17431743            if (puWritten)
     
    17681768    HRESULT hr = S_OK;
    17691769
    1770     uint32_t cbRead; int guestRc;
    1771     int vrc = i_readData(aHandle, aToRead, aTimeoutMS, &aData.front(), aToRead, &cbRead, &guestRc);
     1770    uint32_t cbRead; int rcGuest;
     1771    int vrc = i_readData(aHandle, aToRead, aTimeoutMS, &aData.front(), aToRead, &cbRead, &rcGuest);
    17721772    if (RT_SUCCESS(vrc))
    17731773    {
     
    17821782        {
    17831783            case VERR_GSTCTL_GUEST_ERROR:
    1784                 hr = GuestProcess::i_setErrorExternal(this, guestRc);
     1784                hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    17851785                break;
    17861786
     
    18031803    HRESULT hr = S_OK;
    18041804
    1805     int guestRc;
     1805    int rcGuest;
    18061806    int vrc = i_terminateProcess(30 * 1000 /* Timeout in ms */,
    1807                                  &guestRc);
     1807                                 &rcGuest);
    18081808    if (RT_FAILURE(vrc))
    18091809    {
     
    18111811        {
    18121812           case VERR_GSTCTL_GUEST_ERROR:
    1813                 hr = GuestProcess::i_setErrorExternal(this, guestRc);
     1813                hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    18141814                break;
    18151815
     
    18481848    HRESULT hr = S_OK;
    18491849
    1850     int guestRc;
     1850    int rcGuest;
    18511851    ProcessWaitResult_T waitResult;
    1852     int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &guestRc);
     1852    int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest);
    18531853    if (RT_SUCCESS(vrc))
    18541854    {
     
    18601860        {
    18611861            case VERR_GSTCTL_GUEST_ERROR:
    1862                 hr = GuestProcess::i_setErrorExternal(this, guestRc);
     1862                hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    18631863                break;
    18641864
     
    18991899    HRESULT hr = S_OK;
    19001900
    1901     uint32_t cbWritten; int guestRc;
     1901    uint32_t cbWritten; int rcGuest;
    19021902    uint32_t cbData = (uint32_t)aData.size();
    19031903    void *pvData = cbData > 0? (void *)&aData.front(): NULL;
    1904     int vrc = i_writeData(aHandle, aFlags, pvData, cbData, aTimeoutMS, &cbWritten, &guestRc);
     1904    int vrc = i_writeData(aHandle, aFlags, pvData, cbData, aTimeoutMS, &cbWritten, &rcGuest);
    19051905    if (RT_FAILURE(vrc))
    19061906    {
     
    19081908        {
    19091909            case VERR_GSTCTL_GUEST_ERROR:
    1910                 hr = GuestProcess::i_setErrorExternal(this, guestRc);
     1910                hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    19111911                break;
    19121912
     
    19521952GuestProcessTool::~GuestProcessTool(void)
    19531953{
    1954     terminate(30 * 1000, NULL /* pGuestRc */);
     1954    terminate(30 * 1000, NULL /* prcGuest */);
    19551955}
    19561956
    19571957int GuestProcessTool::init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo,
    1958                            bool fAsync, int *pGuestRc)
     1958                           bool fAsync, int *prcGuest)
    19591959{
    19601960    LogFlowThisFunc(("pGuestSession=%p, exe=%s, fAsync=%RTbool\n",
     
    19831983           )
    19841984        {
    1985             if (pGuestRc)
    1986                 *pGuestRc = vrcGuest;
     1985            if (prcGuest)
     1986                *prcGuest = vrcGuest;
    19871987            vrc = VERR_GSTCTL_GUEST_ERROR;
    19881988        }
     
    20472047/* static */
    20482048int GuestProcessTool::run(      GuestSession              *pGuestSession,
    2049                             const GuestProcessStartupInfo   &startupInfo,
    2050                                   int                       *pGuestRc /* = NULL */)
    2051 {
    2052     int guestRc;
     2049                          const GuestProcessStartupInfo   &startupInfo,
     2050                                int                       *prcGuest /* = NULL */)
     2051{
     2052    int rcGuest;
    20532053
    20542054    GuestProcessToolErrorInfo errorInfo;
     
    20562056    if (RT_SUCCESS(vrc))
    20572057    {
    2058         if (errorInfo.guestRc == VWRN_GSTCTL_PROCESS_EXIT_CODE)
    2059             guestRc = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);
     2058        if (errorInfo.rcGuest == VWRN_GSTCTL_PROCESS_EXIT_CODE)
     2059            rcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);
    20602060        else
    2061             guestRc = errorInfo.guestRc;
    2062 
    2063         if (pGuestRc)
    2064             *pGuestRc = guestRc;
     2061            rcGuest = errorInfo.rcGuest;
     2062
     2063        if (prcGuest)
     2064            *prcGuest = rcGuest;
    20652065    }
    20662066
     
    20782078/* static */
    20792079int GuestProcessTool::runErrorInfo(      GuestSession              *pGuestSession,
    2080                                      const GuestProcessStartupInfo   &startupInfo,
    2081                                            GuestProcessToolErrorInfo &errorInfo)
     2080                                   const GuestProcessStartupInfo   &startupInfo,
     2081                                         GuestProcessToolErrorInfo &errorInfo)
    20822082{
    20832083    return runExErrorInfo(pGuestSession, startupInfo,
     
    20952095 *                                  Optional.
    20962096 * @param   cStrmOutObjects         Number of stream objects passed in. Optional.
    2097  * @param   pGuestRc                Error code returned from the guest side if VERR_GSTCTL_GUEST_ERROR is returned. Optional.
     2097 * @param   prcGuest                Error code returned from the guest side if VERR_GSTCTL_GUEST_ERROR is returned. Optional.
    20982098 */
    20992099/* static */
    21002100int GuestProcessTool::runEx(      GuestSession              *pGuestSession,
    2101                               const GuestProcessStartupInfo   &startupInfo,
    2102                                     GuestCtrlStreamObjects    *paStrmOutObjects,
    2103                                     uint32_t                   cStrmOutObjects,
    2104                                     int                       *pGuestRc /* = NULL */)
    2105 {
    2106     int guestRc;
     2101                            const GuestProcessStartupInfo   &startupInfo,
     2102                                  GuestCtrlStreamObjects    *paStrmOutObjects,
     2103                                  uint32_t                   cStrmOutObjects,
     2104                                  int                       *prcGuest /* = NULL */)
     2105{
     2106    int rcGuest;
    21072107
    21082108    GuestProcessToolErrorInfo errorInfo;
     
    21102110    if (RT_SUCCESS(vrc))
    21112111    {
    2112         if (errorInfo.guestRc == VWRN_GSTCTL_PROCESS_EXIT_CODE)
    2113             guestRc = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);
     2112        if (errorInfo.rcGuest == VWRN_GSTCTL_PROCESS_EXIT_CODE)
     2113            rcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);
    21142114        else
    2115             guestRc = errorInfo.guestRc;
     2115            rcGuest = errorInfo.rcGuest;
    21162116
    21172117        /* Return VERR_GSTCTL_GUEST_ERROR if we retrieved a guest return code. */
    2118         if (RT_FAILURE(guestRc))
     2118        if (RT_FAILURE(rcGuest))
    21192119            vrc = VERR_GSTCTL_GUEST_ERROR;
    21202120
    2121         if (pGuestRc)
    2122             *pGuestRc = guestRc;
     2121        if (prcGuest)
     2122            *prcGuest = rcGuest;
    21232123    }
    21242124
     
    21542154
    21552155    GuestProcessTool procTool;
    2156     int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.guestRc);
     2156    int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.rcGuest);
    21572157    if (RT_SUCCESS(vrc))
    21582158    {
     
    21642164                vrc = procTool.waitEx(  paStrmOutObjects
    21652165                                        ? GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK
    2166                                         : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.guestRc);
     2166                                        : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.rcGuest);
    21672167                if (paStrmOutObjects)
    21682168                    paStrmOutObjects->push_back(strmBlk);
     
    21782178    {
    21792179        /* Make sure the process runs until completion. */
    2180         vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.guestRc);
     2180        vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.rcGuest);
    21812181        if (RT_SUCCESS(vrc))
    2182             errorInfo.guestRc = procTool.terminatedOk(&errorInfo.iExitCode);
    2183     }
    2184 
    2185     LogFlowFunc(("Returned rc=%Rrc, guestRc=%Rrc, iExitCode=%d\n", vrc, errorInfo.guestRc, errorInfo.iExitCode));
     2182            errorInfo.rcGuest = procTool.terminatedOk(&errorInfo.iExitCode);
     2183    }
     2184
     2185    LogFlowFunc(("Returned rc=%Rrc, rcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode));
    21862186    return vrc;
    21872187}
     
    22202220}
    22212221
    2222 int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *pGuestRc)
    2223 {
    2224     return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, pGuestRc);
    2225 }
    2226 
    2227 int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pGuestRc)
    2228 {
    2229     LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, pGuestRc=%p\n", fToolWaitFlags, pStrmBlkOut, pGuestRc));
     2222int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *prcGuest)
     2223{
     2224    return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, prcGuest);
     2225}
     2226
     2227int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *prcGuest)
     2228{
     2229    LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, prcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, prcGuest));
    22302230
    22312231    /* Can we parse the next block without waiting? */
     
    24052405    LogFlowThisFunc(("Loop ended with rc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n",
    24062406                     vrc, vrcGuest, waitRes));
    2407     if (pGuestRc)
    2408         *pGuestRc = vrcGuest;
     2407    if (prcGuest)
     2408        *prcGuest = vrcGuest;
    24092409
    24102410    LogFlowFuncLeaveRC(vrc);
     
    24122412}
    24132413
    2414 int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *pGuestRc)
     2414int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *prcGuest)
    24152415{
    24162416    LogFlowThisFuncEnter();
     
    24192419    if (!pProcess.isNull())
    24202420    {
    2421         rc = pProcess->i_terminateProcess(uTimeoutMS, pGuestRc);
     2421        rc = pProcess->i_terminateProcess(uTimeoutMS, prcGuest);
    24222422        pProcess.setNull();
    24232423    }
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r71272 r71299  
    242242                hr = thisListener.createObject();
    243243                if (SUCCEEDED(hr))
    244                     hr = thisListener->init(pListener, this);
     244                    hr = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */
    245245                if (SUCCEEDED(hr))
    246246                {
     
    340340              ("mNumObjects=%RU32 when it should be 0\n", mData.mNumObjects));
    341341
     342    /* Unitialize our local listener. */
     343    mLocalListener.setNull();
     344
    342345    baseUninit();
    343346
     
    590593///////////////////////////////////////////////////////////////////////////////
    591594
    592 int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc)
    593 {
    594     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     595int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *prcGuest)
     596{
     597    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    595598
    596599    LogFlowThisFunc(("uFlags=%x, uTimeoutMS=%RU32\n", uFlags, uTimeoutMS));
     
    647650    if (RT_SUCCESS(vrc))
    648651        vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS,
    649                                   NULL /* Session status */, pGuestRc);
     652                                  NULL /* Session status */, prcGuest);
    650653
    651654    unregisterWaitEvent(pEvent);
     
    656659
    657660int GuestSession::i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode,
    658                                             uint32_t uFlags, int *pGuestRc)
    659 {
    660     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     661                                            uint32_t uFlags, int *prcGuest)
     662{
     663    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    661664
    662665    LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n", strPath.c_str(), uMode, uFlags));
     
    702705
    703706    if (RT_SUCCESS(vrc))
    704         vrc = GuestProcessTool::run(this, procInfo, pGuestRc);
     707        vrc = GuestProcessTool::run(this, procInfo, prcGuest);
    705708
    706709    LogFlowFuncLeaveRC(vrc);
     
    721724
    722725int GuestSession::i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks,
    723                                                GuestFsObjData &objData, int *pGuestRc)
    724 {
    725     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     726                                               GuestFsObjData &objData, int *prcGuest)
     727{
     728    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    726729
    727730    LogFlowThisFunc(("strPath=%s, fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks));
    728731
    729     int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
     732    int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, prcGuest);
    730733    if (RT_SUCCESS(vrc))
    731734    {
     
    780783
    781784int GuestSession::i_directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags,
    782                                             int *pGuestRc)
     785                                            int *prcGuest)
    783786{
    784787    AssertReturn(!(uFlags & ~DIRREMOVE_FLAG_VALID_MASK), VERR_INVALID_PARAMETER);
    785     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     788    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    786789
    787790    LogFlowThisFunc(("strPath=%s, uFlags=0x%x\n", strPath.c_str(), uFlags));
     
    810813        vrc = pEvent->Wait(30 * 1000);
    811814        if (   vrc == VERR_GSTCTL_GUEST_ERROR
    812             && pGuestRc)
    813             *pGuestRc = pEvent->GuestResult();
     815            && prcGuest)
     816            *prcGuest = pEvent->GuestResult();
    814817    }
    815818
     
    821824
    822825int GuestSession::i_objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath,
    823                                              bool fDirectory, Utf8Str &strName, int *pGuestRc)
    824 {
    825     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     826                                             bool fDirectory, Utf8Str &strName, int *prcGuest)
     827{
     828    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    826829
    827830    LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool\n",
     
    867870            {
    868871                vrcGuest = vrc;
    869                 if (pGuestRc)
    870                     *pGuestRc = vrc;
     872                if (prcGuest)
     873                    *prcGuest = vrc;
    871874                vrc = VERR_GSTCTL_GUEST_ERROR;
    872875            }
     
    878881            strName = objData.mName;
    879882    }
    880     else if (pGuestRc)
    881         *pGuestRc = vrcGuest;
     883    else if (prcGuest)
     884        *prcGuest = vrcGuest;
    882885
    883886    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
     
    886889
    887890int GuestSession::i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
    888                                           ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc)
    889 {
    890     AssertPtrReturn(pGuestRc, VERR_INVALID_POINTER);
     891                                          ComObjPtr<GuestDirectory> &pDirectory, int *prcGuest)
     892{
     893    AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    891894
    892895    LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n",
     
    967970    {
    968971        /* Nothing further to do here yet. */
    969         if (pGuestRc)
    970             *pGuestRc = VINF_SUCCESS;
     972        if (prcGuest)
     973            *prcGuest = VINF_SUCCESS;
    971974    }
    972975
     
    12251228}
    12261229
    1227 int GuestSession::i_fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc)
     1230int GuestSession::i_fileRemoveInternal(const Utf8Str &strPath, int *prcGuest)
    12281231{
    12291232    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
     
    12501253
    12511254    if (RT_SUCCESS(vrc))
    1252         vrc = GuestProcessTool::run(this, procInfo, pGuestRc);
     1255        vrc = GuestProcessTool::run(this, procInfo, prcGuest);
    12531256
    12541257    LogFlowFuncLeaveRC(vrc);
     
    12571260
    12581261int GuestSession::i_fileOpenInternal(const GuestFileOpenInfo &openInfo,
    1259                                      ComObjPtr<GuestFile> &pFile, int *pGuestRc)
     1262                                     ComObjPtr<GuestFile> &pFile, int *prcGuest)
    12601263{
    12611264    LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32 mfOpenEx=%RU32\n",
     
    13451348    if (RT_SUCCESS(rc))
    13461349    {
    1347         int guestRc;
    1348         rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &guestRc);
     1350        int rcGuest;
     1351        rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &rcGuest);
    13491352        if (   rc == VERR_GSTCTL_GUEST_ERROR
    1350             && pGuestRc)
    1351         {
    1352             *pGuestRc = guestRc;
     1353            && prcGuest)
     1354        {
     1355            *prcGuest = rcGuest;
    13531356        }
    13541357    }
     
    13581361}
    13591362
    1360 int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc)
     1363int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest)
    13611364{
    13621365    LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks));
    13631366
    1364     int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
     1367    int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, prcGuest);
    13651368    if (RT_SUCCESS(vrc))
    13661369    {
     
    13731376}
    13741377
    1375 int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc)
     1378int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *prcGuest)
    13761379{
    13771380    AssertPtrReturn(pllSize, VERR_INVALID_POINTER);
    13781381
    13791382    GuestFsObjData objData;
    1380     int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
     1383    int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, prcGuest);
    13811384    if (RT_SUCCESS(vrc))
    13821385        *pllSize = objData.mObjectSize;
     
    13921395 * @param   fFollowSymlinks     Whether to follow symbolic links or not.
    13931396 * @param   objData             Where to return the file system object data, if found.
    1394  * @param   pGuestRc            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
     1397 * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
    13951398 *                              Any other return code indicates some host side error.
    13961399 */
    1397 int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc)
     1400int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest)
    13981401{
    13991402    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
     
    14311434            {
    14321435                vrcGuest = vrc;
    1433                 if (pGuestRc)
    1434                     *pGuestRc = vrc;
     1436                if (prcGuest)
     1437                    *prcGuest = vrc;
    14351438                vrc = VERR_GSTCTL_GUEST_ERROR;
    14361439            }
     
    14391442            vrc = VERR_BROKEN_PIPE;
    14401443    }
    1441     else if (pGuestRc)
    1442         *pGuestRc = vrcGuest;
     1444    else if (prcGuest)
     1445        *prcGuest = vrcGuest;
    14431446
    14441447    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
     
    14571460
    14581461/* static */
    1459 Utf8Str GuestSession::i_guestErrorToString(int guestRc)
     1462Utf8Str GuestSession::i_guestErrorToString(int rcGuest)
    14601463{
    14611464    Utf8Str strError;
    14621465
    14631466    /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
    1464     switch (guestRc)
     1467    switch (rcGuest)
    14651468    {
    14661469        case VERR_INVALID_VM_HANDLE:
     
    15011504
    15021505        default:
    1503             strError += Utf8StrFmt("%Rrc", guestRc);
     1506            strError += Utf8StrFmt("%Rrc", rcGuest);
    15041507            break;
    15051508    }
     
    15701573    AssertRCReturn(vrc, vrc);
    15711574
    1572     LogFlowThisFunc(("ID=%RU32, uType=%RU32, guestRc=%Rrc\n",
     1575    LogFlowThisFunc(("ID=%RU32, uType=%RU32, rcGuest=%Rrc\n",
    15731576                     mData.mSession.mID, dataCb.uType, dataCb.uResult));
    15741577
    15751578    GuestSessionStatus_T sessionStatus = GuestSessionStatus_Undefined;
    15761579
    1577     int guestRc = dataCb.uResult; /** @todo uint32_t vs. int. */
     1580    int rcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */
    15781581    switch (dataCb.uType)
    15791582    {
     
    16311634    if (RT_SUCCESS(vrc))
    16321635    {
    1633         if (RT_FAILURE(guestRc))
     1636        if (RT_FAILURE(rcGuest))
    16341637            sessionStatus = GuestSessionStatus_Error;
    16351638    }
     
    16371640    /* Set the session status. */
    16381641    if (RT_SUCCESS(vrc))
    1639         vrc = i_setSessionStatus(sessionStatus, guestRc);
    1640 
    1641     LogFlowThisFunc(("ID=%RU32, guestRc=%Rrc\n", mData.mSession.mID, guestRc));
     1642        vrc = i_setSessionStatus(sessionStatus, rcGuest);
     1643
     1644    LogFlowThisFunc(("ID=%RU32, rcGuest=%Rrc\n", mData.mSession.mID, rcGuest));
    16421645
    16431646    LogFlowFuncLeaveRC(vrc);
     
    16451648}
    16461649
    1647 int GuestSession::i_startSessionInternal(int *pGuestRc)
     1650int GuestSession::i_startSessionInternal(int *prcGuest)
    16481651{
    16491652    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    17111714        vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start,
    17121715                                    30 * 1000 /* 30s timeout */,
    1713                                     NULL /* Session status */, pGuestRc);
     1716                                    NULL /* Session status */, prcGuest);
    17141717    }
    17151718    else
     
    17941797
    17951798int GuestSession::i_pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest,
    1796                                      uint32_t uFlags, int *pGuestRc)
     1799                                     uint32_t uFlags, int *prcGuest)
    17971800{
    17981801    AssertReturn(!(uFlags & ~PATHRENAME_FLAG_VALID_MASK), VERR_INVALID_PARAMETER);
     
    18261829        vrc = pEvent->Wait(30 * 1000);
    18271830        if (   vrc == VERR_GSTCTL_GUEST_ERROR
    1828             && pGuestRc)
    1829             *pGuestRc = pEvent->GuestResult();
     1831            && prcGuest)
     1832            *prcGuest = pEvent->GuestResult();
    18301833    }
    18311834
     
    20852088
    20862089/* static */
    2087 HRESULT GuestSession::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
     2090HRESULT GuestSession::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest)
    20882091{
    20892092    AssertPtr(pInterface);
    2090     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
    2091 
    2092     return pInterface->setError(VBOX_E_IPRT_ERROR, GuestSession::i_guestErrorToString(guestRc).c_str());
     2093    AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n"));
     2094
     2095    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestSession::i_guestErrorToString(rcGuest).c_str());
    20932096}
    20942097
     
    21862189}
    21872190
    2188 int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc)
     2191int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *prcGuest)
    21892192{
    21902193    LogFlowThisFuncEnter();
     
    21922195    AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER);
    21932196
    2194     /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, pGuestRc=%p\n",
    2195                      fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, pGuestRc));*/
     2197    /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, prcGuest=%p\n",
     2198                     fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, prcGuest));*/
    21962199
    21972200    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    22022205        waitResult = GuestSessionWaitResult_Error;
    22032206        AssertMsg(RT_FAILURE(mData.mRC), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mRC));
    2204         if (pGuestRc)
    2205             *pGuestRc = mData.mRC; /* Return last set error. */
     2207        if (prcGuest)
     2208            *prcGuest = mData.mRC; /* Return last set error. */
    22062209        return VERR_GSTCTL_GUEST_ERROR;
    22072210    }
     
    22862289    if (waitResult != GuestSessionWaitResult_None)
    22872290    {
    2288         if (pGuestRc)
    2289             *pGuestRc = mData.mRC; /* Return last set error (if any). */
     2291        if (prcGuest)
     2292            *prcGuest = mData.mRC; /* Return last set error (if any). */
    22902293        return RT_SUCCESS(mData.mRC) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR;
    22912294    }
     
    23142317    GuestSessionStatus_T sessionStatus;
    23152318    vrc = i_waitForStatusChange(pEvent, fWaitFlags,
    2316                                 uTimeoutMS, &sessionStatus, pGuestRc);
     2319                                uTimeoutMS, &sessionStatus, prcGuest);
    23172320    if (RT_SUCCESS(vrc))
    23182321    {
     
    23532356
    23542357int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
    2355                                         GuestSessionStatus_T *pSessionStatus, int *pGuestRc)
     2358                                        GuestSessionStatus_T *pSessionStatus, int *prcGuest)
    23562359{
    23572360    RT_NOREF(fWaitFlags);
     
    23832386        if (RT_FAILURE((int)lGuestRc))
    23842387            vrc = VERR_GSTCTL_GUEST_ERROR;
    2385         if (pGuestRc)
    2386             *pGuestRc = (int)lGuestRc;
     2388        if (prcGuest)
     2389            *prcGuest = (int)lGuestRc;
    23872390
    23882391        LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: %RU32 (%Rrc)\n",
     
    24062409
    24072410    /* Close session on guest. */
    2408     int guestRc = VINF_SUCCESS;
     2411    int rcGuest = VINF_SUCCESS;
    24092412    int rc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */,
    2410                             &guestRc);
     2413                            &rcGuest);
    24112414    /* On failure don't return here, instead do all the cleanup
    24122415     * work first and then return an error. */
     
    24202423        rc = rc2;
    24212424
    2422     LogFlowThisFunc(("Returning rc=%Rrc, guestRc=%Rrc\n",
    2423                      rc, guestRc));
     2425    LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n",
     2426                     rc, rcGuest));
    24242427    if (RT_FAILURE(rc))
    24252428    {
    24262429        if (rc == VERR_GSTCTL_GUEST_ERROR)
    2427             return GuestSession::i_setErrorExternal(this, guestRc);
     2430            return GuestSession::i_setErrorExternal(this, rcGuest);
    24282431
    24292432        return setError(VBOX_E_IPRT_ERROR,
     
    27692772    HRESULT hr = S_OK;
    27702773
    2771     ComObjPtr <GuestDirectory> pDirectory; int guestRc;
    2772     int rc = i_directoryCreateInternal(aPath, (uint32_t)aMode, fFlags, &guestRc);
     2774    ComObjPtr <GuestDirectory> pDirectory; int rcGuest;
     2775    int rc = i_directoryCreateInternal(aPath, (uint32_t)aMode, fFlags, &rcGuest);
    27732776    if (RT_FAILURE(rc))
    27742777    {
     
    27772780            case VERR_GSTCTL_GUEST_ERROR:
    27782781                hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %s",
    2779                                                     GuestDirectory::i_guestErrorToString(guestRc).c_str()));
     2782                                                    GuestDirectory::i_guestErrorToString(rcGuest).c_str()));
    27802783                break;
    27812784
     
    28102813    HRESULT hr = S_OK;
    28112814
    2812     int guestRc;
     2815    int rcGuest;
    28132816    int rc = i_objectCreateTempInternal(aTemplateName,
    28142817                                        aPath,
    2815                                         true /* Directory */, aDirectory, &guestRc);
     2818                                        true /* Directory */, aDirectory, &rcGuest);
    28162819    if (!RT_SUCCESS(rc))
    28172820    {
     
    28192822        {
    28202823            case VERR_GSTCTL_GUEST_ERROR:
    2821                 hr = GuestProcess::i_setErrorExternal(this, guestRc);
     2824                hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    28222825                break;
    28232826
     
    28412844    HRESULT hr = S_OK;
    28422845
    2843     GuestFsObjData objData; int guestRc;
    2844     int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc);
     2846    GuestFsObjData objData; int rcGuest;
     2847    int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);
    28452848    if (RT_SUCCESS(rc))
    28462849        *aExists = objData.mType == FsObjType_Directory;
     
    28512854            case VERR_GSTCTL_GUEST_ERROR:
    28522855            {
    2853                 switch (guestRc)
     2856                switch (rcGuest)
    28542857                {
    28552858                    case VERR_PATH_NOT_FOUND:
     
    28582861                    default:
    28592862                        hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %s"),
    2860                                       aPath.c_str(), GuestProcess::i_guestErrorToString(guestRc).c_str());
     2863                                      aPath.c_str(), GuestProcess::i_guestErrorToString(rcGuest).c_str());
    28612864                        break;
    28622865                }
     
    29012904    openInfo.mFlags = fFlags;
    29022905
    2903     ComObjPtr <GuestDirectory> pDirectory; int guestRc;
    2904     int rc = i_directoryOpenInternal(openInfo, pDirectory, &guestRc);
     2906    ComObjPtr <GuestDirectory> pDirectory; int rcGuest;
     2907    int rc = i_directoryOpenInternal(openInfo, pDirectory, &rcGuest);
    29052908    if (RT_SUCCESS(rc))
    29062909    {
     
    29182921
    29192922            case VERR_GSTCTL_GUEST_ERROR:
    2920                 hr = GuestDirectory::i_setErrorExternal(this, guestRc);
     2923                hr = GuestDirectory::i_setErrorExternal(this, rcGuest);
    29212924                break;
    29222925
     
    29452948    uint32_t uFlags = 0;
    29462949
    2947     int guestRc;
    2948     int vrc = i_directoryRemoveInternal(aPath, uFlags, &guestRc);
     2950    int rcGuest;
     2951    int vrc = i_directoryRemoveInternal(aPath, uFlags, &rcGuest);
    29492952    if (RT_FAILURE(vrc))
    29502953    {
     
    29572960
    29582961            case VERR_GSTCTL_GUEST_ERROR:
    2959                 hr = GuestDirectory::i_setErrorExternal(this, guestRc);
     2962                hr = GuestDirectory::i_setErrorExternal(this, rcGuest);
    29602963                break;
    29612964
     
    30063009    uint32_t uFlags = DIRREMOVE_FLAG_RECURSIVE
    30073010                    | DIRREMOVE_FLAG_CONTENT_AND_DIR;
    3008     int guestRc;
    3009     int vrc = i_directoryRemoveInternal(aPath, uFlags, &guestRc);
     3011    int rcGuest;
     3012    int vrc = i_directoryRemoveInternal(aPath, uFlags, &rcGuest);
    30103013    if (RT_FAILURE(vrc))
    30113014    {
     
    30183021
    30193022            case VERR_GSTCTL_GUEST_ERROR:
    3020                 hr = GuestFile::i_setErrorExternal(this, guestRc);
     3023                hr = GuestFile::i_setErrorExternal(this, rcGuest);
    30213024                break;
    30223025
     
    31633166        return setError(E_INVALIDARG, tr("No file to check existence for specified"));
    31643167
    3165     GuestFsObjData objData; int guestRc;
    3166     int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc);
     3168    GuestFsObjData objData; int rcGuest;
     3169    int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);
    31673170    if (RT_SUCCESS(vrc))
    31683171    {
     
    31763179    {
    31773180        case VERR_GSTCTL_GUEST_ERROR:
    3178             hr = GuestProcess::i_setErrorExternal(this, guestRc);
     3181            hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    31793182            break;
    31803183
     
    32763279
    32773280    ComObjPtr <GuestFile> pFile;
    3278     int guestRc;
    3279     int vrc = i_fileOpenInternal(openInfo, pFile, &guestRc);
     3281    int rcGuest;
     3282    int vrc = i_fileOpenInternal(openInfo, pFile, &rcGuest);
    32803283    if (RT_SUCCESS(vrc))
    32813284        /* Return directory object to the caller. */
     
    32913294
    32923295            case VERR_GSTCTL_GUEST_ERROR:
    3293                 hr = GuestFile::i_setErrorExternal(this, guestRc);
     3296                hr = GuestFile::i_setErrorExternal(this, rcGuest);
    32943297                break;
    32953298
     
    33113314    HRESULT hr = S_OK;
    33123315
    3313     int64_t llSize; int guestRc;
    3314     int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE,  &llSize, &guestRc);
     3316    int64_t llSize; int rcGuest;
     3317    int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE,  &llSize, &rcGuest);
    33153318    if (RT_SUCCESS(vrc))
    33163319    {
     
    33213324        if (GuestProcess::i_isGuestError(vrc))
    33223325        {
    3323             hr = GuestProcess::i_setErrorExternal(this, guestRc);
     3326            hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    33243327        }
    33253328        else
     
    33783381    HRESULT hrc = S_OK;
    33793382
    3380     GuestFsObjData Info; int guestRc;
    3381     int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, Info, &guestRc);
     3383    GuestFsObjData Info; int rcGuest;
     3384    int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, Info, &rcGuest);
    33823385    if (RT_SUCCESS(vrc))
    33833386    {
     
    33973400        if (GuestProcess::i_isGuestError(vrc))
    33983401        {
    3399             hrc = GuestProcess::i_setErrorExternal(this, guestRc);
     3402            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
    34003403        }
    34013404        else
     
    34153418    HRESULT hrc = S_OK;
    34163419
    3417     int guestRc;
    3418     int vrc = i_fileRemoveInternal(aPath, &guestRc);
     3420    int rcGuest;
     3421    int vrc = i_fileRemoveInternal(aPath, &rcGuest);
    34193422    if (RT_FAILURE(vrc))
    34203423    {
    34213424        if (GuestProcess::i_isGuestError(vrc))
    34223425        {
    3423             hrc = GuestProcess::i_setErrorExternal(this, guestRc);
     3426            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
    34243427        }
    34253428        else
     
    34623465
    34633466    /* Call worker to do the job. */
    3464     int guestRc;
    3465     int vrc = i_pathRenameInternal(aSource, aDestination, fBackend, &guestRc);
     3467    int rcGuest;
     3468    int vrc = i_pathRenameInternal(aSource, aDestination, fBackend, &rcGuest);
    34663469    if (RT_FAILURE(vrc))
    34673470    {
     
    34753478            case VERR_GSTCTL_GUEST_ERROR:
    34763479                hr = setError(VBOX_E_IPRT_ERROR,
    3477                               tr("Renaming guest directory failed: %Rrc"), guestRc);
     3480                              tr("Renaming guest directory failed: %Rrc"), rcGuest);
    34783481                break;
    34793482
     
    36763679    HRESULT hr = S_OK;
    36773680
    3678     int guestRc; GuestSessionWaitResult_T waitResult;
    3679     int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &guestRc);
     3681    int rcGuest; GuestSessionWaitResult_T waitResult;
     3682    int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest);
    36803683    if (RT_SUCCESS(vrc))
    36813684        *aReason = waitResult;
     
    36853688        {
    36863689            case VERR_GSTCTL_GUEST_ERROR:
    3687                 hr = GuestSession::i_setErrorExternal(this, guestRc);
     3690                hr = GuestSession::i_setErrorExternal(this, rcGuest);
    36883691                break;
    36893692
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r71273 r71299  
    215215                 strPath.c_str(), enmDirecotryCreateFlags, uMode, fFollowSymlinks));
    216216
    217     GuestFsObjData objData; int guestRc;
    218 
    219     int rc = mSession->i_directoryQueryInfoInternal(strPath, fFollowSymlinks, objData, &guestRc);
     217    GuestFsObjData objData; int rcGuest;
     218
     219    int rc = mSession->i_directoryQueryInfoInternal(strPath, fFollowSymlinks, objData, &rcGuest);
    220220    if (RT_SUCCESS(rc))
    221221    {
     
    228228            case VERR_GSTCTL_GUEST_ERROR:
    229229            {
    230                 switch (guestRc)
     230                switch (rcGuest)
    231231                {
    232232                    case VERR_FILE_NOT_FOUND:
    233233                    case VERR_PATH_NOT_FOUND:
    234                         rc = mSession->i_directoryCreateInternal(strPath.c_str(), uMode, enmDirecotryCreateFlags, &guestRc);
     234                        rc = mSession->i_directoryCreateInternal(strPath.c_str(), uMode, enmDirecotryCreateFlags, &rcGuest);
    235235                        break;
    236236                    default:
     
    249249        if (rc == VERR_GSTCTL_GUEST_ERROR)
    250250        {
    251             setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(guestRc));
     251            setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest));
    252252        }
    253253        else
     
    996996    ComObjPtr <GuestDirectory> pDir; int rcGuest;
    997997    rc = mSession->i_directoryOpenInternal(dirOpenInfo, pDir, &rcGuest);
     998
    998999    if (RT_FAILURE(rc))
    9991000    {
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