VirtualBox

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


Ignore:
Timestamp:
Jan 24, 2023 10:57:32 AM (2 years ago)
Author:
vboxsync
Message:

Main/Guest*: rc -> hrc/vrc. bugref:10223

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

Legend:

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

    r98103 r98272  
    102102    {
    103103        Assert(m_cRefs <= 1);
    104         int rc = RTEnvDestroy(m_hEnv); AssertRC(rc);
     104        int vrc = RTEnvDestroy(m_hEnv); AssertRC(vrc);
    105105        m_hEnv = NIL_RTENV;
    106106    }
     
    170170    void reset(void)
    171171    {
    172         int rc = RTEnvReset(m_hEnv);
    173         AssertRC(rc);
     172        int vrc = RTEnvReset(m_hEnv);
     173        AssertRC(vrc);
    174174    }
    175175
     
    215215        for (size_t i = 0; i < cArray; i++)
    216216        {
    217             int rc = RTEnvPutEx(m_hEnv, rArray[i].c_str());
    218             if (RT_FAILURE(rc))
     217            int vrc = RTEnvPutEx(m_hEnv, rArray[i].c_str());
     218            if (RT_FAILURE(vrc))
    219219            {
    220220                if (pidxError)
    221221                    *pidxError = i;
    222                 return rc;
     222                return vrc;
    223223            }
    224224        }
     
    275275    int copyUtf8Block(const char *pszzBlock, size_t cbBlock, bool fNoEqualMeansUnset = false)
    276276    {
    277         int rc = VINF_SUCCESS;
     277        int vrc = VINF_SUCCESS;
    278278        while (cbBlock > 0 && *pszzBlock != '\0')
    279279        {
     
    281281            if (!pszEnd)
    282282                return VERR_BUFFER_UNDERFLOW;
    283             int rc2;
     283            int vrc2;
    284284            if (fNoEqualMeansUnset || strchr(pszzBlock, '='))
    285                 rc2 = RTEnvPutEx(m_hEnv, pszzBlock);
     285                vrc2 = RTEnvPutEx(m_hEnv, pszzBlock);
    286286            else
    287                 rc2 = RTEnvSetEx(m_hEnv, pszzBlock, "");
    288             if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
    289                 rc = rc2;
     287                vrc2 = RTEnvSetEx(m_hEnv, pszzBlock, "");
     288            if (RT_FAILURE(vrc2) && RT_SUCCESS(vrc))
     289                vrc = vrc2;
    290290
    291291            /* Advance. */
     
    298298
    299299        /* The remainder must be zero padded. */
    300         if (RT_SUCCESS(rc))
     300        if (RT_SUCCESS(vrc))
    301301        {
    302302            if (ASMMemIsZero(pszzBlock, cbBlock))
     
    304304            return VERR_TOO_MUCH_DATA;
    305305        }
    306         return rc;
     306        return vrc;
    307307    }
    308308
     
    318318    {
    319319        size_t cchNeeded;
    320         int rc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded);
    321         if (   RT_SUCCESS(rc)
    322             || rc == VERR_BUFFER_OVERFLOW)
     320        int vrc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded);
     321        if (   RT_SUCCESS(vrc)
     322            || vrc == VERR_BUFFER_OVERFLOW)
    323323        {
    324324            try
    325325            {
    326326                pValue->reserve(cchNeeded + 1);
    327                 rc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL);
     327                vrc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL);
    328328                pValue->jolt();
    329329            }
    330330            catch (std::bad_alloc &)
    331331            {
    332                 rc = VERR_NO_STR_MEMORY;
     332                vrc = VERR_NO_STR_MEMORY;
    333333            }
    334334        }
    335         return rc;
     335        return vrc;
    336336    }
    337337
     
    384384        , m_fFlags(fFlags)
    385385    {
    386         int rc = cloneCommon(rThat, fChangeRecord);
    387         if (RT_FAILURE(rc))
    388             throw (Global::vboxStatusCodeToCOM(rc));
     386        int vrc = cloneCommon(rThat, fChangeRecord);
     387        if (RT_FAILURE(vrc))
     388            throw Global::vboxStatusCodeToCOM(vrc);
    389389    }
    390390
     
    399399    int cloneCommon(const GuestEnvironmentBase &rThat, bool fChangeRecord)
    400400    {
    401         int   rc = VINF_SUCCESS;
     401        int   vrc = VINF_SUCCESS;
    402402        RTENV hNewEnv = NIL_RTENV;
    403403        if (rThat.m_hEnv != NIL_RTENV)
     
    407407             */
    408408            if (RTEnvIsChangeRecord(rThat.m_hEnv) == fChangeRecord)
    409                 rc = RTEnvClone(&hNewEnv, rThat.m_hEnv);
     409                vrc = RTEnvClone(&hNewEnv, rThat.m_hEnv);
    410410            else
    411411            {
    412412                /* Need to type convert it. */
    413413                if (fChangeRecord)
    414                     rc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags);
     414                    vrc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags);
    415415                else
    416                     rc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags);
    417                 if (RT_SUCCESS(rc))
     416                    vrc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags);
     417                if (RT_SUCCESS(vrc))
    418418                {
    419                     rc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv);
    420                     if (RT_FAILURE(rc))
     419                    vrc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv);
     420                    if (RT_FAILURE(vrc))
    421421                        RTEnvDestroy(hNewEnv);
    422422                }
     
    430430             */
    431431            if (fChangeRecord)
    432                 rc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags);
     432                vrc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags);
    433433            else
    434                 rc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags);
     434                vrc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags);
    435435        }
    436         if (RT_SUCCESS(rc))
     436        if (RT_SUCCESS(vrc))
    437437        {
    438438            RTEnvDestroy(m_hEnv);
     
    440440            m_fFlags = rThat.m_fFlags;
    441441        }
    442         return rc;
     442        return vrc;
    443443    }
    444444
     
    517517    GuestEnvironment &operator=(const GuestEnvironmentBase &rThat)
    518518    {
    519         int rc = copy(rThat);
    520         if (RT_FAILURE(rc))
    521             throw (Global::vboxStatusCodeToCOM(rc));
     519        int vrc = copy(rThat);
     520        if (RT_FAILURE(vrc))
     521            throw Global::vboxStatusCodeToCOM(vrc);
    522522        return *this;
    523523    }
     
    599599    GuestEnvironmentChanges &operator=(const GuestEnvironmentBase &rThat)
    600600    {
    601         int rc = copy(rThat);
    602         if (RT_FAILURE(rc))
    603             throw (Global::vboxStatusCodeToCOM(rc));
     601        int vrc = copy(rThat);
     602        if (RT_FAILURE(vrc))
     603            throw Global::vboxStatusCodeToCOM(vrc);
    604604        return *this;
    605605    }
     
    656656     *
    657657     * @param   eType           Error type to use.
    658      * @param   rc              IPRT-style rc to use.
     658     * @param   vrc             VBox status code to use.
    659659     * @param   pcszWhat        Subject to use.
    660660     */
    661     GuestErrorInfo(GuestErrorInfo::Type eType, int rc, const char *pcszWhat)
    662     {
    663         int rc2 = setV(eType, rc, pcszWhat);
    664         if (RT_FAILURE(rc2))
    665             throw rc2;
    666     }
    667 
    668     /**
    669      * Returns the (IPRT-style) rc of this error.
     661    GuestErrorInfo(GuestErrorInfo::Type eType, int vrc, const char *pcszWhat)
     662    {
     663        int vrc2 = setV(eType, vrc, pcszWhat);
     664        if (RT_FAILURE(vrc2))
     665            throw vrc2;
     666    }
     667
     668    /**
     669     * Returns the VBox status code for this error.
    670670     *
    671671     * @returns VBox status code.
    672672     */
    673     int getRc(void) const { return mRc; }
     673    int getVrc(void) const { return mVrc; }
    674674
    675675    /**
     
    692692     * @returns VBox status code.
    693693     * @param   eType           Error type to use.
    694      * @param   rc              IPRT-style rc to use.
     694     * @param   vrc             VBox status code to use.
    695695     * @param   pcszWhat        Subject to use.
    696696     */
    697     int setV(GuestErrorInfo::Type eType, int rc, const char *pcszWhat)
     697    int setV(GuestErrorInfo::Type eType, int vrc, const char *pcszWhat)
    698698    {
    699699        mType = eType;
    700         mRc   = rc;
     700        mVrc  = vrc;
    701701        mWhat = pcszWhat;
    702702
     
    708708    /** Error type. */
    709709    Type    mType;
    710     /** IPRT-style error code. */
    711     int     mRc;
     710    /** VBox status (error) code. */
     711    int     mVrc;
    712712    /** Subject string related to this error. */
    713713    Utf8Str mWhat;
     
    983983    const char *GetString(const char *pszKey) const;
    984984    size_t      GetCount(void) const;
    985     int         GetRc(void) const;
     985    int         GetVrc(void) const;
    986986    int         GetInt64Ex(const char *pszKey, int64_t *piVal) const;
    987987    int64_t     GetInt64(const char *pszKey) const;
     
    10571057
    10581058    GuestWaitEventPayload(void)
    1059         : uType(0),
    1060           cbData(0),
    1061           pvData(NULL) { }
    1062 
    1063     /**
    1064      * Initialization constructor. Will throw() VBox status code (rc).
     1059        : uType(0)
     1060        , cbData(0)
     1061        , pvData(NULL)
     1062    { }
     1063
     1064    /**
     1065     * Initialization constructor.
     1066     *
     1067     * @throws  VBox status code (vrc).
    10651068     *
    10661069     * @param   uTypePayload    Payload type to set.
     
    10681071     * @param   cbPayload       Size (in bytes) of payload data to set.
    10691072     */
    1070     GuestWaitEventPayload(uint32_t uTypePayload,
    1071                           const void *pvPayload, uint32_t cbPayload)
    1072         : uType(0),
    1073           cbData(0),
    1074           pvData(NULL)
    1075     {
    1076         int rc = copyFrom(uTypePayload, pvPayload, cbPayload);
    1077         if (RT_FAILURE(rc))
    1078             throw rc;
     1073    GuestWaitEventPayload(uint32_t uTypePayload, const void *pvPayload, uint32_t cbPayload)
     1074        : uType(0)
     1075        , cbData(0)
     1076        , pvData(NULL)
     1077    {
     1078        int vrc = copyFrom(uTypePayload, pvPayload, cbPayload);
     1079        if (RT_FAILURE(vrc))
     1080            throw vrc;
    10791081    }
    10801082
     
    11411143        Clear();
    11421144
    1143         int rc = VINF_SUCCESS;
    1144 
     1145        int vrc = VINF_SUCCESS;
    11451146        if (cbPayload)
    11461147        {
     
    11541155            }
    11551156            else
    1156                 rc = VERR_NO_MEMORY;
     1157                vrc = VERR_NO_MEMORY;
    11571158        }
    11581159        else
     
    11641165        }
    11651166
    1166         return rc;
     1167        return vrc;
    11671168    }
    11681169
     
    11871188public:
    11881189
    1189     uint32_t                        ContextID(void) { return mCID; };
    1190     int                             GuestResult(void) { return mGuestRc; }
    1191     int                             Result(void) { return mRc; }
    1192     GuestWaitEventPayload &         Payload(void) { return mPayload; }
    1193     int                             SignalInternal(int rc, int guestRc, const GuestWaitEventPayload *pPayload);
    1194     int                             Wait(RTMSINTERVAL uTimeoutMS);
     1190    uint32_t                ContextID(void) { return mCID; };
     1191    int                     GuestResult(void) { return mGuestRc; }
     1192    int                     Result(void) { return mVrc; }
     1193    GuestWaitEventPayload  &Payload(void) { return mPayload; }
     1194    int                     SignalInternal(int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload);
     1195    int                     Wait(RTMSINTERVAL uTimeoutMS);
    11951196
    11961197protected:
     
    12001201protected:
    12011202
    1202     /* Shutdown indicator. */
     1203    /** Shutdown indicator. */
    12031204    bool                       mfAborted;
    1204     /* Associated context ID (CID). */
     1205    /** Associated context ID (CID). */
    12051206    uint32_t                   mCID;
    1206     /** The event semaphore for triggering
    1207      *  the actual event. */
     1207    /** The event semaphore for triggering the actual event. */
    12081208    RTSEMEVENT                 mEventSem;
    1209     /** The event's overall result. If
    1210      *  set to VERR_GSTCTL_GUEST_ERROR,
    1211      *  mGuestRc will contain the actual
    1212      *  error code from the guest side. */
    1213     int                        mRc;
    1214     /** The event'S overall result from the
    1215      *  guest side. If used, mRc must be
    1216      *  set to VERR_GSTCTL_GUEST_ERROR. */
     1209    /** The event's overall result.
     1210     * If set to VERR_GSTCTL_GUEST_ERROR, mGuestRc will contain the actual
     1211     * error code from the guest side. */
     1212    int                        mVrc;
     1213    /** The event'S overall result from the guest side.
     1214     * If used, mVrc must be set to VERR_GSTCTL_GUEST_ERROR. */
    12171215    int                        mGuestRc;
    12181216    /** The event's payload data. Optional. */
     
    12371235    int                              Cancel(void);
    12381236    const ComPtr<IEvent>             Event(void) { return mEvent; }
    1239     bool                             HasGuestError(void) const { return mRc == VERR_GSTCTL_GUEST_ERROR; }
     1237    bool                             HasGuestError(void) const { return mVrc == VERR_GSTCTL_GUEST_ERROR; }
    12401238    int                              GetGuestError(void) const { return mGuestRc; }
    12411239    int                              SignalExternal(IEvent *pEvent);
     
    12711269     *  for external event listeners. */
    12721270    int signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent);
    1273     /** Signals a wait event using a guest rc. */
    1274     int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int guestRc, const GuestWaitEventPayload *pPayload);
     1271    /** Signals a wait event using a guest vrc. */
     1272    int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrcGuest, const GuestWaitEventPayload *pPayload);
    12751273    /** Signals a wait event without letting public guest events know,
    12761274     *  extended director's cut version. */
    1277     int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int rc, int guestRc, const GuestWaitEventPayload *pPayload);
     1275    int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload);
    12781276
    12791277public:
  • trunk/src/VBox/Main/include/GuestDirectoryImpl.h

    r98103 r98272  
    6868    /** @name Public internal methods.
    6969     * @{ */
    70     int            i_closeInternal(int *pGuestRc);
    71     int            i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pGuestRc);
     70    int            i_closeInternal(int *pvrcGuest);
     71    int            i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pvrcGuest);
    7272    int            i_readInternal(GuestFsObjData &objData, int *prcGuest);
    7373    /** @}  */
     
    7676    /** @name Public static internal methods.
    7777     * @{ */
    78     static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat);
     78    static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat);
    7979    /** @}  */
    8080
  • trunk/src/VBox/Main/include/GuestProcessImpl.h

    r98103 r98272  
    7373    inline int i_checkPID(uint32_t uPID);
    7474    ProcessStatus_T i_getStatus(void);
    75     int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc);
    76     int i_startProcess(uint32_t cMsTimeout, int *pGuestRc);
    77     int i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pGuestRc);
     75    int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pvrcGuest);
     76    int i_startProcess(uint32_t cMsTimeout, int *pvrcGuest);
     77    int i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pvrcGuest);
    7878    int i_startProcessAsync(void);
    79     int i_terminateProcess(uint32_t uTimeoutMS, int *pGuestRc);
     79    int i_terminateProcess(uint32_t uTimeoutMS, int *pvrcGuest);
    8080    ProcessWaitResult_T i_waitFlagsToResult(uint32_t fWaitFlags);
    81     int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc);
     81    int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pvrcGuest);
    8282    int i_waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed);
    8383    int i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, void* pvData, size_t cbData, uint32_t *pcbRead);
    84     int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pGuestRc);
    85     int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc);
     84    int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pvrcGuest);
     85    int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pvrcGuest);
    8686    /** @}  */
    8787
    8888    /** @name Static internal methods.
    8989     * @{ */
    90     static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat);
     90    static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat);
    9191    static Utf8Str i_statusToString(ProcessStatus_T enmStatus);
    9292    static bool i_isGuestError(int guestRc);
     
    108108    int i_onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
    109109    int i_prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars);
    110     int i_setProcessStatus(ProcessStatus_T procStatus, int procRc);
     110    int i_setProcessStatus(ProcessStatus_T procStatus, int vrcProc);
    111111    static int i_startProcessThreadTask(GuestProcessStartTask *pTask);
    112112    /** @}  */
     
    210210struct GuestProcessToolErrorInfo
    211211{
    212     /** Return code from the guest side for executing the process tool. */
    213     int     rcGuest;
     212    /** Return (VBox status) code from the guest side for executing the process tool. */
     213    int     vrcGuest;
    214214    /** The process tool's returned exit code. */
    215215    int32_t iExitCode;
     
    240240public:
    241241
    242     int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pGuestRc);
     242    int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pvrcGuest);
    243243
    244244    void uninit(void);
     
    254254    GuestProcessStream &getStdErr(void) { return mStdErr; }
    255255
    256     int wait(uint32_t fToolWaitFlags, int *pGuestRc);
    257 
    258     int waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStreamBlock, int *pGuestRc);
     256    int wait(uint32_t fToolWaitFlags, int *pvrcGuest);
     257
     258    int waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStreamBlock, int *pvrcGuest);
    259259
    260260    bool isRunning(void);
     
    264264    int getTerminationStatus(int32_t *piExitCode = NULL);
    265265
    266     int terminate(uint32_t uTimeoutMS, int *pGuestRc);
     266    int terminate(uint32_t uTimeoutMS, int *pvrcGuest);
    267267
    268268public:
     
    270270    /** Wrapped @name Static run methods.
    271271     * @{ */
    272     static int run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pGuestRc);
     272    static int run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pvrcGuest);
    273273
    274274    static int runErrorInfo(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, GuestProcessToolErrorInfo &errorInfo);
    275275
    276276    static int runEx(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo,
    277                      GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *pGuestRc);
     277                     GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *pvrcGuest);
    278278
    279279    static int runExErrorInfo(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo,
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r98262 r98272  
    291291    HRESULT                 i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
    292292                                          ComPtr<IProgress> &pProgress);
    293     int                     i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
     293    int                     i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest);
    294294    HRESULT                 i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, DirectoryCopyFlag_T *pfFlags);
    295295    bool                    i_directoryExists(const Utf8Str &strPath);
    296296    inline bool             i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
    297297    int                     i_directoryUnregister(GuestDirectory *pDirectory);
    298     int                     i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pGuestRc);
    299     int                     i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
     298    int                     i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest);
     299    int                     i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
    300300    int                     i_directoryOpen(const GuestDirectoryOpenInfo &openInfo,
    301                                             ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
    302     int                     i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
     301                                            ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest);
     302    int                     i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
    303303    int                     i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
    304304    int                     i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
     
    306306    inline bool             i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
    307307    int                     i_fileUnregister(GuestFile *pFile);
    308     int                     i_fileRemove(const Utf8Str &strPath, int *pGuestRc);
     308    int                     i_fileRemove(const Utf8Str &strPath, int *pvrcGuest);
    309309    int                     i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
    310310                                         FileSharingMode_T aSharingMode, ULONG aCreationMode,
    311311                                         const std::vector<FileOpenExFlag_T> &aFlags,
    312                                          ComObjPtr<GuestFile> &pFile, int *prcGuest);
    313     int                     i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
    314     int                     i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
    315     int                     i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc);
     312                                         ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
     313    int                     i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
     314    int                     i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
     315    int                     i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest);
    316316    int                     i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
    317                                            Utf8Str &strName, uint32_t fMode, bool fSecure, int *pGuestRc);
    318     int                     i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
     317                                           Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest);
     318    int                     i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
    319319    const GuestCredentials &i_getCredentials(void);
    320320    EventSource            *i_getEventSource(void) { return mEventSource; }
     
    328328    PathStyle_T             i_getGuestPathStyle(void);
    329329    static PathStyle_T      i_getHostPathStyle(void);
    330     int                     i_startSession(int *pGuestRc);
     330    int                     i_startSession(int *pvrcGuest);
    331331    int                     i_startSessionAsync(void);
    332332    Guest                  *i_getParent(void) { return mParent; }
     
    336336    int                     i_objectsUnregister(void);
    337337    int                     i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessionStatus);
    338     int                     i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pGuestRc);
    339     int                     i_pathUserDocuments(Utf8Str &strPath, int *prcGuest);
    340     int                     i_pathUserHome(Utf8Str &strPath, int *prcGuest);
     338    int                     i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest);
     339    int                     i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest);
     340    int                     i_pathUserHome(Utf8Str &strPath, int *pvrcGuest);
    341341    int                     i_processUnregister(GuestProcess *pProcess);
    342342    int                     i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
     
    345345    int                     i_sendMessage(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms,
    346346                                          uint64_t fDst = VBOX_GUESTCTRL_DST_SESSION);
    347     int                     i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
    348     int                     i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
    349     int                     i_shutdown(uint32_t fFlags, int *prcGuest);
     347    int                     i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession);
     348    int                     i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */);
     349    int                     i_shutdown(uint32_t fFlags, int *pvrcGuest);
    350350    int                     i_determineProtocolVersion(void);
    351     int                     i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
     351    int                     i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest);
    352352    int                     i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
    353                                                   GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
     353                                                  GuestSessionStatus_T *pSessionStatus, int *pvrcGuest);
    354354    /** @}  */
    355355
  • trunk/src/VBox/Main/include/GuestSessionImplTasks.h

    r98103 r98272  
    218218    {
    219219        setTaskDesc(strTaskDesc);
    220         int rc = createAndSetProgressObject(); /* Single operation by default. */
    221         if (RT_FAILURE(rc))
    222             return E_FAIL;
    223 
    224         return S_OK;
     220        int vrc = createAndSetProgressObject(); /* Single operation by default. */
     221        if (RT_SUCCESS(vrc))
     222            return S_OK;
     223        return E_FAIL;
    225224    }
    226225
     
    262261    int setProgress(ULONG uPercent);
    263262    int setProgressSuccess(void);
    264     HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg);
    265     HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo);
     263    HRESULT setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg);
     264    HRESULT setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo);
    266265
    267266    inline void setTaskDesc(const Utf8Str &strTaskDesc) throw()
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r98103 r98272  
    203203
    204204    /* Object size. */
    205     int rc = strmBlk.GetInt64Ex("st_size", &mObjectSize);
    206     ASSERT_GUEST_RC_RETURN(rc, rc);
     205    int vrc = strmBlk.GetInt64Ex("st_size", &mObjectSize);
     206    ASSERT_GUEST_RC_RETURN(vrc, vrc);
    207207    strmBlk.GetInt64Ex("alloc", &mAllocatedSize);
    208208
     
    261261    mName = strmBlk.GetString("fname");
    262262
    263     /* Return the stream block's rc. */
    264     return strmBlk.GetRc();
     263    /* Return the stream block's vrc. */
     264    return strmBlk.GetVrc();
    265265}
    266266
     
    296296    ASSERT_GUEST_RETURN(mName.isNotEmpty(), VERR_NOT_FOUND);
    297297
    298     /* Assign the stream block's rc. */
    299     int rc = strmBlk.GetRc();
    300 
    301     LogFlowFuncLeaveRC(rc);
    302     return rc;
     298    /* Assign the stream block's vrc. */
     299    int const vrc = strmBlk.GetVrc();
     300    LogFlowFuncLeaveRC(vrc);
     301    return vrc;
    303302}
    304303
     
    426425 * @retval  VERR_NOT_FOUND if the return code string ("rc") was not found.
    427426 */
    428 int GuestProcessStreamBlock::GetRc(void) const
     427int GuestProcessStreamBlock::GetVrc(void) const
    429428{
    430429    const char *pszValue = GetString("rc");
    431430    if (pszValue)
    432     {
    433431        return RTStrToInt16(pszValue);
    434     }
    435432    /** @todo We probably should have a dedicated error for that, VERR_GSTCTL_GUEST_TOOLBOX_whatever. */
    436433    return VERR_NOT_FOUND;
     
    491488    {
    492489        int32_t iRet;
    493         int rc = RTStrToInt32Full(pszValue, 0, &iRet);
    494         if (RT_SUCCESS(rc))
     490        int vrc = RTStrToInt32Full(pszValue, 0, &iRet);
     491        if (RT_SUCCESS(vrc))
    495492            return iRet;
    496493        ASSERT_GUEST_MSG_FAILED(("%s=%s\n", pszKey, pszValue));
     
    525522    AssertPtrReturn(pszKey, VERR_INVALID_POINTER);
    526523
    527     int rc = VINF_SUCCESS;
     524    int vrc = VINF_SUCCESS;
    528525    try
    529526    {
    530         Utf8Str Utf8Key(pszKey);
     527        Utf8Str const strKey(pszKey);
    531528
    532529        /* Take a shortcut and prevent crashes on some funny versions
     
    534531        if (!mPairs.empty())
    535532        {
    536             GuestCtrlStreamPairMapIter it = mPairs.find(Utf8Key);
     533            GuestCtrlStreamPairMapIter it = mPairs.find(strKey);
    537534            if (it != mPairs.end())
    538535                 mPairs.erase(it);
     
    542539        {
    543540            GuestProcessStreamValue val(pszValue);
    544             mPairs[Utf8Key] = val;
    545         }
    546     }
    547     catch (const std::exception &ex)
    548     {
    549         RT_NOREF(ex);
    550     }
    551     return rc;
     541            mPairs[strKey] = val;
     542        }
     543    }
     544    catch (const std::exception &)
     545    {
     546        /** @todo set vrc?   */
     547    }
     548    return vrc;
    552549}
    553550
     
    579576    AssertReturn(cbData, VERR_INVALID_PARAMETER);
    580577
    581     int rc = VINF_SUCCESS;
     578    int vrc = VINF_SUCCESS;
    582579
    583580    /* Rewind the buffer if it's empty. */
     
    620617                }
    621618                else
    622                     rc = VERR_NO_MEMORY;
     619                    vrc = VERR_NO_MEMORY;
    623620            }
    624621            else
    625                 rc = VERR_TOO_MUCH_DATA;
     622                vrc = VERR_TOO_MUCH_DATA;
    626623        }
    627624
    628625        /* Finally, copy the data. */
    629         if (RT_SUCCESS(rc))
     626        if (RT_SUCCESS(vrc))
    630627        {
    631628            if (cbData + m_cbUsed <= m_cbAllocated)
     
    635632            }
    636633            else
    637                 rc = VERR_BUFFER_OVERFLOW;
    638         }
    639     }
    640 
    641     return rc;
     634                vrc = VERR_BUFFER_OVERFLOW;
     635        }
     636    }
     637
     638    return vrc;
    642639}
    643640
     
    671668
    672669    RTFILE hFile;
    673     int rc = RTFileOpen(&hFile, pszFile, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE);
    674     if (RT_SUCCESS(rc))
    675     {
    676         rc = RTFileWrite(hFile, m_pbBuffer, m_cbUsed, NULL /* pcbWritten */);
     670    int vrc = RTFileOpen(&hFile, pszFile, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE);
     671    if (RT_SUCCESS(vrc))
     672    {
     673        vrc = RTFileWrite(hFile, m_pbBuffer, m_cbUsed, NULL /* pcbWritten */);
    677674        RTFileClose(hFile);
    678675    }
     
    707704        return VERR_NO_DATA;
    708705
    709     int          rc        = VINF_SUCCESS;
     706    int          vrc       = VINF_SUCCESS;
    710707    char * const pszOff    = (char *)&m_pbBuffer[m_offBuffer];
    711708    size_t       cbLeft    = m_offBuffer < m_cbUsed ? m_cbUsed - m_offBuffer : 0;
     
    716713        if (!pszPairEnd)
    717714        {
    718             rc = VERR_MORE_DATA;
     715            vrc = VERR_MORE_DATA;
    719716            break;
    720717        }
     
    725722        else
    726723        {
    727             rc = VERR_MORE_DATA; /** @todo r=bird: This is BOGUS because we'll be stuck here if the guest feeds us bad data! */
     724            vrc = VERR_MORE_DATA; /** @todo r=bird: This is BOGUS because we'll be stuck here if the guest feeds us bad data! */
    728725            break;
    729726        }
    730727        char const * const pszVal = pszSep + 1;
    731728
    732         rc = streamBlock.SetValue(pszStart, pszVal);
    733         if (RT_FAILURE(rc))
    734             return rc;
     729        vrc = streamBlock.SetValue(pszStart, pszVal);
     730        if (RT_FAILURE(vrc))
     731            return vrc;
    735732
    736733        /* Next pair. */
     
    750747    m_offBuffer += cbDistance;
    751748
    752     return rc;
     749    return vrc;
    753750}
    754751
     
    770767int GuestBase::baseInit(void)
    771768{
    772     int rc = RTCritSectInit(&mWaitEventCritSect);
    773 
    774     LogFlowFuncLeaveRC(rc);
    775     return rc;
     769    int const vrc = RTCritSectInit(&mWaitEventCritSect);
     770    LogFlowFuncLeaveRC(vrc);
     771    return vrc;
    776772}
    777773
     
    784780
    785781    /* Make sure to cancel any outstanding wait events. */
    786     int rc2 = cancelWaitEvents();
    787     AssertRC(rc2);
    788 
    789     rc2 = RTCritSectDelete(&mWaitEventCritSect);
    790     AssertRC(rc2);
    791 
    792     LogFlowFuncLeaveRC(rc2);
     782    int vrc2 = cancelWaitEvents();
     783    AssertRC(vrc2);
     784
     785    vrc2 = RTCritSectDelete(&mWaitEventCritSect);
     786    AssertRC(vrc2);
     787
     788    LogFlowFuncLeaveRC(vrc2);
    793789    /* No return value. */
    794790}
     
    803799    LogFlowThisFuncEnter();
    804800
    805     int rc = RTCritSectEnter(&mWaitEventCritSect);
    806     if (RT_SUCCESS(rc))
     801    int vrc = RTCritSectEnter(&mWaitEventCritSect);
     802    if (RT_SUCCESS(vrc))
    807803    {
    808804        GuestEventGroup::iterator itEventGroups = mWaitEventGroups.begin();
     
    820816                 * is done by the caller using unregisterWaitEvent().
    821817                 */
    822                 int rc2 = pEvent->Cancel();
    823                 AssertRC(rc2);
     818                int vrc2 = pEvent->Cancel();
     819                AssertRC(vrc2);
    824820
    825821                ++itEvents;
     
    829825        }
    830826
    831         int rc2 = RTCritSectLeave(&mWaitEventCritSect);
    832         if (RT_SUCCESS(rc))
    833             rc = rc2;
    834     }
    835 
    836     LogFlowFuncLeaveRC(rc);
    837     return rc;
     827        int vrc2 = RTCritSectLeave(&mWaitEventCritSect);
     828        if (RT_SUCCESS(vrc))
     829            vrc = vrc2;
     830    }
     831
     832    LogFlowFuncLeaveRC(vrc);
     833    return vrc;
    838834}
    839835
     
    884880                        vrc = signalWaitEventInternal(pCtxCb, dataCb.rc, &evPayload);
    885881                    }
    886                     catch (int rcEx) /* Thrown by GuestWaitEventPayload constructor. */
     882                    catch (int vrcEx) /* Thrown by GuestWaitEventPayload constructor. */
    887883                    {
    888                         vrc = rcEx;
     884                        vrc = vrcEx;
    889885                    }
    890886                }
     
    903899        vrc = VERR_NO_MEMORY;
    904900    }
    905     catch (int rc)
    906     {
    907         vrc = rc;
     901    catch (int vrc)
     902    {
     903        vrc = vrc;
    908904    }
    909905
     
    990986
    991987    uint32_t idContext;
    992     int rc = generateContextID(uSessionID, uObjectID, &idContext);
    993     AssertRCReturn(rc, rc);
     988    int vrc = generateContextID(uSessionID, uObjectID, &idContext);
     989    AssertRCReturn(vrc, vrc);
    994990
    995991    GuestWaitEvent *pEvent = new GuestWaitEvent();
    996992    AssertPtrReturn(pEvent, VERR_NO_MEMORY);
    997993
    998     rc = pEvent->Init(idContext, lstEvents);
    999     AssertRCReturn(rc, rc);
     994    vrc = pEvent->Init(idContext, lstEvents);
     995    AssertRCReturn(vrc, vrc);
    1000996
    1001997    LogFlowThisFunc(("New event=%p, CID=%RU32\n", pEvent, idContext));
    1002998
    1003     rc = RTCritSectEnter(&mWaitEventCritSect);
    1004     if (RT_SUCCESS(rc))
     999    vrc = RTCritSectEnter(&mWaitEventCritSect);
     1000    if (RT_SUCCESS(vrc))
    10051001    {
    10061002        /*
     
    10151011            do
    10161012            {
    1017                 rc = generateContextID(uSessionID, uObjectID, &idContext);
    1018                 AssertRCBreak(rc);
     1013                vrc = generateContextID(uSessionID, uObjectID, &idContext);
     1014                AssertRCBreak(vrc);
    10191015                LogFunc(("Found context ID duplicate; trying a different context ID: %#x\n", idContext));
    10201016                if (mWaitEvents.find(idContext) != mWaitEvents.end())
    1021                     rc = VERR_GSTCTL_MAX_CID_COUNT_REACHED;
    1022             } while (RT_FAILURE_NP(rc) && cTries++ < 10);
    1023         }
    1024         if (RT_SUCCESS(rc))
     1017                    vrc = VERR_GSTCTL_MAX_CID_COUNT_REACHED;
     1018            } while (RT_FAILURE_NP(vrc) && cTries++ < 10);
     1019        }
     1020        if (RT_SUCCESS(vrc))
    10251021        {
    10261022            /*
     
    10451041                            mWaitEventGroups[*ItType].erase(idContext);
    10461042                        }
    1047                         rc = VERR_NO_MEMORY;
     1043                        vrc = VERR_NO_MEMORY;
    10481044                        break;
    10491045                    }
     
    10521048                    Assert(cInserts > 0); /* else: lstEvents has duplicate entries. */
    10531049            }
    1054             if (RT_SUCCESS(rc))
     1050            if (RT_SUCCESS(vrc))
    10551051            {
    10561052                Assert(cInserts > 0 || lstEvents.size() == 0);
     
    10681064                    for (GuestEventTypes::const_iterator ItType = lstEvents.begin(); ItType != lstEvents.end(); ++ItType)
    10691065                        mWaitEventGroups[*ItType].erase(idContext);
    1070                     rc = VERR_NO_MEMORY;
     1066                    vrc = VERR_NO_MEMORY;
    10711067                }
    10721068            }
     
    10751071        RTCritSectLeave(&mWaitEventCritSect);
    10761072    }
    1077     if (RT_SUCCESS(rc))
     1073    if (RT_SUCCESS(vrc))
    10781074    {
    10791075        *ppEvent = pEvent;
    1080         return rc;
     1076        return vrc;
    10811077    }
    10821078
     
    10841080        delete pEvent;
    10851081
    1086     return rc;
     1082    return vrc;
    10871083}
    10881084
     
    10971093int GuestBase::signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent)
    10981094{
    1099     int rc = RTCritSectEnter(&mWaitEventCritSect);
     1095    int vrc = RTCritSectEnter(&mWaitEventCritSect);
    11001096#ifdef DEBUG
    11011097    uint32_t cEvents = 0;
    11021098#endif
    1103     if (RT_SUCCESS(rc))
     1099    if (RT_SUCCESS(vrc))
    11041100    {
    11051101        GuestEventGroup::iterator itGroup = mWaitEventGroups.find(aType);
     
    11141110                                 VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(ItWaitEvt->first), VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(ItWaitEvt->first)));
    11151111
    1116                 int rc2 = ItWaitEvt->second->SignalExternal(aEvent);
    1117                 AssertRC(rc2);
     1112                int vrc2 = ItWaitEvt->second->SignalExternal(aEvent);
     1113                AssertRC(vrc2);
    11181114
    11191115                /* Take down the wait event object details before we erase it from this list and invalid ItGrpEvt. */
     
    11401136        }
    11411137
    1142         int rc2 = RTCritSectLeave(&mWaitEventCritSect);
    1143         if (RT_SUCCESS(rc))
    1144             rc = rc2;
     1138        int vrc2 = RTCritSectLeave(&mWaitEventCritSect);
     1139        if (RT_SUCCESS(vrc))
     1140            vrc = vrc2;
    11451141    }
    11461142
    11471143#ifdef DEBUG
    1148     LogFlowThisFunc(("Signalled %RU32 events, rc=%Rrc\n", cEvents, rc));
     1144    LogFlowThisFunc(("Signalled %RU32 events, vrc=%Rrc\n", cEvents, vrc));
    11491145#endif
    1150     return rc;
     1146    return vrc;
    11511147}
    11521148
     
    11551151 *
    11561152 * @returns VBox status code.
    1157  * @param   pCbCtx              Pointer to host service callback context.
    1158  * @param   rcGuest             Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR.
    1159  * @param   pPayload            Additional wait event payload data set set on return. Optional.
    1160  */
    1161 int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx,
    1162                                        int rcGuest, const GuestWaitEventPayload *pPayload)
    1163 {
    1164     if (RT_SUCCESS(rcGuest))
    1165         return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS,
    1166                                          0 /* Guest rc */, pPayload);
    1167 
    1168     return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR,
    1169                                      rcGuest, pPayload);
     1153 * @param   pCbCtx      Pointer to host service callback context.
     1154 * @param   vrcGuest    Guest return VBox status code to set.
     1155 * @param   pPayload    Additional wait event payload data set set on return. Optional.
     1156 */
     1157int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrcGuest, const GuestWaitEventPayload *pPayload)
     1158{
     1159    if (RT_SUCCESS(vrcGuest))
     1160        return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS, VINF_SUCCESS /* vrcGuest */, pPayload);
     1161
     1162    return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR, vrcGuest, pPayload);
    11701163}
    11711164
     
    11751168 *
    11761169 * @returns VBox status code.
    1177  * @param   pCbCtx              Pointer to host service callback context.
    1178  * @param   rc                  Return code (rc) to set as wait result.
    1179  * @param   rcGuest             Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR.
    1180  * @param   pPayload            Additional wait event payload data set set on return. Optional.
    1181  */
    1182 int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx,
    1183                                          int rc, int rcGuest,
     1170 * @param   pCbCtx      Pointer to host service callback context.
     1171 * @param   vrc         Return VBox status code to set as wait result.
     1172 * @param   vrcGuest    Guest return VBox status code to set additionally, if
     1173 *                      vrc is set to VERR_GSTCTL_GUEST_ERROR.
     1174 * @param   pPayload    Additional wait event payload data set set on return. Optional.
     1175 */
     1176int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrc, int vrcGuest,
    11841177                                         const GuestWaitEventPayload *pPayload)
    11851178{
     
    11871180    /* pPayload is optional. */
    11881181
    1189     int rc2 = RTCritSectEnter(&mWaitEventCritSect);
    1190     if (RT_SUCCESS(rc2))
     1182    int vrc2 = RTCritSectEnter(&mWaitEventCritSect);
     1183    if (RT_SUCCESS(vrc2))
    11911184    {
    11921185        GuestWaitEvents::iterator itEvent = mWaitEvents.find(pCbCtx->uContextID);
    11931186        if (itEvent != mWaitEvents.end())
    11941187        {
    1195             LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc, rcGuest=%Rrc, pPayload=%p) ...\n",
    1196                              itEvent->second, itEvent->first, rc, rcGuest, pPayload));
     1188            LogFlowThisFunc(("Signalling event=%p (CID %RU32, vrc=%Rrc, vrcGuest=%Rrc, pPayload=%p) ...\n",
     1189                             itEvent->second, itEvent->first, vrc, vrcGuest, pPayload));
    11971190            GuestWaitEvent *pEvent = itEvent->second;
    11981191            AssertPtr(pEvent);
    1199             rc2 = pEvent->SignalInternal(rc, rcGuest, pPayload);
     1192            vrc2 = pEvent->SignalInternal(vrc, vrcGuest, pPayload);
    12001193        }
    12011194        else
    1202             rc2 = VERR_NOT_FOUND;
    1203 
    1204         int rc3 = RTCritSectLeave(&mWaitEventCritSect);
    1205         if (RT_SUCCESS(rc2))
    1206             rc2 = rc3;
    1207     }
    1208 
    1209     return rc2;
     1195            vrc2 = VERR_NOT_FOUND;
     1196
     1197        int vrc3 = RTCritSectLeave(&mWaitEventCritSect);
     1198        if (RT_SUCCESS(vrc2))
     1199            vrc2 = vrc3;
     1200    }
     1201
     1202    return vrc2;
    12101203}
    12111204
     
    12231216        return VINF_SUCCESS;
    12241217
    1225     int rc = RTCritSectEnter(&mWaitEventCritSect);
    1226     if (RT_SUCCESS(rc))
     1218    int vrc = RTCritSectEnter(&mWaitEventCritSect);
     1219    if (RT_SUCCESS(vrc))
    12271220    {
    12281221        LogFlowThisFunc(("pWaitEvt=%p\n", pWaitEvt));
     
    12811274        {
    12821275            RT_NOREF(ex);
    1283             AssertFailedStmt(rc = VERR_NOT_FOUND);
    1284         }
    1285 
    1286         int rc2 = RTCritSectLeave(&mWaitEventCritSect);
    1287         if (RT_SUCCESS(rc))
    1288             rc = rc2;
    1289     }
    1290 
    1291     return rc;
     1276            AssertFailedStmt(vrc = VERR_NOT_FOUND);
     1277        }
     1278
     1279        int vrc2 = RTCritSectLeave(&mWaitEventCritSect);
     1280        if (RT_SUCCESS(vrc))
     1281            vrc = vrc2;
     1282    }
     1283
     1284    return vrc;
    12921285}
    12931286
     
    13181311            if (pType)
    13191312            {
    1320                 HRESULT hr = pThisEvent->COMGETTER(Type)(pType);
    1321                 if (FAILED(hr))
     1313                HRESULT hrc = pThisEvent->COMGETTER(Type)(pType);
     1314                if (FAILED(hrc))
    13221315                    vrc = VERR_COM_UNEXPECTED;
    13231316            }
     
    13551348/* static */ Utf8Str GuestBase::getErrorAsString(const GuestErrorInfo& guestErrorInfo)
    13561349{
    1357     AssertMsg(RT_FAILURE(guestErrorInfo.getRc()), ("Guest rc does not indicate a failure\n"));
     1350    AssertMsg(RT_FAILURE(guestErrorInfo.getVrc()), ("Guest vrc does not indicate a failure\n"));
    13581351
    13591352    Utf8Str strErr;
     
    13691362    {
    13701363        case GuestErrorInfo::Type_Session:
    1371             strErr = GuestSession::i_guestErrorToString(guestErrorInfo.getRc());
     1364            strErr = GuestSession::i_guestErrorToString(guestErrorInfo.getVrc());
    13721365            break;
    13731366
    13741367        case GuestErrorInfo::Type_Process:
    1375             strErr = GuestProcess::i_guestErrorToString(guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str());
     1368            strErr = GuestProcess::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str());
    13761369            break;
    13771370
    13781371        case GuestErrorInfo::Type_File:
    1379             strErr = GuestFile::i_guestErrorToString(guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str());
     1372            strErr = GuestFile::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str());
    13801373            break;
    13811374
    13821375        case GuestErrorInfo::Type_Directory:
    1383             strErr = GuestDirectory::i_guestErrorToString(guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str());
     1376            strErr = GuestDirectory::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str());
    13841377            break;
    13851378
     
    13921385
    13931386        default:
    1394             AssertMsgFailed(("Type not implemented (type=%RU32, rc=%Rrc)\n", guestErrorInfo.getType(), guestErrorInfo.getRc()));
    1395             strErr = Utf8StrFmt("Unknown / Not implemented -- Please file a bug report (type=%RU32, rc=%Rrc)\n",
    1396                                 guestErrorInfo.getType(), guestErrorInfo.getRc());
     1387            AssertMsgFailed(("Type not implemented (type=%RU32, vrc=%Rrc)\n", guestErrorInfo.getType(), guestErrorInfo.getVrc()));
     1388            strErr = Utf8StrFmt("Unknown / Not implemented -- Please file a bug report (type=%RU32, vrc=%Rrc)\n",
     1389                                guestErrorInfo.getType(), guestErrorInfo.getVrc());
    13971390            break;
    13981391    }
     
    15521545      mCID(0),
    15531546      mEventSem(NIL_RTSEMEVENT),
    1554       mRc(VINF_SUCCESS),
     1547      mVrc(VINF_SUCCESS),
    15551548      mGuestRc(VINF_SUCCESS)
    15561549{
     
    15831576 *
    15841577 * @returns VBox status code.
    1585  * @param   rc                  Return code (rc) to set as wait result.
    1586  * @param   rcGuest             Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR.
    1587  * @param   pPayload            Additional wait event payload data set set on return. Optional.
    1588  */
    1589 int GuestWaitEventBase::SignalInternal(int rc, int rcGuest,
    1590                                       const GuestWaitEventPayload *pPayload)
     1578 * @param   vrc         Return VBox status code to set as wait result.
     1579 * @param   vrcGuest    Guest return VBox status code to set additionally, if
     1580 *                      @a vrc is set to VERR_GSTCTL_GUEST_ERROR.
     1581 * @param   pPayload    Additional wait event payload data set set on return. Optional.
     1582 */
     1583int GuestWaitEventBase::SignalInternal(int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload)
    15911584{
    15921585    if (mfAborted)
     
    15941587
    15951588#ifdef VBOX_STRICT
    1596     if (rc == VERR_GSTCTL_GUEST_ERROR)
    1597         AssertMsg(RT_FAILURE(rcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", rcGuest));
     1589    if (vrc == VERR_GSTCTL_GUEST_ERROR)
     1590        AssertMsg(RT_FAILURE(vrcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", vrcGuest));
    15981591    else
    1599         AssertMsg(RT_SUCCESS(rcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", rcGuest));
     1592        AssertMsg(RT_SUCCESS(vrcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", vrcGuest));
    16001593#endif
    16011594
    1602     int rc2;
     1595    int vrc2;
    16031596    if (pPayload)
    1604         rc2 = mPayload.CopyFromDeep(*pPayload);
     1597        vrc2 = mPayload.CopyFromDeep(*pPayload);
    16051598    else
    1606         rc2 = VINF_SUCCESS;
    1607     if (RT_SUCCESS(rc2))
    1608     {
    1609         mRc = rc;
    1610         mGuestRc = rcGuest;
    1611 
    1612         rc2 = RTSemEventSignal(mEventSem);
    1613     }
    1614 
    1615     return rc2;
     1599        vrc2 = VINF_SUCCESS;
     1600    if (RT_SUCCESS(vrc2))
     1601    {
     1602        mVrc = vrc;
     1603        mGuestRc = vrcGuest;
     1604
     1605        vrc2 = RTSemEventSignal(mEventSem);
     1606    }
     1607
     1608    return vrc2;
    16161609}
    16171610
     
    16291622int GuestWaitEventBase::Wait(RTMSINTERVAL msTimeout)
    16301623{
    1631     int rc = VINF_SUCCESS;
    1632 
    1633     if (mfAborted)
    1634         rc = VERR_CANCELLED;
    1635 
    1636     if (RT_SUCCESS(rc))
     1624    int vrc;
     1625    if (!mfAborted)
    16371626    {
    16381627        AssertReturn(mEventSem != NIL_RTSEMEVENT, VERR_CANCELLED);
    16391628
    1640         rc = RTSemEventWait(mEventSem, msTimeout ? msTimeout : RT_INDEFINITE_WAIT);
    1641         if (   RT_SUCCESS(rc)
     1629        vrc = RTSemEventWait(mEventSem, msTimeout ? msTimeout : RT_INDEFINITE_WAIT);
     1630        if (   RT_SUCCESS(vrc)
    16421631            && mfAborted)
    1643         {
    1644             rc = VERR_CANCELLED;
    1645         }
    1646 
    1647         if (RT_SUCCESS(rc))
     1632            vrc = VERR_CANCELLED;
     1633
     1634        if (RT_SUCCESS(vrc))
    16481635        {
    16491636            /* If waiting succeeded, return the overall
    16501637             * result code. */
    1651             rc = mRc;
    1652         }
    1653     }
    1654 
    1655     return rc;
     1638            vrc = mVrc;
     1639        }
     1640    }
     1641    else
     1642        vrc = VERR_CANCELLED;
     1643    return vrc;
    16561644}
    16571645
     
    17011689int GuestWaitEvent::Init(uint32_t uCID, const GuestEventTypes &lstEvents)
    17021690{
    1703     int rc = GuestWaitEventBase::Init(uCID);
    1704     if (RT_SUCCESS(rc))
    1705     {
     1691    int vrc = GuestWaitEventBase::Init(uCID);
     1692    if (RT_SUCCESS(vrc))
    17061693        mEventTypes = lstEvents;
    1707     }
    1708 
    1709     return rc;
     1694
     1695    return vrc;
    17101696}
    17111697
  • trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp

    r98262 r98272  
    113113         * it later in subsequent read() calls.
    114114         */
    115         vrc = mData.mProcessTool.init(mSession, procInfo, false /* Async */, NULL /* Guest rc */);
     115        vrc = mData.mProcessTool.init(mSession, procInfo, false /*fAsync*/, NULL /*pvrcGuest*/);
    116116        if (RT_SUCCESS(vrc))
    117117        {
     
    244244 *
    245245 * @returns Error string.
    246  * @param   rcGuest             Guest file error to return string for.
     246 * @param   vrcGuest            Guest file error to return string for.
    247247 * @param   pcszWhat            Hint of what was involved when the error occurred.
    248248 */
    249249/* static */
    250 Utf8Str GuestDirectory::i_guestErrorToString(int rcGuest, const char *pcszWhat)
     250Utf8Str GuestDirectory::i_guestErrorToString(int vrcGuest, const char *pcszWhat)
    251251{
    252252    AssertPtrReturn(pcszWhat, "");
    253253
    254254    Utf8Str strErr;
    255     switch (rcGuest)
     255    switch (vrcGuest)
    256256    {
    257257#define CASE_MSG(a_iRc, ...) \
     
    260260        CASE_MSG(VERR_DIR_NOT_EMPTY, tr("Guest directory \"%s\" is not empty"), pcszWhat);
    261261        default:
    262             strErr.printf(tr("Error %Rrc for guest directory \"%s\" occurred\n"), rcGuest, pcszWhat);
     262            strErr.printf(tr("Error %Rrc for guest directory \"%s\" occurred\n"), vrcGuest, pcszWhat);
    263263            break;
    264264    }
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r98262 r98272  
    223223    AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
    224224
    225     HRESULT hr;
     225    HRESULT hrc;
    226226
    227227    int vrc = bindToSession(aConsole, aSession, aObjectID);
    228228    if (RT_SUCCESS(vrc))
    229229    {
    230         hr = unconst(mEventSource).createObject();
    231         if (FAILED(hr))
     230        hrc = unconst(mEventSource).createObject();
     231        if (FAILED(hrc))
    232232            vrc = VERR_NO_MEMORY;
    233233        else
    234234        {
    235             hr = mEventSource->init();
    236             if (FAILED(hr))
     235            hrc = mEventSource->init();
     236            if (FAILED(hrc))
    237237                vrc = VERR_COM_UNEXPECTED;
    238238        }
     
    245245            GuestProcessListener *pListener = new GuestProcessListener();
    246246            ComObjPtr<GuestProcessListenerImpl> thisListener;
    247             hr = thisListener.createObject();
    248             if (SUCCEEDED(hr))
    249                 hr = thisListener->init(pListener, this);
    250 
    251             if (SUCCEEDED(hr))
     247            hrc = thisListener.createObject();
     248            if (SUCCEEDED(hrc))
     249                hrc = thisListener->init(pListener, this);
     250
     251            if (SUCCEEDED(hrc))
    252252            {
    253253                com::SafeArray <VBoxEventType_T> eventTypes;
     
    255255                eventTypes.push_back(VBoxEventType_OnGuestProcessInputNotify);
    256256                eventTypes.push_back(VBoxEventType_OnGuestProcessOutput);
    257                 hr = mEventSource->RegisterListener(thisListener,
     257                hrc = mEventSource->RegisterListener(thisListener,
    258258                                                    ComSafeArrayAsInParam(eventTypes),
    259259                                                    TRUE /* Active listener */);
    260                 if (SUCCEEDED(hr))
     260                if (SUCCEEDED(hrc))
    261261                {
    262262                    vrc = baseInit();
     
    541541 *
    542542 * @returns Error as a string.
    543  * @param   rcGuest             Guest process error to return string for.
    544  * @param   pcszWhat            Hint of what was involved when the error occurred.
     543 * @param   vrcGuest    Guest process error to return string for.
     544 * @param   pcszWhat    Hint of what was involved when the error occurred.
    545545 */
    546546/* static */
    547 Utf8Str GuestProcess::i_guestErrorToString(int rcGuest, const char *pcszWhat)
     547Utf8Str GuestProcess::i_guestErrorToString(int vrcGuest, const char *pcszWhat)
    548548{
    549549    AssertPtrReturn(pcszWhat, "");
    550550
    551551    Utf8Str strErr;
    552     switch (rcGuest)
     552    switch (vrcGuest)
    553553    {
    554554#define CASE_MSG(a_iRc, ...) \
     
    567567        CASE_MSG(VERR_NOT_FOUND,                      tr("The guest execution service is not ready (yet)"));
    568568        default:
    569             strErr.printf(tr("Error %Rrc for guest process \"%s\" occurred\n"), rcGuest, pcszWhat);
     569            strErr.printf(tr("Error %Rrc for guest process \"%s\" occurred\n"), vrcGuest, pcszWhat);
    570570            break;
    571571#undef CASE_MSG
     
    622622 * @return  bool                @c true if the passed in error code indicates an error which came
    623623 *                              from the guest side, or @c false if not.
    624  * @param   rc                  Error code to check.
     624 * @param   vrc                 Error code to check.
    625625 */
    626626/* static */
    627 bool GuestProcess::i_isGuestError(int rc)
    628 {
    629     return (   rc == VERR_GSTCTL_GUEST_ERROR
    630             || rc == VERR_GSTCTL_PROCESS_EXIT_CODE);
     627bool GuestProcess::i_isGuestError(int vrc)
     628{
     629    return vrc == VERR_GSTCTL_GUEST_ERROR
     630        || vrc == VERR_GSTCTL_PROCESS_EXIT_CODE;
    631631}
    632632
     
    638638inline bool GuestProcess::i_isAlive(void)
    639639{
    640     return (   mData.mStatus == ProcessStatus_Started
    641             || mData.mStatus == ProcessStatus_Paused
    642             || mData.mStatus == ProcessStatus_Terminating);
     640    return mData.mStatus == ProcessStatus_Started
     641        || mData.mStatus == ProcessStatus_Paused
     642        || mData.mStatus == ProcessStatus_Terminating;
    643643}
    644644
     
    650650inline bool GuestProcess::i_hasEnded(void)
    651651{
    652     return (   mData.mStatus == ProcessStatus_TerminatedNormally
    653             || mData.mStatus == ProcessStatus_TerminatedSignal
    654             || mData.mStatus == ProcessStatus_TerminatedAbnormally
    655             || mData.mStatus == ProcessStatus_TimedOutKilled
    656             || mData.mStatus == ProcessStatus_TimedOutAbnormally
    657             || mData.mStatus == ProcessStatus_Down
    658             || mData.mStatus == ProcessStatus_Error);
     652    return mData.mStatus == ProcessStatus_TerminatedNormally
     653        || mData.mStatus == ProcessStatus_TerminatedSignal
     654        || mData.mStatus == ProcessStatus_TerminatedAbnormally
     655        || mData.mStatus == ProcessStatus_TimedOutKilled
     656        || mData.mStatus == ProcessStatus_TimedOutAbnormally
     657        || mData.mStatus == ProcessStatus_Down
     658        || mData.mStatus == ProcessStatus_Error;
    659659}
    660660
     
    802802    {
    803803        ProcessStatus_T procStatus = ProcessStatus_Undefined;
    804         int procRc = VINF_SUCCESS;
     804        int vrcProc = VINF_SUCCESS;
    805805
    806806        switch (dataCb.uStatus)
     
    859859            case PROC_STS_ERROR:
    860860            {
    861                 procRc = dataCb.uFlags; /* mFlags contains the IPRT error sent from the guest. */
     861                vrcProc = dataCb.uFlags; /* mFlags contains the IPRT error sent from the guest. */
    862862                procStatus = ProcessStatus_Error;
    863863                break;
     
    873873        }
    874874
    875         LogFlowThisFunc(("Got rc=%Rrc, procSts=%RU32, procRc=%Rrc\n",
    876                          vrc, procStatus, procRc));
     875        LogFlowThisFunc(("Got vrc=%Rrc, procSts=%RU32, vrcProc=%Rrc\n", vrc, procStatus, vrcProc));
    877876
    878877        /* Set the process status. */
    879         int vrc2 = i_setProcessStatus(procStatus, procRc);
     878        int vrc2 = i_setProcessStatus(procStatus, vrcProc);
    880879        if (RT_SUCCESS(vrc))
    881880            vrc = vrc2;
     
    972971        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    973972
    974         vrc = i_setProcessStatus(ProcessStatus_Down, 0 /* rc, ignored */);
     973        vrc = i_setProcessStatus(ProcessStatus_Down, VINF_SUCCESS /* vrcProc, ignored */);
    975974    }
    976975
     
    991990 * @param   pcbRead             Where to return to size (in bytes) read on success.
    992991 *                              Optional.
    993  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    994  *                              was returned. Optional.
     992 * @param   pvrcGuest           Where to return the guest error when
     993 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    995994 *
    996995 * @note    Takes the write lock.
    997996 */
    998997int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS,
    999                              void *pvData, size_t cbData, uint32_t *pcbRead, int *prcGuest)
    1000 {
    1001     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, prcGuest=%p\n",
    1002                      mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, prcGuest));
     998                             void *pvData, size_t cbData, uint32_t *pcbRead, int *pvrcGuest)
     999{
     1000    LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, pvrcGuest=%p\n",
     1001                     mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, pvrcGuest));
    10031002    AssertReturn(uSize, VERR_INVALID_PARAMETER);
    10041003    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     
    10201019        if (pcbRead)
    10211020            *pcbRead = 0;
    1022         if (prcGuest)
    1023             *prcGuest = VINF_SUCCESS;
     1021        if (pvrcGuest)
     1022            *pvrcGuest = VINF_SUCCESS;
    10241023        return VINF_SUCCESS; /* Nothing to read anymore. */
    10251024    }
     
    10811080 * @returns VBox status code.
    10821081 * @param   procStatus          Guest process status to set.
    1083  * @param   procRc              Guest process result code to set.
     1082 * @param   vrcProc             Guest process result code to set.
    10841083 *
    10851084 * @note    Takes the write lock.
    10861085 */
    1087 int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int procRc)
     1086int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int vrcProc)
    10881087{
    10891088    LogFlowThisFuncEnter();
     
    10911090    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    10921091
    1093     LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, procRc=%Rrc\n",
    1094                      mData.mStatus, procStatus, procRc));
     1092    LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, vrcProc=%Rrc\n", mData.mStatus, procStatus, vrcProc));
    10951093
    10961094    if (procStatus == ProcessStatus_Error)
    10971095    {
    1098         AssertMsg(RT_FAILURE(procRc), ("Guest rc must be an error (%Rrc)\n", procRc));
     1096        AssertMsg(RT_FAILURE(vrcProc), ("Guest vrcProc must be an error (%Rrc)\n", vrcProc));
    10991097        /* Do not allow overwriting an already set error. If this happens
    11001098         * this means we forgot some error checking/locking somewhere. */
    1101         AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest rc already set (to %Rrc)\n", mData.mLastError));
     1099        AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest vrcProc already set (to %Rrc)\n", mData.mLastError));
    11021100    }
    11031101    else
    1104         AssertMsg(RT_SUCCESS(procRc), ("Guest rc must not be an error (%Rrc)\n", procRc));
     1102        AssertMsg(RT_SUCCESS(vrcProc), ("Guest vrcProc must not be an error (%Rrc)\n", vrcProc));
    11051103
    11061104    int vrc = VINF_SUCCESS;
     
    11091107    {
    11101108        mData.mStatus    = procStatus;
    1111         mData.mLastError = procRc;
     1109        mData.mLastError = vrcProc;
    11121110
    11131111        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
     
    11531151 * @returns VBox status code.
    11541152 * @param   cMsTimeout          Timeout (in ms) to wait for starting the process.
    1155  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1156  *                              was returned. Optional.
     1153 * @param   pvrcGuest           Where to return the guest error when
     1154 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    11571155 *
    11581156 * @note    Takes the write lock.
    11591157 */
    1160 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *prcGuest)
     1158int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *pvrcGuest)
    11611159{
    11621160    LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n",
     
    11861184        return vrc;
    11871185
    1188     vrc = i_startProcessInner(cMsTimeout, alock, pEvent, prcGuest);
     1186    vrc = i_startProcessInner(cMsTimeout, alock, pEvent, pvrcGuest);
    11891187
    11901188    unregisterWaitEvent(pEvent);
     
    12011199 * @param   rLock               Write lock to use for serialization.
    12021200 * @param   pEvent              Event to use for notifying waiters.
    1203  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1204  *                              was returned. Optional.
    1205  */
    1206 int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *prcGuest)
     1201 * @param   pvrcGuest           Where to return the guest error when
     1202 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     1203 */
     1204int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pvrcGuest)
    12071205{
    12081206    GuestSession *pSession = mSession;
     
    13181316
    13191317    if (RT_SUCCESS(vrc))
    1320         vrc = i_waitForStatusChange(pEvent, cMsTimeout,
    1321                                     NULL /* Process status */, prcGuest);
     1318        vrc = i_waitForStatusChange(pEvent, cMsTimeout, NULL /* Process status */, pvrcGuest);
    13221319    return vrc;
    13231320}
     
    13731370        return VERR_COM_UNEXPECTED;
    13741371
    1375     int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, NULL /* Guest rc, ignored */);
     1372    int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, NULL /* pvrcGuest, ignored */);
    13761373    /* Nothing to do here anymore. */
    13771374
     
    13871384 * @retval  VERR_NOT_SUPPORTED if process termination is not supported on the guest.
    13881385 * @param   uTimeoutMS          Timeout (in ms) to wait for process termination.
    1389  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1390  *                              was returned. Optional.
     1386 * @param   pvrcGuest           Where to return the guest error when
     1387 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    13911388 *
    13921389 * @note    Takes the write lock.
    13931390 */
    1394 int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *prcGuest)
    1395 {
    1396     /* prcGuest is optional. */
     1391int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *pvrcGuest)
     1392{
    13971393    LogFlowThisFunc(("uTimeoutMS=%RU32\n", uTimeoutMS));
    13981394
     
    14431439            if (RT_SUCCESS(vrc))
    14441440                vrc = i_waitForStatusChange(pEvent, uTimeoutMS,
    1445                                             NULL /* ProcessStatus */, prcGuest);
     1441                                            NULL /* ProcessStatus */, pvrcGuest);
    14461442            unregisterWaitEvent(pEvent);
    14471443        }
     
    15911587 * @param   uTimeoutMS          Timeout (in ms) to wait.
    15921588 * @param   waitResult          Where to return the process wait result on success.
    1593  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1594  *                              was returned. Optional.
     1589 * @param   pvrcGuest           Where to return the guest error when
     1590 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    15951591 * @note    Takes the read lock.
    15961592 */
    1597 int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
    1598                             ProcessWaitResult_T &waitResult, int *prcGuest)
     1593int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pvrcGuest)
    15991594{
    16001595    AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER);
     
    16021597    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    16031598
    1604     LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, prcGuest=%p\n",
    1605                      fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, prcGuest));
     1599    LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, vrcProc=%Rrc, pvrcGuest=%p\n",
     1600                     fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, pvrcGuest));
    16061601
    16071602    /* Did some error occur before? Then skip waiting and return. */
     
    16111606        waitResult = ProcessWaitResult_Error;
    16121607        AssertMsg(RT_FAILURE(mData.mLastError),
    1613                              ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError));
    1614         if (prcGuest)
    1615             *prcGuest = mData.mLastError; /* Return last set error. */
    1616         LogFlowThisFunc(("Process is in error state (rcGuest=%Rrc)\n", mData.mLastError));
     1608                             ("No error vrc (%Rrc) set when guest process indicated an error\n", mData.mLastError));
     1609        if (pvrcGuest)
     1610            *pvrcGuest = mData.mLastError; /* Return last set error. */
     1611        LogFlowThisFunc(("Process is in error state (vrcGuest=%Rrc)\n", mData.mLastError));
    16171612        return VERR_GSTCTL_GUEST_ERROR;
    16181613    }
     
    16231618    if (waitResult != ProcessWaitResult_None)
    16241619    {
    1625         if (prcGuest)
    1626             *prcGuest = mData.mLastError; /* Return last set error (if any). */
    1627         LogFlowThisFunc(("Nothing to wait for (rcGuest=%Rrc)\n", mData.mLastError));
     1620        if (pvrcGuest)
     1621            *pvrcGuest = mData.mLastError; /* Return last set error (if any). */
     1622        LogFlowThisFunc(("Nothing to wait for (vrcGuest=%Rrc)\n", mData.mLastError));
    16281623        return RT_SUCCESS(mData.mLastError) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR;
    16291624    }
     
    16691664
    16701665        vrc = i_waitForStatusChange(pEvent,
    1671                                     uTimeoutMS == RT_INDEFINITE_WAIT
    1672                                     ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS,
    1673                                     &newStatus, prcGuest);
     1666                                    uTimeoutMS == RT_INDEFINITE_WAIT ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS,
     1667                                    &newStatus, pvrcGuest);
    16741668        if (RT_SUCCESS(vrc))
    16751669        {
     
    16931687    unregisterWaitEvent(pEvent);
    16941688
    1695     LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, rc=%Rrc\n",
    1696                      waitResult, newStatus, vrc));
     1689    LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, vrc=%Rrc\n", waitResult, newStatus, vrc));
    16971690    return vrc;
    16981691}
     
    17261719            if (pInputStatus)
    17271720            {
    1728                 HRESULT hr2 = pProcessEvent->COMGETTER(Status)(pInputStatus);
    1729                 ComAssertComRC(hr2);
     1721                HRESULT hrc2 = pProcessEvent->COMGETTER(Status)(pInputStatus);
     1722                ComAssertComRC(hrc2);
    17301723            }
    17311724            if (pcbProcessed)
    17321725            {
    1733                 HRESULT hr2 = pProcessEvent->COMGETTER(Processed)((ULONG*)pcbProcessed);
    1734                 ComAssertComRC(hr2);
     1726                HRESULT hrc2 = pProcessEvent->COMGETTER(Processed)((ULONG*)pcbProcessed);
     1727                ComAssertComRC(hrc2);
    17351728            }
    17361729        }
     
    17391732    }
    17401733
    1741     LogFlowThisFunc(("Returning pEvent=%p, uHandle=%RU32, rc=%Rrc\n",
    1742                      pEvent, uHandle, vrc));
     1734    LogFlowThisFunc(("Returning pEvent=%p, uHandle=%RU32, vrc=%Rrc\n", pEvent, uHandle, vrc));
    17431735    return vrc;
    17441736}
     
    17821774
    17831775                ULONG uHandleEvent;
    1784                 HRESULT hr = pProcessEvent->COMGETTER(Handle)(&uHandleEvent);
    1785                 if (   SUCCEEDED(hr)
     1776                HRESULT hrc = pProcessEvent->COMGETTER(Handle)(&uHandleEvent);
     1777                if (   SUCCEEDED(hrc)
    17861778                    && uHandleEvent == uHandle)
    17871779                {
     
    17891781                    {
    17901782                        com::SafeArray <BYTE> data;
    1791                         hr = pProcessEvent->COMGETTER(Data)(ComSafeArrayAsOutParam(data));
    1792                         ComAssertComRC(hr);
     1783                        hrc = pProcessEvent->COMGETTER(Data)(ComSafeArrayAsOutParam(data));
     1784                        ComAssertComRC(hrc);
    17931785                        size_t cbRead = data.size();
    17941786                        if (cbRead)
     
    18021794                                vrc = VERR_BUFFER_OVERFLOW;
    18031795
    1804                             LogFlowThisFunc(("Read %zu bytes (uHandle=%RU32), rc=%Rrc\n",
    1805                                              cbRead, uHandleEvent, vrc));
     1796                            LogFlowThisFunc(("Read %zu bytes (uHandle=%RU32), vrc=%Rrc\n", cbRead, uHandleEvent, vrc));
    18061797                        }
    18071798                    }
     
    18111802                    {
    18121803                        ULONG cbRead;
    1813                         hr = pProcessEvent->COMGETTER(Processed)(&cbRead);
    1814                         ComAssertComRC(hr);
     1804                        hrc = pProcessEvent->COMGETTER(Processed)(&cbRead);
     1805                        ComAssertComRC(hrc);
    18151806                        *pcbRead = (uint32_t)cbRead;
    18161807                    }
     
    18181809                    break;
    18191810                }
    1820                 else if (FAILED(hr))
     1811                else if (FAILED(hrc))
    18211812                    vrc = VERR_COM_UNEXPECTED;
    18221813            }
     
    18451836 * @param   uTimeoutMS          Timeout (in ms) to wait.
    18461837 * @param   pProcessStatus      Where to return the process status on success.
    1847  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1848  *                              was returned.
     1838 * @param   pvrcGuest           Where to return the guest error when
     1839 *                              VERR_GSTCTL_GUEST_ERROR was returned.
    18491840 */
    18501841int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
    1851                                         ProcessStatus_T *pProcessStatus, int *prcGuest)
     1842                                        ProcessStatus_T *pProcessStatus, int *pvrcGuest)
    18521843{
    18531844    AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
    18541845    /* pProcessStatus is optional. */
    1855     /* prcGuest is optional. */
     1846    /* pvrcGuest is optional. */
    18561847
    18571848    VBoxEventType_T evtType;
     
    18661857
    18671858        ProcessStatus_T procStatus;
    1868         HRESULT hr = pProcessEvent->COMGETTER(Status)(&procStatus);
    1869         ComAssertComRC(hr);
     1859        HRESULT hrc = pProcessEvent->COMGETTER(Status)(&procStatus);
     1860        ComAssertComRC(hrc);
    18701861        if (pProcessStatus)
    18711862            *pProcessStatus = procStatus;
    18721863
    18731864        ComPtr<IVirtualBoxErrorInfo> errorInfo;
    1874         hr = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam());
    1875         ComAssertComRC(hr);
     1865        hrc = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam());
     1866        ComAssertComRC(hrc);
    18761867
    18771868        LONG lGuestRc;
    1878         hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);
    1879         ComAssertComRC(hr);
    1880 
    1881         LogFlowThisFunc(("Got procStatus=%RU32, rcGuest=%RI32 (%Rrc)\n",
    1882                          procStatus, lGuestRc, lGuestRc));
     1869        hrc = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);
     1870        ComAssertComRC(hrc);
     1871
     1872        LogFlowThisFunc(("Got procStatus=%RU32, vrcGuest=%RI32 (%Rrc)\n", procStatus, lGuestRc, lGuestRc));
    18831873
    18841874        if (RT_FAILURE((int)lGuestRc))
    18851875            vrc = VERR_GSTCTL_GUEST_ERROR;
    18861876
    1887         if (prcGuest)
    1888             *prcGuest = (int)lGuestRc;
    1889     }
    1890     /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make prcGuest is set. */
    1891     else if (vrc == VERR_GSTCTL_GUEST_ERROR && prcGuest)
    1892         *prcGuest = pEvent->GuestResult();
    1893     Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !prcGuest || *prcGuest != (int)0xcccccccc);
     1877        if (pvrcGuest)
     1878            *pvrcGuest = (int)lGuestRc;
     1879    }
     1880    /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make pvrcGuest is set. */
     1881    else if (vrc == VERR_GSTCTL_GUEST_ERROR && pvrcGuest)
     1882        *pvrcGuest = pEvent->GuestResult();
     1883    Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !pvrcGuest || *pvrcGuest != (int)0xcccccccc);
    18941884
    18951885    LogFlowFuncLeaveRC(vrc);
     
    19411931 * @param   uTimeoutMS          Timeout (in ms) to wait.
    19421932 * @param   puWritten           Where to return the size (in bytes) written. Optional.
    1943  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1944  *                              was returned. Optional.
     1933 * @param   pvrcGuest           Where to return the guest error when
     1934 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    19451935 *
    19461936 * @note    Takes the write lock.
    19471937 */
    19481938int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags,
    1949                               void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *prcGuest)
    1950 {
    1951     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, prcGuest=%p\n",
    1952                      mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, prcGuest));
     1939                              void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pvrcGuest)
     1940{
     1941    LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, pvrcGuest=%p\n",
     1942                     mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, pvrcGuest));
    19531943    /* All is optional. There can be 0 byte writes. */
    19541944    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    19581948        if (puWritten)
    19591949            *puWritten = 0;
    1960         if (prcGuest)
    1961             *prcGuest = VINF_SUCCESS;
     1950        if (pvrcGuest)
     1951            *pvrcGuest = VINF_SUCCESS;
    19621952        return VINF_SUCCESS; /* Not available for writing (anymore). */
    19631953    }
     
    20091999        if (RT_SUCCESS(vrc))
    20102000        {
    2011             /** @todo Set rcGuest. */
     2001            /** @todo Set vrcGuest. */
    20122002
    20132003            if (puWritten)
     
    20192009    unregisterWaitEvent(pEvent);
    20202010
    2021     LogFlowThisFunc(("Returning cbProcessed=%RU32, rc=%Rrc\n",
    2022                      cbProcessed, vrc));
     2011    LogFlowThisFunc(("Returning cbProcessed=%RU32, vrc=%Rrc\n", cbProcessed, vrc));
    20232012    return vrc;
    20242013}
     
    20702059    }
    20712060
    2072     LogFlowThisFunc(("rc=%Rrc, cbRead=%RU32\n", vrc, cbRead));
    2073 
     2061    LogFlowThisFunc(("vrc=%Rrc, cbRead=%RU32\n", vrc, cbRead));
    20742062    LogFlowFuncLeaveRC(vrc);
    20752063    return hrc;
     
    22432231    }
    22442232
    2245     LogFlowThisFunc(("rc=%Rrc, aWritten=%RU32\n", vrc, cbWritten));
     2233    LogFlowThisFunc(("vrc=%Rrc, aWritten=%RU32\n", vrc, cbWritten));
    22462234
    22472235    *aWritten = (ULONG)cbWritten;
     
    22832271 * @param   startupInfo         Guest process startup info to use for starting.
    22842272 * @param   fAsync              Whether to start asynchronously or not.
    2285  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    2286  *                              was returned. Optional.
     2273 * @param   pvrcGuest           Where to return the guest error when
     2274 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    22872275 */
    22882276int GuestProcessTool::init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo,
    2289                            bool fAsync, int *prcGuest)
     2277                           bool fAsync, int *pvrcGuest)
    22902278{
    22912279    LogFlowThisFunc(("pGuestSession=%p, exe=%s, fAsync=%RTbool\n",
     
    23172305        }
    23182306
    2319         if (prcGuest)
    2320             *prcGuest = vrcGuest;
     2307        if (pvrcGuest)
     2308            *pvrcGuest = vrcGuest;
    23212309    }
    23222310
     
    23732361    } while (RT_SUCCESS(vrc));
    23742362
    2375     LogFlowThisFunc(("rc=%Rrc, %RU64 pairs\n",
    2376                       vrc, strmBlock.GetCount()));
     2363    LogFlowThisFunc(("vrc=%Rrc, %RU64 pairs\n", vrc, strmBlock.GetCount()));
    23772364    return vrc;
    23782365}
     
    23862373{
    23872374    LONG exitCode = -1;
    2388     HRESULT hr = pProcess->COMGETTER(ExitCode(&exitCode));
    2389     AssertComRC(hr);
     2375    HRESULT hrc = pProcess->COMGETTER(ExitCode(&exitCode));
     2376    AssertComRC(hrc);
    23902377
    23912378    return GuestProcessTool::exitCodeToRc(mStartupInfo, exitCode);
     
    24022389
    24032390    ProcessStatus_T procStatus = ProcessStatus_Undefined;
    2404     HRESULT hr = pProcess->COMGETTER(Status(&procStatus));
    2405     AssertComRC(hr);
     2391    HRESULT hrc = pProcess->COMGETTER(Status(&procStatus));
     2392    AssertComRC(hrc);
    24062393
    24072394    if (   procStatus == ProcessStatus_Started
     
    24522439    {
    24532440        /* Make sure to check the error information we got from the guest tool. */
    2454         if (GuestProcess::i_isGuestError(errorInfo.rcGuest))
    2455         {
    2456             if (errorInfo.rcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */
     2441        if (GuestProcess::i_isGuestError(errorInfo.vrcGuest))
     2442        {
     2443            if (errorInfo.vrcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */
    24572444                vrcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);
    24582445            else /* At least return something. */
    2459                 vrcGuest = errorInfo.rcGuest;
     2446                vrcGuest = errorInfo.vrcGuest;
    24602447
    24612448            if (pvrcGuest)
     
    24662453    }
    24672454
    2468     LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode));
     2455    LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode));
    24692456    return vrc;
    24702457}
     
    24802467 */
    24812468/* static */
    2482 int GuestProcessTool::runErrorInfo(      GuestSession              *pGuestSession,
    2483                                    const GuestProcessStartupInfo   &startupInfo,
    2484                                          GuestProcessToolErrorInfo &errorInfo)
    2485 {
    2486     return runExErrorInfo(pGuestSession, startupInfo,
    2487                           NULL /* paStrmOutObjects */, 0 /* cStrmOutObjects */, errorInfo);
     2469int GuestProcessTool::runErrorInfo(GuestSession                    *pGuestSession,
     2470                                   GuestProcessStartupInfo const   &startupInfo,
     2471                                   GuestProcessToolErrorInfo       &errorInfo)
     2472{
     2473    return runExErrorInfo(pGuestSession, startupInfo, NULL /* paStrmOutObjects */, 0 /* cStrmOutObjects */, errorInfo);
    24882474}
    24892475
     
    25002486 */
    25012487/* static */
    2502 int GuestProcessTool::runEx(      GuestSession              *pGuestSession,
    2503                             const GuestProcessStartupInfo   &startupInfo,
    2504                                   GuestCtrlStreamObjects    *paStrmOutObjects,
    2505                                   uint32_t                   cStrmOutObjects,
    2506                                   int                       *pvrcGuest /* = NULL */)
     2488int GuestProcessTool::runEx(GuestSession                   *pGuestSession,
     2489                            GuestProcessStartupInfo const  &startupInfo,
     2490                            GuestCtrlStreamObjects         *paStrmOutObjects,
     2491                            uint32_t                        cStrmOutObjects,
     2492                            int                            *pvrcGuest /* = NULL */)
    25072493{
    25082494    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     
    25132499    {
    25142500        /* Make sure to check the error information we got from the guest tool. */
    2515         if (GuestProcess::i_isGuestError(errorInfo.rcGuest))
    2516         {
    2517             if (errorInfo.rcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */
     2501        if (GuestProcess::i_isGuestError(errorInfo.vrcGuest))
     2502        {
     2503            if (errorInfo.vrcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */
    25182504                vrcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);
    25192505            else /* At least return something. */
    2520                 vrcGuest = errorInfo.rcGuest;
     2506                vrcGuest = errorInfo.vrcGuest;
    25212507
    25222508            if (pvrcGuest)
     
    25272513    }
    25282514
    2529     LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode));
     2515    LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode));
    25302516    return vrc;
    25312517}
     
    25472533 */
    25482534/* static */
    2549 int GuestProcessTool::runExErrorInfo(      GuestSession              *pGuestSession,
    2550                                      const GuestProcessStartupInfo  &startupInfo,
    2551                                            GuestCtrlStreamObjects    *paStrmOutObjects,
    2552                                            uint32_t                   cStrmOutObjects,
    2553                                            GuestProcessToolErrorInfo &errorInfo)
     2535int GuestProcessTool::runExErrorInfo(GuestSession                  *pGuestSession,
     2536                                     GuestProcessStartupInfo const &startupInfo,
     2537                                     GuestCtrlStreamObjects        *paStrmOutObjects,
     2538                                     uint32_t                       cStrmOutObjects,
     2539                                     GuestProcessToolErrorInfo    &errorInfo)
    25542540{
    25552541    AssertPtrReturn(pGuestSession, VERR_INVALID_POINTER);
     
    25592545
    25602546    GuestProcessTool procTool;
    2561     int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.rcGuest);
     2547    int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.vrcGuest);
    25622548    if (RT_SUCCESS(vrc))
    25632549    {
     
    25692555                vrc = procTool.waitEx(  paStrmOutObjects
    25702556                                        ? GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK
    2571                                         : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.rcGuest);
     2557                                        : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.vrcGuest);
    25722558                if (paStrmOutObjects)
    25732559                    paStrmOutObjects->push_back(strmBlk);
     
    25862572    {
    25872573        /* Make sure the process runs until completion. */
    2588         vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.rcGuest);
     2574        vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.vrcGuest);
    25892575        if (RT_SUCCESS(vrc))
    2590             errorInfo.rcGuest = procTool.getTerminationStatus(&errorInfo.iExitCode);
    2591     }
    2592 
    2593     LogFlowFunc(("Returned rc=%Rrc, rcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode));
     2576            errorInfo.vrcGuest = procTool.getTerminationStatus(&errorInfo.iExitCode);
     2577    }
     2578
     2579    LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode));
    25942580    return vrc;
    25952581}
     
    26132599    {
    26142600        LONG iExitCode = -1;
    2615         HRESULT hr = pProcess->COMGETTER(ExitCode(&iExitCode));
    2616         AssertComRC(hr);
     2601        HRESULT hrc = pProcess->COMGETTER(ExitCode(&iExitCode));
     2602        AssertComRC(hrc);
    26172603
    26182604        if (piExitCode)
     
    26332619 * @returns VBox status code.
    26342620 * @param   fToolWaitFlags      Guest process tool wait flags to use for waiting.
    2635  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    2636  *                              was returned. Optional.
    2637  */
    2638 int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *prcGuest)
    2639 {
    2640     return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, prcGuest);
     2621 * @param   pvrcGuest           Where to return the guest error when
     2622 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     2623 */
     2624int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *pvrcGuest)
     2625{
     2626    return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, pvrcGuest);
    26412627}
    26422628
     
    26472633 * @param   fToolWaitFlags      Guest process tool wait flags to use for waiting.
    26482634 * @param   pStrmBlkOut         Where to store the guest process output.
    2649  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    2650  *                              was returned. Optional.
    2651  */
    2652 int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *prcGuest)
    2653 {
    2654     LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, prcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, prcGuest));
     2635 * @param   pvrcGuest           Where to return the guest error when
     2636 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     2637 */
     2638int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pvrcGuest)
     2639{
     2640    LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, pvrcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, pvrcGuest));
    26552641
    26562642    /* Can we parse the next block without waiting? */
     
    27362722                /* Since waiting for stdout / stderr is not supported by the guest,
    27372723                 * wait a bit to not hog the CPU too much when polling for data. */
    2738                 RTThreadSleep(1); /* Optional, don't check rc. */
     2724                RTThreadSleep(1); /* Optional, don't check vrc. */
    27392725                break;
    27402726
     
    28282814        vrc = VERR_GSTCTL_GUEST_ERROR;
    28292815
    2830     LogFlowThisFunc(("Loop ended with rc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n",
    2831                      vrc, vrcGuest, waitRes));
    2832     if (prcGuest)
    2833         *prcGuest = vrcGuest;
     2816    LogFlowThisFunc(("Loop ended with vrc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n", vrc, vrcGuest, waitRes));
     2817    if (pvrcGuest)
     2818        *pvrcGuest = vrcGuest;
    28342819
    28352820    LogFlowFuncLeaveRC(vrc);
     
    28422827 * @returns VBox status code.
    28432828 * @param   uTimeoutMS          Timeout (in ms) to wait.
    2844  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    2845  *                              was returned. Optional.
    2846  */
    2847 int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *prcGuest)
     2829 * @param   pvrcGuest           Where to return the guest error when
     2830 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     2831 */
     2832int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *pvrcGuest)
    28482833{
    28492834    LogFlowThisFuncEnter();
     
    28512836    int vrc;
    28522837    if (!pProcess.isNull())
    2853         vrc = pProcess->i_terminateProcess(uTimeoutMS, prcGuest);
     2838        vrc = pProcess->i_terminateProcess(uTimeoutMS, pvrcGuest);
    28542839    else
    28552840        vrc = VERR_NOT_FOUND;
     
    29732958
    29742959    /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
    2975     switch (guestErrorInfo.getRc())
     2960    switch (guestErrorInfo.getVrc())
    29762961    {
    29772962        case VERR_ACCESS_DENIED:
     
    30233008        default:
    30243009            strErr.printf(tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"),
    3025                           guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str(), pszTool);
     3010                          guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str(), pszTool);
    30263011            break;
    30273012    }
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r98262 r98272  
    108108    void handler()
    109109    {
    110         /* Ignore rc */ GuestSession::i_startSessionThreadTask(this);
     110        /* Ignore return code */
     111        GuestSession::i_startSessionThreadTask(this);
    111112    }
    112113};
     
    147148            {
    148149                AssertPtrReturn(mSession, E_POINTER);
    149                 int rc2 = mSession->signalWaitEvent(aType, aEvent);
    150                 RT_NOREF(rc2);
     150                int vrc2 = mSession->signalWaitEvent(aType, aEvent);
     151                RT_NOREF(vrc2);
    151152#ifdef DEBUG_andy
    152                 LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in rc=%Rrc\n",
    153                              aType, mSession, rc2));
     153                LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in vrc2=%Rrc\n", aType, mSession, vrc2));
    154154#endif
    155155                break;
     
    245245     * objects (like files, directories, ...) which are bound to this session.
    246246     */
    247     int rc = i_objectRegister(NULL /* pObject */, SESSIONOBJECTTYPE_SESSION, &mData.mObjectID);
    248     if (RT_SUCCESS(rc))
    249     {
    250         rc = mData.mEnvironmentChanges.initChangeRecord(pGuest->i_isGuestInWindowsNtFamily()
    251                                                         ? RTENV_CREATE_F_ALLOW_EQUAL_FIRST_IN_VAR : 0);
    252         if (RT_SUCCESS(rc))
    253         {
    254             rc = RTCritSectInit(&mWaitEventCritSect);
    255             AssertRC(rc);
    256         }
    257     }
    258 
    259     if (RT_SUCCESS(rc))
    260         rc = i_determineProtocolVersion();
    261 
    262     if (RT_SUCCESS(rc))
     247    int vrc = i_objectRegister(NULL /* pObject */, SESSIONOBJECTTYPE_SESSION, &mData.mObjectID);
     248    if (RT_SUCCESS(vrc))
     249    {
     250        vrc = mData.mEnvironmentChanges.initChangeRecord(pGuest->i_isGuestInWindowsNtFamily()
     251                                                         ? RTENV_CREATE_F_ALLOW_EQUAL_FIRST_IN_VAR : 0);
     252        if (RT_SUCCESS(vrc))
     253        {
     254            vrc = RTCritSectInit(&mWaitEventCritSect);
     255            AssertRC(vrc);
     256        }
     257    }
     258
     259    if (RT_SUCCESS(vrc))
     260        vrc = i_determineProtocolVersion();
     261
     262    if (RT_SUCCESS(vrc))
    263263    {
    264264        /*
    265265         * <Replace this if you figure out what the code is doing.>
    266266         */
    267         HRESULT hr = unconst(mEventSource).createObject();
    268         if (SUCCEEDED(hr))
    269             hr = mEventSource->init();
    270         if (SUCCEEDED(hr))
     267        HRESULT hrc = unconst(mEventSource).createObject();
     268        if (SUCCEEDED(hrc))
     269            hrc = mEventSource->init();
     270        if (SUCCEEDED(hrc))
    271271        {
    272272            try
     
    274274                GuestSessionListener *pListener = new GuestSessionListener();
    275275                ComObjPtr<GuestSessionListenerImpl> thisListener;
    276                 hr = thisListener.createObject();
    277                 if (SUCCEEDED(hr))
    278                     hr = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */
    279                 if (SUCCEEDED(hr))
     276                hrc = thisListener.createObject();
     277                if (SUCCEEDED(hrc))
     278                    hrc = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */
     279                if (SUCCEEDED(hrc))
    280280                {
    281281                    com::SafeArray <VBoxEventType_T> eventTypes;
    282282                    eventTypes.push_back(VBoxEventType_OnGuestSessionStateChanged);
    283                     hr = mEventSource->RegisterListener(thisListener,
    284                                                         ComSafeArrayAsInParam(eventTypes),
    285                                                         TRUE /* Active listener */);
    286                     if (SUCCEEDED(hr))
     283                    hrc = mEventSource->RegisterListener(thisListener,
     284                                                         ComSafeArrayAsInParam(eventTypes),
     285                                                         TRUE /* Active listener */);
     286                    if (SUCCEEDED(hrc))
    287287                    {
    288288                        mLocalListener = thisListener;
     
    292292                         */
    293293                        autoInitSpan.setSucceeded();
    294                         LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool rc=VINF_SUCCESS\n",
     294                        LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool vrc=VINF_SUCCESS\n",
    295295                                         mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal));
    296296                        return VINF_SUCCESS;
     
    300300            catch (std::bad_alloc &)
    301301            {
    302                 hr = E_OUTOFMEMORY;
     302                hrc = E_OUTOFMEMORY;
    303303            }
    304304        }
    305         rc = Global::vboxStatusCodeFromCOM(hr);
     305        vrc = Global::vboxStatusCodeFromCOM(hrc);
    306306    }
    307307
    308308    autoInitSpan.setFailed();
    309     LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => rc=%Rrc\n",
    310                  mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, rc));
    311     return rc;
     309    LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => vrc=%Rrc\n",
     310                 mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, vrc));
     311    return vrc;
    312312}
    313313
     
    546546HRESULT GuestSession::getUserHome(com::Utf8Str &aUserHome)
    547547{
    548     HRESULT hr = i_isStartedExternal();
    549     if (FAILED(hr))
    550         return hr;
    551 
    552     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    553     int vrc = i_pathUserHome(aUserHome, &rcGuest);
     548    HRESULT hrc = i_isStartedExternal();
     549    if (FAILED(hrc))
     550        return hrc;
     551
     552    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     553    int vrc = i_pathUserHome(aUserHome, &vrcGuest);
    554554    if (RT_FAILURE(vrc))
    555555    {
     
    558558            case VERR_GSTCTL_GUEST_ERROR:
    559559            {
    560                 switch (rcGuest)
     560                switch (vrcGuest)
    561561                {
    562562                    case VERR_NOT_SUPPORTED:
    563                         hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest,
     563                        hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest,
    564564                                          tr("Getting the user's home path is not supported by installed Guest Additions"));
    565565                        break;
    566566
    567567                    default:
    568                         hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest,
    569                                           tr("Getting the user's home path failed on the guest: %Rrc"), rcGuest);
     568                        hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest,
     569                                          tr("Getting the user's home path failed on the guest: %Rrc"), vrcGuest);
    570570                        break;
    571571                }
     
    574574
    575575            default:
    576                 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc);
     576                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc);
    577577                break;
    578578        }
    579579    }
    580580
    581     return hr;
     581    return hrc;
    582582}
    583583
    584584HRESULT GuestSession::getUserDocuments(com::Utf8Str &aUserDocuments)
    585585{
    586     HRESULT hr = i_isStartedExternal();
    587     if (FAILED(hr))
    588         return hr;
    589 
    590     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    591     int vrc = i_pathUserDocuments(aUserDocuments, &rcGuest);
     586    HRESULT hrc = i_isStartedExternal();
     587    if (FAILED(hrc))
     588        return hrc;
     589
     590    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     591    int vrc = i_pathUserDocuments(aUserDocuments, &vrcGuest);
    592592    if (RT_FAILURE(vrc))
    593593    {
     
    596596            case VERR_GSTCTL_GUEST_ERROR:
    597597            {
    598                 switch (rcGuest)
     598                switch (vrcGuest)
    599599                {
    600600                    case VERR_NOT_SUPPORTED:
    601                         hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest,
     601                        hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest,
    602602                                          tr("Getting the user's documents path is not supported by installed Guest Additions"));
    603603                        break;
    604604
    605605                    default:
    606                         hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest,
    607                                           tr("Getting the user's documents path failed on the guest: %Rrc"), rcGuest);
     606                        hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest,
     607                                          tr("Getting the user's documents path failed on the guest: %Rrc"), vrcGuest);
    608608                        break;
    609609                }
     
    612612
    613613            default:
    614                 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc);
     614                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc);
    615615                break;
    616616        }
    617617    }
    618618
    619     return hr;
     619    return hrc;
    620620}
    621621
     
    673673 * @param   uFlags              Guest session close flags.
    674674 * @param   uTimeoutMS          Timeout (in ms) to wait.
    675  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    676  *                              was returned. Optional.
     675 * @param   pvrcGuest           Where to return the guest error when
     676 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    677677 *
    678678 * @note    Takes the read lock.
    679679 */
    680 int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *prcGuest)
    681 {
    682     AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
     680int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest)
     681{
     682    AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER);
    683683
    684684    LogFlowThisFunc(("uFlags=%x, uTimeoutMS=%RU32\n", uFlags, uTimeoutMS));
     
    734734    if (RT_SUCCESS(vrc))
    735735        vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS,
    736                                     NULL /* Session status */, prcGuest);
     736                                    NULL /* Session status */, pvrcGuest);
    737737
    738738    unregisterWaitEvent(pEvent);
     
    941941 * @param   uMode               Creation mode to use (octal, 0777 max).
    942942 * @param   uFlags              Directory creation flags to use.
    943  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    944  *                              was returned. Optional.
    945  */
    946 int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode,
    947                                     uint32_t uFlags, int *prcGuest)
    948 {
    949     AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
     943 * @param   pvrcGuest           Where to return the guest error when
     944 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     945 */
     946int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest)
     947{
     948    AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER);
    950949
    951950    LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n", strPath.c_str(), uMode, uFlags));
     
    993992
    994993    if (RT_SUCCESS(vrc))
    995         vrc = GuestProcessTool::run(this, procInfo, prcGuest);
     994        vrc = GuestProcessTool::run(this, procInfo, pvrcGuest);
    996995
    997996    LogFlowFuncLeaveRC(vrc);
     
    10081007{
    10091008    GuestFsObjData objDataIgnored;
    1010     int rcGuestIgnored;
    1011     int rc = i_directoryQueryInfo(strPath, true /* fFollowSymlinks */, objDataIgnored, &rcGuestIgnored);
    1012 
    1013     return RT_SUCCESS(rc);
     1009    int vrcGuestIgnored;
     1010    int const vrc = i_directoryQueryInfo(strPath, true /* fFollowSymlinks */, objDataIgnored, &vrcGuestIgnored);
     1011    return RT_SUCCESS(vrc);
    10141012}
    10151013
     
    10401038 * @param   fFollowSymlinks     Whether to follow symlinks or not.
    10411039 * @param   objData             Where to store the information returned on success.
    1042  * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
    1043  */
    1044 int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks,
    1045                                        GuestFsObjData &objData, int *prcGuest)
    1046 {
    1047     AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
     1040 * @param   pvrcGuest           Guest VBox status code, when returning
     1041 *                              VERR_GSTCTL_GUEST_ERROR.
     1042 */
     1043int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest)
     1044{
     1045    AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER);
    10481046
    10491047    LogFlowThisFunc(("strPath=%s, fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks));
    10501048
    1051     int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, prcGuest);
     1049    int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest);
    10521050    if (RT_SUCCESS(vrc))
    10531051    {
     
    10801078    LogFlowFunc(("Removing directory (objectID=%RU32) ...\n", idObject));
    10811079
    1082     int rc = i_objectUnregister(idObject);
    1083     if (RT_FAILURE(rc))
    1084         return rc;
     1080    int vrc = i_objectUnregister(idObject);
     1081    if (RT_FAILURE(vrc))
     1082        return vrc;
    10851083
    10861084    SessionDirectories::iterator itDirs = mData.mDirectories.find(idObject);
     
    10931091                 idObject, mData.mSession.mID, mData.mDirectories.size()));
    10941092
    1095     rc = pDirConsumed->i_onUnregister();
    1096     AssertRCReturn(rc, rc);
     1093    vrc = pDirConsumed->i_onUnregister();
     1094    AssertRCReturn(vrc, vrc);
    10971095
    10981096    mData.mDirectories.erase(itDirs);
     
    11041102    pDirConsumed.setNull();
    11051103
    1106     LogFlowFuncLeaveRC(rc);
    1107     return rc;
     1104    LogFlowFuncLeaveRC(vrc);
     1105    return vrc;
    11081106}
    11091107
     
    11141112 * @param   strPath             Path of directory on guest to remove.
    11151113 * @param   fFlags              Directory remove flags to use.
    1116  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1117  *                              was returned. Optional.
     1114 * @param   pvrcGuest           Where to return the guest error when
     1115 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    11181116 *
    11191117 * @note    Takes the read lock.
    11201118 */
    1121 int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *prcGuest)
     1119int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest)
    11221120{
    11231121    AssertReturn(!(fFlags & ~DIRREMOVEREC_FLAG_VALID_MASK), VERR_INVALID_PARAMETER);
    1124     AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
     1122    AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER);
    11251123
    11261124    LogFlowThisFunc(("strPath=%s, uFlags=0x%x\n", strPath.c_str(), fFlags));
     
    11481146        vrc = pEvent->Wait(30 * 1000);
    11491147        if (   vrc == VERR_GSTCTL_GUEST_ERROR
    1150             && prcGuest)
    1151             *prcGuest = pEvent->GuestResult();
     1148            && pvrcGuest)
     1149            *pvrcGuest = pEvent->GuestResult();
    11521150    }
    11531151
     
    11711169 *                              Ignored when \a fSecure is specified.
    11721170 * @param   fSecure             Whether to perform a secure creation or not.
    1173  * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
     1171 * @param   pvrcGuest           Guest VBox status code, when returning
     1172 *                              VERR_GSTCTL_GUEST_ERROR.
    11741173 */
    11751174int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName,
    1176                                  uint32_t fMode, bool fSecure, int *prcGuest)
    1177 {
    1178     AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
     1175                                 uint32_t fMode, bool fSecure, int *pvrcGuest)
     1176{
     1177    AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER);
    11791178    AssertReturn(fSecure || !(fMode & ~07777), VERR_INVALID_PARAMETER);
    11801179
     
    12341233            {
    12351234                vrcGuest = vrc;
    1236                 if (prcGuest)
    1237                     *prcGuest = vrcGuest;
     1235                if (pvrcGuest)
     1236                    *pvrcGuest = vrcGuest;
    12381237                vrc = VERR_GSTCTL_GUEST_ERROR;
    12391238            }
     
    12451244            strName = objData.mName;
    12461245    }
    1247     else if (prcGuest)
    1248         *prcGuest = vrcGuest;
     1246    else if (pvrcGuest)
     1247        *pvrcGuest = vrcGuest;
    12491248
    12501249    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
     
    12591258 * @param   openInfo            Open information to use.
    12601259 * @param   pDirectory          Where to return the guest directory object on success.
    1261  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1262  *                              was returned. Optional.
     1260 * @param   pvrcGuest           Where to return the guest error when
     1261 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    12631262 *
    12641263 * @note    Takes the write lock.
    12651264 */
    1266 int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo,
    1267                                   ComObjPtr<GuestDirectory> &pDirectory, int *prcGuest)
    1268 {
    1269     AssertPtrReturn(prcGuest, VERR_INVALID_POINTER);
    1270 
    1271     LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n",
    1272                      openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags));
     1265int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest)
     1266{
     1267    AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER);
     1268
     1269    LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n", openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags));
    12731270
    12741271    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    12751272
    12761273    /* Create the directory object. */
    1277     HRESULT hr = pDirectory.createObject();
    1278     if (FAILED(hr))
    1279         return Global::vboxStatusCodeFromCOM(hr);
     1274    HRESULT hrc = pDirectory.createObject();
     1275    if (FAILED(hrc))
     1276        return Global::vboxStatusCodeFromCOM(hrc);
    12801277
    12811278    /* Register a new object ID. */
     
    13331330    {
    13341331        /* Nothing further to do here yet. */
    1335         if (prcGuest)
    1336             *prcGuest = VINF_SUCCESS;
     1332        if (pvrcGuest)
     1333            *pvrcGuest = VINF_SUCCESS;
    13371334    }
    13381335
     
    13621359     * Find the object.
    13631360     */
    1364     int rc = VERR_NOT_FOUND;
     1361    int vrc = VERR_NOT_FOUND;
    13651362    const uint32_t idObject = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCtxCb->uContextID);
    13661363    SessionObjects::const_iterator itObj = mData.mObjects.find(idObject);
     
    13781375                alock.release();
    13791376
    1380                 rc = i_dispatchToThis(pCtxCb, pSvcCb);
     1377                vrc = i_dispatchToThis(pCtxCb, pSvcCb);
    13811378                break;
    13821379            }
     
    13881385                alock.release();
    13891386
    1390                 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);
     1387                vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);
    13911388                break;
    13921389            }
     
    13981395                alock.release();
    13991396
    1400                 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);
     1397                vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);
    14011398                break;
    14021399            }
     
    14081405                alock.release();
    14091406
    1410                 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);
     1407                vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);
    14111408                break;
    14121409            }
    14131410            default:
    14141411                AssertMsgFailed(("%d\n", itObj->second.enmType));
    1415                 rc = VERR_INTERNAL_ERROR_4;
     1412                vrc = VERR_INTERNAL_ERROR_4;
    14161413                break;
    14171414        }
    14181415    }
    14191416
    1420     LogFlowFuncLeaveRC(rc);
    1421     return rc;
     1417    LogFlowFuncLeaveRC(vrc);
     1418    return vrc;
    14221419}
    14231420
     
    14381435    LogFlowThisFunc(("sessionID=%RU32, CID=%RU32, uMessage=%RU32, pSvcCb=%p\n",
    14391436                     mData.mSession.mID, pCbCtx->uContextID, pCbCtx->uMessage, pSvcCbData));
    1440     int rc;
     1437    int vrc;
    14411438    switch (pCbCtx->uMessage)
    14421439    {
    14431440        case GUEST_MSG_DISCONNECTED:
    14441441            /** @todo Handle closing all guest objects. */
    1445             rc = VERR_INTERNAL_ERROR;
     1442            vrc = VERR_INTERNAL_ERROR;
    14461443            break;
    14471444
    14481445        case GUEST_MSG_SESSION_NOTIFY: /* Guest Additions >= 4.3.0. */
    1449         {
    1450             rc = i_onSessionStatusChange(pCbCtx, pSvcCbData);
     1446            vrc = i_onSessionStatusChange(pCbCtx, pSvcCbData);
    14511447            break;
    1452         }
    14531448
    14541449        default:
    1455             rc = dispatchGeneric(pCbCtx, pSvcCbData);
     1450            vrc = dispatchGeneric(pCbCtx, pSvcCbData);
    14561451            break;
    14571452    }
    14581453
    1459     LogFlowFuncLeaveRC(rc);
    1460     return rc;
     1454    LogFlowFuncLeaveRC(vrc);
     1455    return vrc;
    14611456}
    14621457
     
    15521547    LogFlowFunc(("Removing file (objectID=%RU32) ...\n", idObject));
    15531548
    1554     int rc = i_objectUnregister(idObject);
    1555     if (RT_FAILURE(rc))
    1556         return rc;
     1549    int vrc = i_objectUnregister(idObject);
     1550    if (RT_FAILURE(vrc))
     1551        return vrc;
    15571552
    15581553    SessionFiles::iterator itFiles = mData.mFiles.find(idObject);
     
    15651560                 pFileConsumed->getObjectID(), mData.mSession.mID, mData.mFiles.size()));
    15661561
    1567     rc = pFileConsumed->i_onUnregister();
    1568     AssertRCReturn(rc, rc);
     1562    vrc = pFileConsumed->i_onUnregister();
     1563    AssertRCReturn(vrc, vrc);
    15691564
    15701565    mData.mFiles.erase(itFiles);
     
    15761571    pFileConsumed.setNull();
    15771572
    1578     LogFlowFuncLeaveRC(rc);
    1579     return rc;
     1573    LogFlowFuncLeaveRC(vrc);
     1574    return vrc;
    15801575}
    15811576
     
    15861581 * @returns VERR_GSTCTL_GUEST_ERROR on received guest error.
    15871582 * @param   strPath             Path of file on guest to remove.
    1588  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1589  *                              was returned. Optional.
    1590  */
    1591 int GuestSession::i_fileRemove(const Utf8Str &strPath, int *prcGuest)
     1583 * @param   pvrcGuest           Where to return the guest error when
     1584 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     1585 */
     1586int GuestSession::i_fileRemove(const Utf8Str &strPath, int *pvrcGuest)
    15921587{
    15931588    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
     
    16231618            {
    16241619                vrcGuest = vrc;
    1625                 if (prcGuest)
    1626                     *prcGuest = vrcGuest;
     1620                if (pvrcGuest)
     1621                    *pvrcGuest = vrcGuest;
    16271622                vrc = VERR_GSTCTL_GUEST_ERROR;
    16281623            }
     
    16311626            vrc = VERR_BROKEN_PIPE;
    16321627    }
    1633     else if (prcGuest)
    1634         *prcGuest = vrcGuest;
     1628    else if (pvrcGuest)
     1629        *pvrcGuest = vrcGuest;
    16351630
    16361631    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
     
    16501645 * @param   aFlags              Open flags to use.
    16511646 * @param   pFile               Where to return the file object on success.
    1652  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1653  *                              was returned. Optional.
     1647 * @param   pvrcGuest           Where to return the guest error when
     1648 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    16541649 *
    16551650 * @note    Takes the write lock.
     
    16571652int GuestSession::i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
    16581653                               FileSharingMode_T aSharingMode, ULONG aCreationMode, const std::vector<FileOpenExFlag_T> &aFlags,
    1659                                ComObjPtr<GuestFile> &pFile, int *prcGuest)
     1654                               ComObjPtr<GuestFile> &pFile, int *pvrcGuest)
    16601655{
    16611656    GuestFileOpenInfo openInfo;
     
    16711666    /* Validation is done in i_fileOpen(). */
    16721667
    1673     return i_fileOpen(openInfo, pFile, prcGuest);
     1668    return i_fileOpen(openInfo, pFile, pvrcGuest);
    16741669}
    16751670
     
    16811676 * @param   openInfo            Open information to use for opening the file.
    16821677 * @param   pFile               Where to return the file object on success.
    1683  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1684  *                              was returned. Optional.
     1678 * @param   pvrcGuest           Where to return the guest error when
     1679 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    16851680 *
    16861681 * @note    Takes the write lock.
    16871682 */
    1688 int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *prcGuest)
     1683int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest)
    16891684{
    16901685    LogFlowThisFunc(("strFile=%s, enmAccessMode=0x%x, enmOpenAction=0x%x, uCreationMode=%RU32, mfOpenEx=%RU32\n",
     
    16971692    if (mData.mProtocolVersion < 2)
    16981693    {
    1699         if (prcGuest)
    1700             *prcGuest = VERR_NOT_SUPPORTED;
     1694        if (pvrcGuest)
     1695            *pvrcGuest = VERR_NOT_SUPPORTED;
    17011696        return VERR_GSTCTL_GUEST_ERROR;
    17021697    }
     
    17061701
    17071702    /* Create the directory object. */
    1708     HRESULT hr = pFile.createObject();
    1709     if (FAILED(hr))
     1703    HRESULT hrc = pFile.createObject();
     1704    if (FAILED(hrc))
    17101705        return VERR_COM_UNEXPECTED;
    17111706
    17121707    /* Register a new object ID. */
    17131708    uint32_t idObject;
    1714     int rc = i_objectRegister(pFile, SESSIONOBJECTTYPE_FILE, &idObject);
    1715     if (RT_FAILURE(rc))
     1709    int vrc = i_objectRegister(pFile, SESSIONOBJECTTYPE_FILE, &idObject);
     1710    if (RT_FAILURE(vrc))
    17161711    {
    17171712        pFile.setNull();
    1718         return rc;
     1713        return vrc;
    17191714    }
    17201715
     
    17221717    AssertPtr(pConsole);
    17231718
    1724     rc = pFile->init(pConsole, this /* GuestSession */, idObject, openInfo);
    1725     if (RT_FAILURE(rc))
    1726         return rc;
     1719    vrc = pFile->init(pConsole, this /* GuestSession */, idObject, openInfo);
     1720    if (RT_FAILURE(vrc))
     1721        return vrc;
    17271722
    17281723    /*
     
    17471742    catch (std::bad_alloc &)
    17481743    {
    1749         rc = VERR_NO_MEMORY;
    1750     }
    1751 
    1752     if (RT_SUCCESS(rc))
    1753     {
    1754         int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    1755         rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &rcGuest);
    1756         if (   rc == VERR_GSTCTL_GUEST_ERROR
    1757             && prcGuest)
    1758         {
    1759             *prcGuest = rcGuest;
    1760         }
    1761     }
    1762 
    1763     LogFlowFuncLeaveRC(rc);
    1764     return rc;
     1744        vrc = VERR_NO_MEMORY;
     1745    }
     1746
     1747    if (RT_SUCCESS(vrc))
     1748    {
     1749        int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     1750        vrc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &vrcGuest);
     1751        if (   vrc == VERR_GSTCTL_GUEST_ERROR
     1752            && pvrcGuest)
     1753            *pvrcGuest = vrcGuest;
     1754    }
     1755
     1756    LogFlowFuncLeaveRC(vrc);
     1757    return vrc;
    17651758}
    17661759
     
    17691762 *
    17701763 * @returns IPRT status code. VERR_NOT_A_FILE if the queried file system object on the guest is not a file,
    1771  *                            or VERR_GSTCTL_GUEST_ERROR if prcGuest contains more error information from the guest.
     1764 *                            or VERR_GSTCTL_GUEST_ERROR if pvrcGuest contains
     1765 *                            more error information from the guest.
    17721766 * @param   strPath           Absolute path of file to query information for.
    17731767 * @param   fFollowSymlinks   Whether or not to follow symbolic links on the guest.
    17741768 * @param   objData           Where to store the acquired information.
    1775  * @param   prcGuest          Where to store the guest rc. Optional.
    1776  */
    1777 int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest)
     1769 * @param   pvrcGuest         Where to store the guest VBox status code.
     1770 *                            Optional.
     1771 */
     1772int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest)
    17781773{
    17791774    LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks));
    17801775
    1781     int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, prcGuest);
     1776    int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest);
    17821777    if (RT_SUCCESS(vrc))
    1783     {
    1784         vrc = objData.mType == FsObjType_File
    1785             ? VINF_SUCCESS : VERR_NOT_A_FILE;
    1786     }
     1778        vrc = objData.mType == FsObjType_File ? VINF_SUCCESS : VERR_NOT_A_FILE;
    17871779
    17881780    LogFlowFuncLeaveRC(vrc);
     
    17991791 * @param   fFollowSymlinks     \c true when wanting to follow symbolic links, \c false if not.
    18001792 * @param   pllSize             Where to return the queried file size on success.
    1801  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    1802  *                              was returned. Optional.
    1803  */
    1804 int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *prcGuest)
     1793 * @param   pvrcGuest           Where to return the guest error when
     1794 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
     1795 */
     1796int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest)
    18051797{
    18061798    AssertPtrReturn(pllSize, VERR_INVALID_POINTER);
    18071799
    18081800    GuestFsObjData objData;
    1809     int vrc = i_fileQueryInfo(strPath, fFollowSymlinks, objData, prcGuest);
     1801    int vrc = i_fileQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest);
    18101802    if (RT_SUCCESS(vrc))
    18111803        *pllSize = objData.mObjectSize;
     
    18211813 * @param   fFollowSymlinks     Whether to follow symbolic links or not.
    18221814 * @param   objData             Where to return the file system object data, if found.
    1823  * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
    1824  *                              Any other return code indicates some host side error.
    1825  */
    1826 int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest)
     1815 * @param   pvrcGuest           Guest VBox status code, when returning
     1816 *                              VERR_GSTCTL_GUEST_ERROR. Any other return code
     1817 *                              indicates some host side error.
     1818 */
     1819int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest)
    18271820{
    18281821    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
     
    18601853            {
    18611854                vrcGuest = vrc;
    1862                 if (prcGuest)
    1863                     *prcGuest = vrcGuest;
     1855                if (pvrcGuest)
     1856                    *pvrcGuest = vrcGuest;
    18641857                vrc = VERR_GSTCTL_GUEST_ERROR;
    18651858            }
     
    18681861            vrc = VERR_BROKEN_PIPE;
    18691862    }
    1870     else if (prcGuest)
    1871         *prcGuest = vrcGuest;
     1863    else if (pvrcGuest)
     1864        *pvrcGuest = vrcGuest;
    18721865
    18731866    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
     
    19011894 */
    19021895/* static */
    1903 Utf8Str GuestSession::i_guestErrorToString(int rcGuest)
     1896Utf8Str GuestSession::i_guestErrorToString(int vrcGuest)
    19041897{
    19051898    Utf8Str strError;
    19061899
    19071900    /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
    1908     switch (rcGuest)
     1901    switch (vrcGuest)
    19091902    {
    19101903        case VERR_INVALID_VM_HANDLE:
     
    19411934
    19421935        default:
    1943             strError.printf("%Rrc", rcGuest);
     1936            strError.printf("%Rrc", vrcGuest);
    19441937            break;
    19451938    }
     
    20702063    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    20712064
    2072     LogFlowThisFunc(("ID=%RU32, uType=%RU32, rcGuest=%Rrc\n",
    2073                      mData.mSession.mID, dataCb.uType, dataCb.uResult));
     2065    LogFlowThisFunc(("ID=%RU32, uType=%RU32, vrcGuest=%Rrc\n", mData.mSession.mID, dataCb.uType, dataCb.uResult));
    20742066
    20752067    GuestSessionStatus_T sessionStatus = GuestSessionStatus_Undefined;
    20762068
    2077     int rcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */
     2069    int vrcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */
    20782070    switch (dataCb.uType)
    20792071    {
    20802072        case GUEST_SESSION_NOTIFYTYPE_ERROR:
    20812073            sessionStatus = GuestSessionStatus_Error;
    2082             LogRel(("Guest Control: Error starting Session '%s' (%Rrc) \n", mData.mSession.mName.c_str(), rcGuest));
     2074            LogRel(("Guest Control: Error starting Session '%s' (%Rrc) \n", mData.mSession.mName.c_str(), vrcGuest));
    20832075            break;
    20842076
     
    21512143    if (RT_SUCCESS(vrc))
    21522144    {
    2153         if (RT_FAILURE(rcGuest))
     2145        if (RT_FAILURE(vrcGuest))
    21542146            sessionStatus = GuestSessionStatus_Error;
    21552147    }
     
    21572149    /* Set the session status. */
    21582150    if (RT_SUCCESS(vrc))
    2159         vrc = i_setSessionStatus(sessionStatus, rcGuest);
    2160 
    2161     LogFlowThisFunc(("ID=%RU32, rcGuest=%Rrc\n", mData.mSession.mID, rcGuest));
     2151        vrc = i_setSessionStatus(sessionStatus, vrcGuest);
     2152
     2153    LogFlowThisFunc(("ID=%RU32, vrcGuest=%Rrc\n", mData.mSession.mID, vrcGuest));
    21622154
    21632155    LogFlowFuncLeaveRC(vrc);
     
    22132205 *
    22142206 * @returns VBox status code.
    2215  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    2216  *                              was returned. Optional.
     2207 * @param   pvrcGuest           Where to return the guest error when
     2208 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    22172209 *
    22182210 * @note    Takes the read and write locks.
    22192211 */
    2220 int GuestSession::i_startSession(int *prcGuest)
     2212int GuestSession::i_startSession(int *pvrcGuest)
    22212213{
    22222214    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    22322224        alock.release(); /* Release lock before changing status. */
    22332225
    2234         /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS);
     2226        i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS); /* ignore return code*/
    22352227        LogFlowThisFunc(("Installed Guest Additions don't support opening dedicated sessions, skipping\n"));
    22362228        return VINF_SUCCESS;
     
    22872279        vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start,
    22882280                                    30 * 1000 /* 30s timeout */,
    2289                                     NULL /* Session status */, prcGuest);
     2281                                    NULL /* Session status */, pvrcGuest);
    22902282    }
    22912283    else
     
    22972289         * same function again will work though.
    22982290         */
    2299         /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Error, vrc);
     2291        i_setSessionStatus(GuestSessionStatus_Error, vrc); /* ignore return code */
    23002292    }
    23012293
     
    23622354        return VERR_COM_INVALID_OBJECT_STATE;
    23632355
    2364     int vrc = pSession->i_startSession(NULL /* Guest rc, ignored */);
     2356    int vrc = pSession->i_startSession(NULL /*pvrcGuest*/);
    23652357    /* Nothing to do here anymore. */
    23662358
     
    24422434    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    24432435
    2444     int rc = VINF_SUCCESS;
    2445     AssertMsgStmt(ASMBitTestAndClear(&mData.bmObjectIds, idObject), ("idObject=%#x\n", idObject), rc = VERR_NOT_FOUND);
     2436    int vrc = VINF_SUCCESS;
     2437    AssertMsgStmt(ASMBitTestAndClear(&mData.bmObjectIds, idObject), ("idObject=%#x\n", idObject), vrc = VERR_NOT_FOUND);
    24462438
    24472439    SessionObjects::iterator ItObj = mData.mObjects.find(idObject);
     
    24492441    mData.mObjects.erase(ItObj);
    24502442
    2451     return rc;
     2443    return vrc;
    24522444}
    24532445
     
    25482540 * @param   strDest             Destination path on guest to rename \a strSource to.
    25492541 * @param   uFlags              Renaming flags.
    2550  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    2551  *                              was returned. Optional.
     2542 * @param   pvrcGuest           Where to return the guest error when
     2543 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    25522544 * @note    Takes the read lock.
    25532545 */
    2554 int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *prcGuest)
     2546int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest)
    25552547{
    25562548    AssertReturn(!(uFlags & ~PATHRENAME_FLAG_VALID_MASK), VERR_INVALID_PARAMETER);
     
    25832575        vrc = pEvent->Wait(30 * 1000);
    25842576        if (   vrc == VERR_GSTCTL_GUEST_ERROR
    2585             && prcGuest)
    2586             *prcGuest = pEvent->GuestResult();
     2577            && pvrcGuest)
     2578            *pvrcGuest = pEvent->GuestResult();
    25872579    }
    25882580
     
    25972589 *
    25982590 * @returns VBox status code.
    2599  * @param   strPath             Where to store the user's document path.
    2600  * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
    2601  *                              Any other return code indicates some host side error.
     2591 * @param   strPath     Where to store the user's document path.
     2592 * @param   pvrcGuest   Guest VBox status code, when returning
     2593 *                      VERR_GSTCTL_GUEST_ERROR. Any other return code indicates
     2594 *                      some host side error.
    26022595 *
    26032596 * @note    Takes the read lock.
    26042597 */
    2605 int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *prcGuest)
     2598int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest)
    26062599{
    26072600    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    26332626            if (vrc == VERR_GSTCTL_GUEST_ERROR)
    26342627            {
    2635                 if (prcGuest)
    2636                     *prcGuest = pEvent->GuestResult();
     2628                if (pvrcGuest)
     2629                    *pvrcGuest = pEvent->GuestResult();
    26372630            }
    26382631        }
     
    26492642 *
    26502643 * @returns VBox status code.
    2651  * @param   strPath             Where to store the user's home path.
    2652  * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
    2653  *                              Any other return code indicates some host side error.
     2644 * @param   strPath     Where to store the user's home path.
     2645 * @param   pvrcGuest   Guest VBox status code, when returning
     2646 *                      VERR_GSTCTL_GUEST_ERROR. Any other return code indicates
     2647 *                      some host side error.
    26542648 *
    26552649 * @note    Takes the read lock.
    26562650 */
    2657 int GuestSession::i_pathUserHome(Utf8Str &strPath, int *prcGuest)
     2651int GuestSession::i_pathUserHome(Utf8Str &strPath, int *pvrcGuest)
    26582652{
    26592653    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    26852679            if (vrc == VERR_GSTCTL_GUEST_ERROR)
    26862680            {
    2687                 if (prcGuest)
    2688                     *prcGuest = pEvent->GuestResult();
     2681                if (pvrcGuest)
     2682                    *pvrcGuest = pEvent->GuestResult();
    26892683            }
    26902684        }
     
    27172711    LogFlowFunc(("Removing process (objectID=%RU32) ...\n", idObject));
    27182712
    2719     int rc = i_objectUnregister(idObject);
    2720     if (RT_FAILURE(rc))
    2721         return rc;
     2713    int vrc = i_objectUnregister(idObject);
     2714    if (RT_FAILURE(vrc))
     2715        return vrc;
    27222716
    27232717    SessionProcesses::iterator itProcs = mData.mProcesses.find(idObject);
     
    27282722
    27292723    ULONG uPID;
    2730     HRESULT hr = pProc->COMGETTER(PID)(&uPID);
    2731     ComAssertComRC(hr);
     2724    HRESULT hrc = pProc->COMGETTER(PID)(&uPID);
     2725    ComAssertComRC(hrc);
    27322726
    27332727    LogFlowFunc(("Removing process ID=%RU32 (session %RU32, guest PID %RU32, now total %zu processes)\n",
    27342728                 idObject, mData.mSession.mID, uPID, mData.mProcesses.size()));
    27352729
    2736     rc = pProcess->i_onUnregister();
    2737     AssertRCReturn(rc, rc);
     2730    vrc = pProcess->i_onUnregister();
     2731    AssertRCReturn(vrc, vrc);
    27382732
    27392733    mData.mProcesses.erase(itProcs);
     
    27452739    pProc.setNull();
    27462740
    2747     LogFlowFuncLeaveRC(rc);
    2748     return rc;
     2741    LogFlowFuncLeaveRC(vrc);
     2742    return vrc;
    27492743}
    27502744
     
    28182812
    28192813    /* Create the process object. */
    2820     HRESULT hr = pProcess.createObject();
    2821     if (FAILED(hr))
     2814    HRESULT hrc = pProcess.createObject();
     2815    if (FAILED(hrc))
    28222816        return VERR_COM_UNEXPECTED;
    28232817
    28242818    /* Register a new object ID. */
    28252819    uint32_t idObject;
    2826     int rc = i_objectRegister(pProcess, SESSIONOBJECTTYPE_PROCESS, &idObject);
    2827     if (RT_FAILURE(rc))
     2820    int vrc = i_objectRegister(pProcess, SESSIONOBJECTTYPE_PROCESS, &idObject);
     2821    if (RT_FAILURE(vrc))
    28282822    {
    28292823        pProcess.setNull();
    2830         return rc;
    2831     }
    2832 
    2833     rc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */, idObject,
    2834                         procInfo, mData.mpBaseEnvironment);
    2835     if (RT_FAILURE(rc))
    2836         return rc;
     2824        return vrc;
     2825    }
     2826
     2827    vrc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */, idObject, procInfo, mData.mpBaseEnvironment);
     2828    if (RT_FAILURE(vrc))
     2829        return vrc;
    28372830
    28382831    /* Add the created process to our map. */
     
    28502843    catch (std::bad_alloc &)
    28512844    {
    2852         rc = VERR_NO_MEMORY;
    2853     }
    2854 
    2855     return rc;
     2845        vrc = VERR_NO_MEMORY;
     2846    }
     2847
     2848    return vrc;
    28562849}
    28572850
     
    29002893
    29012894        ULONG uCurPID;
    2902         HRESULT hr = pCurProc->COMGETTER(PID)(&uCurPID);
    2903         ComAssertComRC(hr);
     2895        HRESULT hrc = pCurProc->COMGETTER(PID)(&uCurPID);
     2896        ComAssertComRC(hrc);
    29042897
    29052898        if (uCurPID == uPID)
     
    29642957 * @returns VBox status code.
    29652958 * @param   sessionStatus       Session status to set.
    2966  * @param   sessionRc           Session result to set (for error handling).
     2959 * @param   vrcSession          Session result to set (for error handling).
    29672960 *
    29682961 * @note    Takes the write lock.
    29692962 */
    2970 int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc)
    2971 {
    2972     LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, sessionRc=%Rrc\n",
    2973                      mData.mStatus, sessionStatus, sessionRc));
     2963int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession)
     2964{
     2965    LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, vrcSession=%Rrc\n", mData.mStatus, sessionStatus, vrcSession));
    29742966
    29752967    if (sessionStatus == GuestSessionStatus_Error)
    29762968    {
    2977         AssertMsg(RT_FAILURE(sessionRc), ("Guest rc must be an error (%Rrc)\n", sessionRc));
     2969        AssertMsg(RT_FAILURE(vrcSession), ("Guest vrcSession must be an error (%Rrc)\n", vrcSession));
    29782970        /* Do not allow overwriting an already set error. If this happens
    29792971         * this means we forgot some error checking/locking somewhere. */
    2980         AssertMsg(RT_SUCCESS(mData.mVrc), ("Guest rc already set (to %Rrc)\n", mData.mVrc));
     2972        AssertMsg(RT_SUCCESS(mData.mVrc), ("Guest mVrc already set (to %Rrc)\n", mData.mVrc));
    29812973    }
    29822974    else
    2983         AssertMsg(RT_SUCCESS(sessionRc), ("Guest rc must not be an error (%Rrc)\n", sessionRc));
     2975        AssertMsg(RT_SUCCESS(vrcSession), ("Guest vrcSession must not be an error (%Rrc)\n", vrcSession));
    29842976
    29852977    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    29902982    {
    29912983        mData.mStatus = sessionStatus;
    2992         mData.mVrc    = sessionRc;
     2984        mData.mVrc    = vrcSession;
    29932985
    29942986        /* Make sure to notify all underlying objects first. */
     
    29962988
    29972989        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
    2998         HRESULT hr = errorInfo.createObject();
    2999         ComAssertComRC(hr);
    3000         int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, sessionRc,
    3001                                     COM_IIDOF(IGuestSession), getComponentName(),
    3002                                     i_guestErrorToString(sessionRc));
    3003         AssertRC(rc2);
     2990        HRESULT hrc = errorInfo.createObject();
     2991        ComAssertComRC(hrc);
     2992        int vrc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, vrcSession, COM_IIDOF(IGuestSession), getComponentName(),
     2993                                     i_guestErrorToString(vrcSession));
     2994        AssertRC(vrc2);
    30042995
    30052996        alock.release(); /* Release lock before firing off event. */
     
    30133004
    30143005/** @todo Unused --remove? */
    3015 int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */)
    3016 {
    3017     RT_NOREF(enmWaitResult, rc);
    3018 
    3019     /*LogFlowThisFunc(("enmWaitResult=%d, rc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n",
    3020                      enmWaitResult, rc, mData.mWaitCount, mData.mWaitEvent));*/
     3006int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */)
     3007{
     3008    RT_NOREF(enmWaitResult, vrc);
     3009
     3010    /*LogFlowThisFunc(("enmWaitResult=%d, vrc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n",
     3011                     enmWaitResult, vrc, mData.mWaitCount, mData.mWaitEvent));*/
    30213012
    30223013    /* Note: No write locking here -- already done in the caller. */
    30233014
    3024     int vrc = VINF_SUCCESS;
     3015    int vrc2 = VINF_SUCCESS;
    30253016    /*if (mData.mWaitEvent)
    3026         vrc = mData.mWaitEvent->Signal(enmWaitResult, rc);*/
    3027     LogFlowFuncLeaveRC(vrc);
    3028     return vrc;
     3017        vrc2 = mData.mWaitEvent->Signal(enmWaitResult, vrc);*/
     3018    LogFlowFuncLeaveRC(vrc2);
     3019    return vrc2;
    30293020}
    30303021
     
    30343025 *
    30353026 * @returns VBox status code. VERR_NOT_SUPPORTED if not supported by Guest Additions.
    3036  * @param   fFlags              Guest shutdown flags.
    3037  * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
    3038  *                              Any other return code indicates some host side error.
     3027 * @param   fFlags      Guest shutdown flags.
     3028 * @param   pvrcGuest   Guest VBox status code, when returning
     3029 *                      VERR_GSTCTL_GUEST_ERROR. Any other return code indicates
     3030 *                      some host side error.
    30393031 *
    30403032 * @note    Takes the read lock.
    30413033 */
    3042 int GuestSession::i_shutdown(uint32_t fFlags, int *prcGuest)
     3034int GuestSession::i_shutdown(uint32_t fFlags, int *pvrcGuest)
    30433035{
    30443036    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    30633055    alock.release(); /* Drop lock before sending. */
    30643056
    3065     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3057    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    30663058
    30673059    vrc = i_sendMessage(HOST_MSG_SHUTDOWN, i, paParms);
     
    30723064        {
    30733065            if (vrc == VERR_GSTCTL_GUEST_ERROR)
    3074                 rcGuest = pEvent->GuestResult();
     3066                vrcGuest = pEvent->GuestResult();
    30753067        }
    30763068    }
     
    30783070    if (RT_FAILURE(vrc))
    30793071    {
    3080         LogRel(("Guest Control: Shutting down guest failed, rc=%Rrc\n",
    3081                 vrc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : vrc));
    3082 
     3072        LogRel(("Guest Control: Shutting down guest failed, vrc=%Rrc\n", vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc));
    30833073        if (   vrc == VERR_GSTCTL_GUEST_ERROR
    3084             && prcGuest)
    3085             *prcGuest = rcGuest;
     3074            && pvrcGuest)
     3075            *pvrcGuest = vrcGuest;
    30863076    }
    30873077
     
    31423132 * @param   uTimeoutMS          Timeout (in ms) to wait.
    31433133 * @param   waitResult          Where to return the wait result on success.
    3144  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    3145  *                              was returned. Optional.
     3134 * @param   pvrcGuest           Where to return the guest error when
     3135 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    31463136 *
    31473137 * @note    Takes the read lock.
    31483138 */
    3149 int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *prcGuest)
     3139int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest)
    31503140{
    31513141    LogFlowThisFuncEnter();
     
    31533143    AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER);
    31543144
    3155     /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, prcGuest=%p\n",
    3156                      fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, prcGuest));*/
     3145    /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, pvrcGuest=%p\n",
     3146                     fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, pvrcGuest));*/
    31573147
    31583148    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    31623152    {
    31633153        waitResult = GuestSessionWaitResult_Error;
    3164         AssertMsg(RT_FAILURE(mData.mVrc), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mVrc));
    3165         if (prcGuest)
    3166             *prcGuest = mData.mVrc; /* Return last set error. */
     3154        AssertMsg(RT_FAILURE(mData.mVrc), ("No error mVrc (%Rrc) set when guest session indicated an error\n", mData.mVrc));
     3155        if (pvrcGuest)
     3156            *pvrcGuest = mData.mVrc; /* Return last set error. */
    31673157        return VERR_GSTCTL_GUEST_ERROR;
    31683158    }
     
    32413231    }
    32423232
    3243     LogFlowThisFunc(("sessionStatus=%RU32, sessionRc=%Rrc, waitResult=%RU32\n", mData.mStatus, mData.mVrc, waitResult));
     3233    LogFlowThisFunc(("sessionStatus=%RU32, vrcSession=%Rrc, waitResult=%RU32\n", mData.mStatus, mData.mVrc, waitResult));
    32443234
    32453235    /* No waiting needed? Return immediately using the last set error. */
    32463236    if (waitResult != GuestSessionWaitResult_None)
    32473237    {
    3248         if (prcGuest)
    3249             *prcGuest = mData.mVrc; /* Return last set error (if any). */
     3238        if (pvrcGuest)
     3239            *pvrcGuest = mData.mVrc; /* Return last set error (if any). */
    32503240        return RT_SUCCESS(mData.mVrc) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR;
    32513241    }
     
    32783268        GuestSessionStatus_T sessionStatus;
    32793269        vrc = i_waitForStatusChange(pEvent, fWaitFlags,
    3280                                     uTimeoutMS - (tsNow - tsStart), &sessionStatus, prcGuest);
     3270                                    uTimeoutMS - (tsNow - tsStart), &sessionStatus, pvrcGuest);
    32813271        if (RT_SUCCESS(vrc))
    32823272        {
     
    33513341 * @param   uTimeoutMS          Timeout (in ms) to wait.
    33523342 * @param   pSessionStatus      Where to return the guest session status.
    3353  * @param   prcGuest            Where to return the guest error when VERR_GSTCTL_GUEST_ERROR
    3354  *                              was returned. Optional.
     3343 * @param   pvrcGuest           Where to return the guest error when
     3344 *                              VERR_GSTCTL_GUEST_ERROR was returned. Optional.
    33553345 */
    33563346int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
    3357                                         GuestSessionStatus_T *pSessionStatus, int *prcGuest)
     3347                                        GuestSessionStatus_T *pSessionStatus, int *pvrcGuest)
    33583348{
    33593349    RT_NOREF(fWaitFlags);
     
    33763366
    33773367            ComPtr<IVirtualBoxErrorInfo> errorInfo;
    3378             HRESULT hr = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam());
    3379             ComAssertComRC(hr);
     3368            HRESULT hrc = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam());
     3369            ComAssertComRC(hrc);
    33803370
    33813371            LONG lGuestRc;
    3382             hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);
    3383             ComAssertComRC(hr);
     3372            hrc = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);
     3373            ComAssertComRC(hrc);
    33843374            if (RT_FAILURE((int)lGuestRc))
    33853375                vrc = VERR_GSTCTL_GUEST_ERROR;
    3386             if (prcGuest)
    3387                 *prcGuest = (int)lGuestRc;
     3376            if (pvrcGuest)
     3377                *pvrcGuest = (int)lGuestRc;
    33883378
    33893379            LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: %RU32 (%Rrc)\n",
     
    33943384            AssertMsgFailedReturn(("Got unexpected event type %#x\n", evtType), VERR_WRONG_ORDER);
    33953385    }
    3396     /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make prcGuest is set. */
    3397     else if (vrc == VERR_GSTCTL_GUEST_ERROR && prcGuest)
    3398         *prcGuest = pEvent->GuestResult();
    3399     Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !prcGuest || *prcGuest != (int)0xcccccccc);
     3386    /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make pvrcGuest is set. */
     3387    else if (vrc == VERR_GSTCTL_GUEST_ERROR && pvrcGuest)
     3388        *pvrcGuest = pEvent->GuestResult();
     3389    Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !pvrcGuest || *pvrcGuest != (int)0xcccccccc);
    34003390
    34013391    LogFlowFuncLeaveRC(vrc);
     
    34133403     *       the session (already) could be in a stopped / aborted state. */
    34143404
    3415     int vrc     = VINF_SUCCESS; /* Shut up MSVC. */
    3416     int rcGuest = VINF_SUCCESS;
     3405    int vrc      = VINF_SUCCESS; /* Shut up MSVC. */
     3406    int vrcGuest = VINF_SUCCESS;
    34173407
    34183408    uint32_t msTimeout = RT_MS_10SEC; /* 10s timeout by default */
     
    34273417
    34283418        /* Close session on guest. */
    3429         vrc = i_closeSession(0 /* Flags */, msTimeout, &rcGuest);
     3419        vrc = i_closeSession(0 /* Flags */, msTimeout, &vrcGuest);
    34303420        if (   RT_SUCCESS(vrc)
    34313421            || vrc != VERR_TIMEOUT) /* If something else happened there is no point in retrying further. */
     
    34453435        vrc = vrc2;
    34463436
    3447     LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", vrc, rcGuest));
     3437    LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
    34483438
    34493439    if (RT_FAILURE(vrc))
     
    34513441        if (vrc == VERR_GSTCTL_GUEST_ERROR)
    34523442        {
    3453             GuestErrorInfo ge(GuestErrorInfo::Type_Session, rcGuest, mData.mSession.mName.c_str());
    3454             return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Closing guest session failed: %s"),
     3443            GuestErrorInfo ge(GuestErrorInfo::Type_Session, vrcGuest, mData.mSession.mName.c_str());
     3444            return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Closing guest session failed: %s"),
    34553445                                GuestBase::getErrorAsString(ge).c_str());
    34563446        }
     
    35513541    {
    35523542        GuestFsObjData objData;
    3553         int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3554         int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, &rcGuest);
     3543        int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3544        int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, &vrcGuest);
    35553545        if (   RT_FAILURE(vrc)
    35563546            && !fContinueOnErrors)
     
    35583548            if (GuestProcess::i_isGuestError(vrc))
    35593549            {
    3560                 GuestErrorInfo ge(GuestErrorInfo::Type_Process, rcGuest, (*itSource).c_str());
    3561                 return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying type for guest source failed: %s"),
     3550                GuestErrorInfo ge(GuestErrorInfo::Type_Process, vrcGuest, (*itSource).c_str());
     3551                return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying type for guest source failed: %s"),
    35623552                                    GuestBase::getErrorAsString(ge).c_str());
    35633553            }
     
    37573747    LogFlowThisFuncEnter();
    37583748
    3759     ComObjPtr <GuestDirectory> pDirectory; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3760     int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &rcGuest);
     3749    ComObjPtr <GuestDirectory> pDirectory;
     3750    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3751    int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &vrcGuest);
    37613752    if (RT_FAILURE(vrc))
    37623753    {
    37633754        if (GuestProcess::i_isGuestError(vrc))
    37643755        {
    3765             GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());
    3766             return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Guest directory creation failed: %s"),
     3756            GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str());
     3757            return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Guest directory creation failed: %s"),
    37673758                                GuestBase::getErrorAsString(ge).c_str());
    37683759        }
     
    38033794    LogFlowThisFuncEnter();
    38043795
    3805     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3806     int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), &rcGuest);
     3796    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3797    int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), &vrcGuest);
    38073798    if (!RT_SUCCESS(vrc))
    38083799    {
     
    38113802            case VERR_GSTCTL_GUEST_ERROR:
    38123803            {
    3813                 GuestErrorInfo ge(GuestErrorInfo::Type_ToolMkTemp, rcGuest, aPath.c_str());
    3814                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Temporary guest directory creation failed: %s"),
     3804                GuestErrorInfo ge(GuestErrorInfo::Type_ToolMkTemp, vrcGuest, aPath.c_str());
     3805                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Temporary guest directory creation failed: %s"),
    38153806                                   GuestBase::getErrorAsString(ge).c_str());
    38163807                break;
     
    38383829
    38393830    GuestFsObjData objData;
    3840     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3841 
    3842     int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);
     3831    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3832
     3833    int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &vrcGuest);
    38433834    if (RT_SUCCESS(vrc))
    38443835        *aExists = TRUE;
     
    38493840            case VERR_GSTCTL_GUEST_ERROR:
    38503841            {
    3851                 switch (rcGuest)
     3842                switch (vrcGuest)
    38523843                {
    38533844                    case VERR_PATH_NOT_FOUND:
     
    38563847                    default:
    38573848                    {
    3858                         GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());
    3859                         hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying directory existence failed: %s"),
     3849                        GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str());
     3850                        hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying directory existence failed: %s"),
    38603851                                           GuestBase::getErrorAsString(ge).c_str());
    38613852                        break;
     
    39103901    openInfo.mFlags = fFlags;
    39113902
    3912     ComObjPtr<GuestDirectory> pDirectory; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3913     int vrc = i_directoryOpen(openInfo, pDirectory, &rcGuest);
     3903    ComObjPtr<GuestDirectory> pDirectory;
     3904    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3905    int vrc = i_directoryOpen(openInfo, pDirectory, &vrcGuest);
    39143906    if (RT_SUCCESS(vrc))
    39153907    {
     
    39283920            case VERR_GSTCTL_GUEST_ERROR:
    39293921            {
    3930                 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());
    3931                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Opening guest directory failed: %s"),
     3922                GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str());
     3923                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Opening guest directory failed: %s"),
    39323924                                   GuestBase::getErrorAsString(ge).c_str());
    39333925                break;
     
    39563948    uint32_t fFlags = DIRREMOVEREC_FLAG_NONE;
    39573949
    3958     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3959     int vrc = i_directoryRemove(aPath, fFlags, &rcGuest);
     3950    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     3951    int vrc = i_directoryRemove(aPath, fFlags, &vrcGuest);
    39603952    if (RT_FAILURE(vrc))
    39613953    {
     
    39693961            case VERR_GSTCTL_GUEST_ERROR:
    39703962            {
    3971                 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());
    3972                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Removing guest directory failed: %s"),
     3963                GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str());
     3964                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Removing guest directory failed: %s"),
    39733965                                   GuestBase::getErrorAsString(ge).c_str());
    39743966                break;
     
    40374029        return hrc;
    40384030
    4039     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4040     int vrc = i_directoryRemove(aPath, fFlags, &rcGuest);
     4031    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4032    int vrc = i_directoryRemove(aPath, fFlags, &vrcGuest);
    40414033    if (RT_FAILURE(vrc))
    40424034    {
     
    40504042            case VERR_GSTCTL_GUEST_ERROR:
    40514043            {
    4052                 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());
    4053                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Recursively removing guest directory failed: %s"),
     4044                GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str());
     4045                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Recursively removing guest directory failed: %s"),
    40544046                                   GuestBase::getErrorAsString(ge).c_str());
    40554047                break;
     
    41764168    LogFlowThisFuncEnter();
    41774169
    4178     GuestFsObjData objData; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4179     int vrc = i_fileQueryInfo(aPath, RT_BOOL(aFollowSymlinks), objData, &rcGuest);
     4170    GuestFsObjData objData;
     4171    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4172    int vrc = i_fileQueryInfo(aPath, RT_BOOL(aFollowSymlinks), objData, &vrcGuest);
    41804173    if (RT_SUCCESS(vrc))
    41814174    {
     
    41884181        case VERR_GSTCTL_GUEST_ERROR:
    41894182        {
    4190             switch (rcGuest)
     4183            switch (vrcGuest)
    41914184            {
    41924185                case VERR_PATH_NOT_FOUND:
     
    41974190                default:
    41984191                {
    4199                     GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());
    4200                     hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file existence failed: %s"),
     4192                    GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str());
     4193                    hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file existence failed: %s"),
    42014194                                       GuestBase::getErrorAsString(ge).c_str());
    42024195                    break;
     
    43024295
    43034296    ComObjPtr <GuestFile> pFile;
    4304     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4305     int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, &rcGuest);
     4297    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4298    int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, &vrcGuest);
    43064299    if (RT_SUCCESS(vrc))
    43074300        /* Return directory object to the caller. */
     
    43184311            case VERR_GSTCTL_GUEST_ERROR:
    43194312            {
    4320                 GuestErrorInfo ge(GuestErrorInfo::Type_File, rcGuest, aPath.c_str());
    4321                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Opening guest file failed: %s"),
     4313                GuestErrorInfo ge(GuestErrorInfo::Type_File, vrcGuest, aPath.c_str());
     4314                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Opening guest file failed: %s"),
    43224315                                   GuestBase::getErrorAsString(ge).c_str());
    43234316                break;
     
    43414334        return hrc;
    43424335
    4343     int64_t llSize; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4344     int vrc = i_fileQuerySize(aPath, aFollowSymlinks != FALSE,  &llSize, &rcGuest);
     4336    int64_t llSize;
     4337    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4338    int vrc = i_fileQuerySize(aPath, aFollowSymlinks != FALSE,  &llSize, &vrcGuest);
    43454339    if (RT_SUCCESS(vrc))
    4346     {
    43474340        *aSize = llSize;
    4348     }
    43494341    else
    43504342    {
    43514343        if (GuestProcess::i_isGuestError(vrc))
    43524344        {
    4353             GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());
    4354             hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file size failed: %s"),
     4345            GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str());
     4346            hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file size failed: %s"),
    43554347                               GuestBase::getErrorAsString(ge).c_str());
    43564348        }
     
    43914383
    43924384    GuestFsObjData objData;
    4393     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4394     int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);
     4385    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4386    int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &vrcGuest);
    43954387    if (RT_SUCCESS(vrc))
    4396     {
    43974388        *aExists = TRUE;
    4398     }
    43994389    else
    44004390    {
    44014391        if (GuestProcess::i_isGuestError(vrc))
    44024392        {
    4403             if (   rcGuest == VERR_NOT_A_FILE
    4404                 || rcGuest == VERR_PATH_NOT_FOUND
    4405                 || rcGuest == VERR_FILE_NOT_FOUND
    4406                 || rcGuest == VERR_INVALID_NAME)
    4407             {
     4393            if (   vrcGuest == VERR_NOT_A_FILE
     4394                || vrcGuest == VERR_PATH_NOT_FOUND
     4395                || vrcGuest == VERR_FILE_NOT_FOUND
     4396                || vrcGuest == VERR_INVALID_NAME)
    44084397                hrc = S_OK; /* Ignore these vrc values. */
    4409             }
    44104398            else
    44114399            {
    4412                 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());
    4413                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file existence information failed: %s"),
     4400                GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str());
     4401                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file existence information failed: %s"),
    44144402                                   GuestBase::getErrorAsString(ge).c_str());
    44154403            }
     
    44334421    LogFlowThisFunc(("aPath=%s, aFollowSymlinks=%RTbool\n", aPath.c_str(), RT_BOOL(aFollowSymlinks)));
    44344422
    4435     GuestFsObjData Info; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4436     int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, Info, &rcGuest);
     4423    GuestFsObjData Info;
     4424    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4425    int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, Info, &vrcGuest);
    44374426    if (RT_SUCCESS(vrc))
    44384427    {
     
    44524441        if (GuestProcess::i_isGuestError(vrc))
    44534442        {
    4454             GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());
    4455             hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file information failed: %s"),
     4443            GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str());
     4444            hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file information failed: %s"),
    44564445                               GuestBase::getErrorAsString(ge).c_str());
    44574446        }
     
    44744463    LogFlowThisFunc(("aPath=%s\n", aPath.c_str()));
    44754464
    4476     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4477     int vrc = i_fileRemove(aPath, &rcGuest);
     4465    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4466    int vrc = i_fileRemove(aPath, &vrcGuest);
    44784467    if (RT_FAILURE(vrc))
    44794468    {
    44804469        if (GuestProcess::i_isGuestError(vrc))
    44814470        {
    4482             GuestErrorInfo ge(GuestErrorInfo::Type_ToolRm, rcGuest, aPath.c_str());
    4483             hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Removing guest file failed: %s"),
     4471            GuestErrorInfo ge(GuestErrorInfo::Type_ToolRm, vrcGuest, aPath.c_str());
     4472            hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Removing guest file failed: %s"),
    44844473                               GuestBase::getErrorAsString(ge).c_str());
    44854474        }
     
    45294518
    45304519    /* Call worker to do the job. */
    4531     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    4532     int vrc = i_pathRename(aSource, aDestination, fBackend, &rcGuest);
     4520    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
     4521    int vrc = i_pathRename(aSource, aDestination, fBackend, &vrcGuest);
    45334522    if (RT_FAILURE(vrc))
    45344523    {
     
    45424531            case VERR_GSTCTL_GUEST_ERROR:
    45434532            {
    4544                 GuestErrorInfo ge(GuestErrorInfo::Type_Process, rcGuest, aSource.c_str());
    4545                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Renaming guest path failed: %s"),
     4533                GuestErrorInfo ge(GuestErrorInfo::Type_Process, vrcGuest, aSource.c_str());
     4534                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Renaming guest path failed: %s"),
    45464535                                   GuestBase::getErrorAsString(ge).c_str());
    45474536                break;
     
    46074596                                      ComPtr<IGuestProcess> &aGuestProcess)
    46084597{
    4609     HRESULT hr = i_isStartedExternal();
    4610     if (FAILED(hr))
    4611         return hr;
     4598    HRESULT hrc = i_isStartedExternal();
     4599    if (FAILED(hrc))
     4600        return hrc;
    46124601
    46134602    /*
     
    46764665            {
    46774666                ComPtr<IGuestProcess> pIProcess;
    4678                 hr = pProcess.queryInterfaceTo(pIProcess.asOutParam());
    4679                 if (SUCCEEDED(hr))
     4667                hrc = pProcess.queryInterfaceTo(pIProcess.asOutParam());
     4668                if (SUCCEEDED(hrc))
    46804669                {
    46814670                    /*
     
    46914680                    }
    46924681
    4693                     hr = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc);
     4682                    hrc = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc);
    46944683                }
    46954684            }
    46964685            else if (vrc == VERR_GSTCTL_MAX_CID_OBJECTS_REACHED)
    4697                 hr = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"),
     4686                hrc = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"),
    46984687                                 VBOX_GUESTCTRL_MAX_OBJECTS);
    46994688            else
    4700                 hr = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc);
     4689                hrc = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc);
    47014690        }
    47024691        else
    4703             hr = setErrorBoth(vrc == VERR_ENV_INVALID_VAR_NAME ? E_INVALIDARG : Global::vboxStatusCodeToCOM(vrc), vrc,
     4692            hrc = setErrorBoth(vrc == VERR_ENV_INVALID_VAR_NAME ? E_INVALIDARG : Global::vboxStatusCodeToCOM(vrc), vrc,
    47044693                              tr("Failed to apply environment variable '%s', index %u (%Rrc)'"),
    47054694                              aEnvironment[idxError].c_str(), idxError, vrc);
    47064695    }
    47074696    else
    4708         hr = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc);
     4697        hrc = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc);
    47094698
    47104699    LogFlowFuncLeaveRC(vrc);
    4711     return hr;
     4700    return hrc;
    47124701}
    47134702
     
    47224711    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    47234712
    4724     HRESULT hr = S_OK;
     4713    HRESULT hrc = S_OK;
    47254714
    47264715    ComObjPtr<GuestProcess> pProcess;
    4727     int rc = i_processGetByPID(aPid, &pProcess);
    4728     if (RT_FAILURE(rc))
    4729         hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid);
     4716    int vrc = i_processGetByPID(aPid, &pProcess);
     4717    if (RT_FAILURE(vrc))
     4718        hrc = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid);
    47304719
    47314720    /* This will set (*aProcess) to NULL if pProgress is NULL. */
    4732     HRESULT hr2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam());
    4733     if (SUCCEEDED(hr))
    4734         hr = hr2;
    4735 
    4736     LogFlowThisFunc(("aProcess=%p, hr=%Rhrc\n", (IGuestProcess*)aGuestProcess, hr));
    4737     return hr;
     4721    HRESULT hrc2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam());
     4722    if (SUCCEEDED(hrc))
     4723        hrc = hrc2;
     4724
     4725    LogFlowThisFunc(("aProcess=%p, hrc=%Rhrc\n", (IGuestProcess*)aGuestProcess, hrc));
     4726    return hrc;
    47384727}
    47394728
     
    47694758     * Note: Do not hold any locks here while waiting!
    47704759     */
    4771     int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; GuestSessionWaitResult_T waitResult;
    4772     int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest);
     4760    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; GuestSessionWaitResult_T waitResult;
     4761    int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &vrcGuest);
    47734762    if (RT_SUCCESS(vrc))
    47744763        *aReason = waitResult;
     
    47794768            case VERR_GSTCTL_GUEST_ERROR:
    47804769            {
    4781                 GuestErrorInfo ge(GuestErrorInfo::Type_Session, rcGuest, mData.mSession.mName.c_str());
    4782                 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Waiting for guest process failed: %s"),
     4770                GuestErrorInfo ge(GuestErrorInfo::Type_Session, vrcGuest, mData.mSession.mName.c_str());
     4771                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Waiting for guest process failed: %s"),
    47834772                                   GuestBase::getErrorAsString(ge).c_str());
    47844773                break;
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r98262 r98272  
    111111    /* Create the progress object. */
    112112    ComObjPtr<Progress> pProgress;
    113     HRESULT hr = pProgress.createObject();
    114     if (FAILED(hr))
     113    HRESULT hrc = pProgress.createObject();
     114    if (FAILED(hrc))
    115115        return VERR_COM_UNEXPECTED;
    116116
    117     hr = pProgress->init(static_cast<IGuestSession*>(mSession),
    118                          Bstr(mDesc).raw(),
    119                          TRUE /* aCancelable */, cOperations, Bstr(mDesc).raw());
    120     if (FAILED(hr))
     117    hrc = pProgress->init(static_cast<IGuestSession*>(mSession),
     118                          Bstr(mDesc).raw(),
     119                          TRUE /* aCancelable */, cOperations, Bstr(mDesc).raw());
     120    if (FAILED(hrc))
    121121        return VERR_COM_UNEXPECTED;
    122122
     
    159159    Bstr strTemp, strFlags;
    160160    LONG64 i64Timestamp;
    161     HRESULT hr = pMachine->GetGuestProperty(Bstr(strPath).raw(),
    162                                             strTemp.asOutParam(),
    163                                             &i64Timestamp, strFlags.asOutParam());
    164     if (SUCCEEDED(hr))
     161    HRESULT hrc = pMachine->GetGuestProperty(Bstr(strPath).raw(), strTemp.asOutParam(), &i64Timestamp, strFlags.asOutParam());
     162    if (SUCCEEDED(hrc))
    165163    {
    166164        strValue = strTemp;
     
    192190        return VINF_SUCCESS;
    193191    }
    194     HRESULT hr = mProgress->SetCurrentOperationProgress(uPercent);
    195     if (FAILED(hr))
     192    HRESULT hrc = mProgress->SetCurrentOperationProgress(uPercent);
     193    if (FAILED(hrc))
    196194        return VERR_COM_UNEXPECTED;
    197195
     
    218216        AssertMsg(uCurOp + 1 /* Zero-based */ == cOps, ("Not all operations done yet (%u/%u)\n", uCurOp + 1, cOps));
    219217#endif
    220         HRESULT hr = mProgress->i_notifyComplete(S_OK);
    221         if (FAILED(hr))
    222             return VERR_COM_UNEXPECTED; /** @todo Find a better rc. */
     218        HRESULT hrc = mProgress->i_notifyComplete(S_OK);
     219        if (FAILED(hrc))
     220            return VERR_COM_UNEXPECTED; /** @todo Find a better vrc. */
    223221    }
    224222
     
    229227 * Sets the task's progress object to an error using a string message.
    230228 *
    231  * @returns Returns \a hr for convenience.
    232  * @param   hr                  Progress operation result to set.
     229 * @returns Returns \a hrc for convenience.
     230 * @param   hrc                 Progress operation result to set.
    233231 * @param   strMsg              Message to set.
    234232 */
    235 HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg)
    236 {
    237     LogFlowFunc(("hr=%Rhrc, strMsg=%s\n", hr, strMsg.c_str()));
     233HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg)
     234{
     235    LogFlowFunc(("hrc=%Rhrc, strMsg=%s\n", hrc, strMsg.c_str()));
    238236
    239237    if (mProgress.isNull()) /* Progress is optional. */
    240         return hr; /* Return original rc. */
     238        return hrc; /* Return original status. */
    241239
    242240    BOOL fCanceled;
     
    247245        && !fCompleted)
    248246    {
    249         HRESULT hr2 = mProgress->i_notifyComplete(hr,
    250                                                   COM_IIDOF(IGuestSession),
    251                                                   GuestSession::getStaticComponentName(),
    252                                                   /* Make sure to hand-in the message via format string to avoid problems
    253                                                    * with (file) paths which e.g. contain "%s" and friends. Can happen with
    254                                                    * randomly generated Validation Kit stuff. */
    255                                                   "%s", strMsg.c_str());
    256         if (FAILED(hr2))
    257             return hr2;
    258     }
    259     return hr; /* Return original rc. */
     247        HRESULT hrc2 = mProgress->i_notifyComplete(hrc,
     248                                                   COM_IIDOF(IGuestSession),
     249                                                   GuestSession::getStaticComponentName(),
     250                                                   /* Make sure to hand-in the message via format string to avoid problems
     251                                                    * with (file) paths which e.g. contain "%s" and friends. Can happen with
     252                                                    * randomly generated Validation Kit stuff. */
     253                                                   "%s", strMsg.c_str());
     254        if (FAILED(hrc2))
     255            return hrc2;
     256    }
     257    return hrc; /* Return original status. */
    260258}
    261259
     
    263261 * Sets the task's progress object to an error using a string message and a guest error info object.
    264262 *
    265  * @returns Returns \a hr for convenience.
    266  * @param   hr                  Progress operation result to set.
     263 * @returns Returns \a hrc for convenience.
     264 * @param   hrc                 Progress operation result to set.
    267265 * @param   strMsg              Message to set.
    268266 * @param   guestErrorInfo      Guest error info to use.
    269267 */
    270 HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo)
    271 {
    272     return setProgressErrorMsg(hr, strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo));
     268HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo)
     269{
     270    return setProgressErrorMsg(hrc, strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo));
    273271}
    274272
     
    13711369
    13721370                                    if (RT_FAILURE(vrc))
    1373                                         LogRel2(("Guest Control: Unable to query symbolic link info for \"%s\", rc=%Rrc\n",
     1371                                        LogRel2(("Guest Control: Unable to query symbolic link info for \"%s\", vrc=%Rrc\n",
    13741372                                                 pszPathReal, vrc));
    13751373                                }
    13761374                                else
    13771375                                {
    1378                                     LogRel2(("Guest Control: Unable to resolve symlink for \"%s\", rc=%Rrc\n", strPathAbs.c_str(), vrc));
     1376                                    LogRel2(("Guest Control: Unable to resolve symlink for \"%s\", vrc=%Rrc\n",
     1377                                             strPathAbs.c_str(), vrc));
    13791378                                    if (vrc == VERR_FILE_NOT_FOUND) /* Broken symlink, skip. */
    13801379                                        vrc = VINF_SUCCESS;
     
    14011400    }
    14021401    else
    1403         LogFlowFunc(("Unable to query \"%s\", rc=%Rrc\n", strPathAbs.c_str(), vrc));
     1402        LogFlowFunc(("Unable to query \"%s\", vrc=%Rrc\n", strPathAbs.c_str(), vrc));
    14041403
    14051404    LogFlowFuncLeaveRC(vrc);
     
    26572656                break;
    26582657
    2659             case VERR_INVALID_STATE: /** @todo Special guest control rc needed! */
     2658            case VERR_INVALID_STATE: /** @todo Special guest control vrc needed! */
    26602659                setProgressErrorMsg(VBOX_E_IPRT_ERROR,
    26612660                                    Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"),
     
    26842683{
    26852684    int vrc                         = VERR_GSTCTL_GUEST_ERROR;
    2686     int rc                          = VERR_TIMEOUT;
     2685    int vrcRet                      = VERR_TIMEOUT;
    26872686
    26882687    uint64_t tsStart                = RTTimeSystemMilliTS();
    2689     const uint64_t timeoutMs        = 600 * 1000;
     2688    const uint64_t cMsTimeout       = 10 * RT_MS_1MIN;
    26902689
    26912690    AssertReturn(!pGuest.isNull(), VERR_TIMEOUT);
     
    27032702        if (RT_SUCCESS(vrc))
    27042703        {
     2704            Assert(!pSession.isNull());
     2705
    27052706            int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */
    2706 
    2707             Assert(!pSession.isNull());
    2708 
    27092707            vrc = pSession->i_startSession(&vrcGuest);
    27102708            if (RT_SUCCESS(vrc))
    27112709            {
     2710                /* Wait for VBoxService to start. */
    27122711                GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None;
    2713                 int rcGuest = 0; /* unused. */
    2714 
    2715                 /* Wait for VBoxService to start. */
    2716                 vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &rcGuest);
     2712                int vrcGuest2 = VINF_SUCCESS; /* unused. */
     2713                vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &vrcGuest2);
    27172714                if (RT_SUCCESS(vrc))
    27182715                {
    27192716                    vrc = pSession->Close();
    2720                     rc = 0;
     2717                    vrcRet = VINF_SUCCESS;
    27212718                    break;
    27222719                }
     
    27282725        RTThreadSleep(100);
    27292726
    2730     } while ((RTTimeSystemMilliTS() - tsStart) < timeoutMs);
    2731 
    2732     return rc;
     2727    } while ((RTTimeSystemMilliTS() - tsStart) < cMsTimeout);
     2728
     2729    return vrcRet;
    27332730}
    27342731
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