diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-01-24 10:57:32 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-01-24 10:57:32 +0000 |
commit | a319b81d4e3c50ac0134e528ebfc6b3621c98ba6 (patch) | |
tree | cd93aab9b99efd70f6f4907347e3295138ecb983 | |
parent | b053f09255713ccd93d2f607ea605a9413914c5e (diff) | |
download | VirtualBox-svn-a319b81d4e3c50ac0134e528ebfc6b3621c98ba6.tar.gz |
Main/Guest*: rc -> hrc/vrc. bugref:10223
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@98272 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r-- | src/VBox/Main/include/GuestCtrlImplPrivate.h | 180 | ||||
-rw-r--r-- | src/VBox/Main/include/GuestDirectoryImpl.h | 6 | ||||
-rw-r--r-- | src/VBox/Main/include/GuestProcessImpl.h | 34 | ||||
-rw-r--r-- | src/VBox/Main/include/GuestSessionImpl.h | 42 | ||||
-rw-r--r-- | src/VBox/Main/include/GuestSessionImplTasks.h | 13 | ||||
-rw-r--r-- | src/VBox/Main/src-client/GuestCtrlPrivate.cpp | 316 | ||||
-rw-r--r-- | src/VBox/Main/src-client/GuestDirectoryImpl.cpp | 10 | ||||
-rw-r--r-- | src/VBox/Main/src-client/GuestProcessImpl.cpp | 365 | ||||
-rw-r--r-- | src/VBox/Main/src-client/GuestSessionImpl.cpp | 787 | ||||
-rw-r--r-- | src/VBox/Main/src-client/GuestSessionImplTasks.cpp | 95 |
10 files changed, 901 insertions, 947 deletions
diff --git a/src/VBox/Main/include/GuestCtrlImplPrivate.h b/src/VBox/Main/include/GuestCtrlImplPrivate.h index b72bbecf4fc..c90d1af8490 100644 --- a/src/VBox/Main/include/GuestCtrlImplPrivate.h +++ b/src/VBox/Main/include/GuestCtrlImplPrivate.h @@ -101,7 +101,7 @@ public: virtual ~GuestEnvironmentBase(void) { Assert(m_cRefs <= 1); - int rc = RTEnvDestroy(m_hEnv); AssertRC(rc); + int vrc = RTEnvDestroy(m_hEnv); AssertRC(vrc); m_hEnv = NIL_RTENV; } @@ -169,8 +169,8 @@ public: */ void reset(void) { - int rc = RTEnvReset(m_hEnv); - AssertRC(rc); + int vrc = RTEnvReset(m_hEnv); + AssertRC(vrc); } /** @@ -214,12 +214,12 @@ public: size_t const cArray = rArray.size(); for (size_t i = 0; i < cArray; i++) { - int rc = RTEnvPutEx(m_hEnv, rArray[i].c_str()); - if (RT_FAILURE(rc)) + int vrc = RTEnvPutEx(m_hEnv, rArray[i].c_str()); + if (RT_FAILURE(vrc)) { if (pidxError) *pidxError = i; - return rc; + return vrc; } } return VINF_SUCCESS; @@ -274,19 +274,19 @@ public: */ int copyUtf8Block(const char *pszzBlock, size_t cbBlock, bool fNoEqualMeansUnset = false) { - int rc = VINF_SUCCESS; + int vrc = VINF_SUCCESS; while (cbBlock > 0 && *pszzBlock != '\0') { const char *pszEnd = (const char *)memchr(pszzBlock, '\0', cbBlock); if (!pszEnd) return VERR_BUFFER_UNDERFLOW; - int rc2; + int vrc2; if (fNoEqualMeansUnset || strchr(pszzBlock, '=')) - rc2 = RTEnvPutEx(m_hEnv, pszzBlock); + vrc2 = RTEnvPutEx(m_hEnv, pszzBlock); else - rc2 = RTEnvSetEx(m_hEnv, pszzBlock, ""); - if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) - rc = rc2; + vrc2 = RTEnvSetEx(m_hEnv, pszzBlock, ""); + if (RT_FAILURE(vrc2) && RT_SUCCESS(vrc)) + vrc = vrc2; /* Advance. */ cbBlock -= pszEnd - pszzBlock; @@ -297,13 +297,13 @@ public: } /* The remainder must be zero padded. */ - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { if (ASMMemIsZero(pszzBlock, cbBlock)) return VINF_SUCCESS; return VERR_TOO_MUCH_DATA; } - return rc; + return vrc; } /** @@ -317,22 +317,22 @@ public: int getVariable(const com::Utf8Str &rName, com::Utf8Str *pValue) const { size_t cchNeeded; - int rc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded); - if ( RT_SUCCESS(rc) - || rc == VERR_BUFFER_OVERFLOW) + int vrc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded); + if ( RT_SUCCESS(vrc) + || vrc == VERR_BUFFER_OVERFLOW) { try { pValue->reserve(cchNeeded + 1); - rc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL); + vrc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL); pValue->jolt(); } catch (std::bad_alloc &) { - rc = VERR_NO_STR_MEMORY; + vrc = VERR_NO_STR_MEMORY; } } - return rc; + return vrc; } /** @@ -383,9 +383,9 @@ protected: , m_cRefs(1) , m_fFlags(fFlags) { - int rc = cloneCommon(rThat, fChangeRecord); - if (RT_FAILURE(rc)) - throw (Global::vboxStatusCodeToCOM(rc)); + int vrc = cloneCommon(rThat, fChangeRecord); + if (RT_FAILURE(vrc)) + throw Global::vboxStatusCodeToCOM(vrc); } /** @@ -398,7 +398,7 @@ protected: */ int cloneCommon(const GuestEnvironmentBase &rThat, bool fChangeRecord) { - int rc = VINF_SUCCESS; + int vrc = VINF_SUCCESS; RTENV hNewEnv = NIL_RTENV; if (rThat.m_hEnv != NIL_RTENV) { @@ -406,18 +406,18 @@ protected: * Clone it. */ if (RTEnvIsChangeRecord(rThat.m_hEnv) == fChangeRecord) - rc = RTEnvClone(&hNewEnv, rThat.m_hEnv); + vrc = RTEnvClone(&hNewEnv, rThat.m_hEnv); else { /* Need to type convert it. */ if (fChangeRecord) - rc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags); + vrc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags); else - rc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags); - if (RT_SUCCESS(rc)) + vrc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags); + if (RT_SUCCESS(vrc)) { - rc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv); - if (RT_FAILURE(rc)) + vrc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv); + if (RT_FAILURE(vrc)) RTEnvDestroy(hNewEnv); } } @@ -429,17 +429,17 @@ protected: * (Relevant for GuestProcessStartupInfo and internal commands.) */ if (fChangeRecord) - rc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags); + vrc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags); else - rc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags); + vrc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags); } - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { RTEnvDestroy(m_hEnv); m_hEnv = hNewEnv; m_fFlags = rThat.m_fFlags; } - return rc; + return vrc; } @@ -516,9 +516,9 @@ public: */ GuestEnvironment &operator=(const GuestEnvironmentBase &rThat) { - int rc = copy(rThat); - if (RT_FAILURE(rc)) - throw (Global::vboxStatusCodeToCOM(rc)); + int vrc = copy(rThat); + if (RT_FAILURE(vrc)) + throw Global::vboxStatusCodeToCOM(vrc); return *this; } @@ -598,9 +598,9 @@ public: */ GuestEnvironmentChanges &operator=(const GuestEnvironmentBase &rThat) { - int rc = copy(rThat); - if (RT_FAILURE(rc)) - throw (Global::vboxStatusCodeToCOM(rc)); + int vrc = copy(rThat); + if (RT_FAILURE(vrc)) + throw Global::vboxStatusCodeToCOM(vrc); return *this; } @@ -655,22 +655,22 @@ public: * Initialization constructor. * * @param eType Error type to use. - * @param rc IPRT-style rc to use. + * @param vrc VBox status code to use. * @param pcszWhat Subject to use. */ - GuestErrorInfo(GuestErrorInfo::Type eType, int rc, const char *pcszWhat) + GuestErrorInfo(GuestErrorInfo::Type eType, int vrc, const char *pcszWhat) { - int rc2 = setV(eType, rc, pcszWhat); - if (RT_FAILURE(rc2)) - throw rc2; + int vrc2 = setV(eType, vrc, pcszWhat); + if (RT_FAILURE(vrc2)) + throw vrc2; } /** - * Returns the (IPRT-style) rc of this error. + * Returns the VBox status code for this error. * * @returns VBox status code. */ - int getRc(void) const { return mRc; } + int getVrc(void) const { return mVrc; } /** * Returns the type of this error. @@ -691,13 +691,13 @@ public: * * @returns VBox status code. * @param eType Error type to use. - * @param rc IPRT-style rc to use. + * @param vrc VBox status code to use. * @param pcszWhat Subject to use. */ - int setV(GuestErrorInfo::Type eType, int rc, const char *pcszWhat) + int setV(GuestErrorInfo::Type eType, int vrc, const char *pcszWhat) { mType = eType; - mRc = rc; + mVrc = vrc; mWhat = pcszWhat; return VINF_SUCCESS; @@ -707,8 +707,8 @@ protected: /** Error type. */ Type mType; - /** IPRT-style error code. */ - int mRc; + /** VBox status (error) code. */ + int mVrc; /** Subject string related to this error. */ Utf8Str mWhat; }; @@ -982,7 +982,7 @@ public: const char *GetString(const char *pszKey) const; size_t GetCount(void) const; - int GetRc(void) const; + int GetVrc(void) const; int GetInt64Ex(const char *pszKey, int64_t *piVal) const; int64_t GetInt64(const char *pszKey) const; int GetUInt32Ex(const char *pszKey, uint32_t *puVal) const; @@ -1056,26 +1056,28 @@ class GuestWaitEventPayload public: GuestWaitEventPayload(void) - : uType(0), - cbData(0), - pvData(NULL) { } + : uType(0) + , cbData(0) + , pvData(NULL) + { } /** - * Initialization constructor. Will throw() VBox status code (rc). + * Initialization constructor. + * + * @throws VBox status code (vrc). * * @param uTypePayload Payload type to set. * @param pvPayload Pointer to payload data to set (deep copy). * @param cbPayload Size (in bytes) of payload data to set. */ - GuestWaitEventPayload(uint32_t uTypePayload, - const void *pvPayload, uint32_t cbPayload) - : uType(0), - cbData(0), - pvData(NULL) + GuestWaitEventPayload(uint32_t uTypePayload, const void *pvPayload, uint32_t cbPayload) + : uType(0) + , cbData(0) + , pvData(NULL) { - int rc = copyFrom(uTypePayload, pvPayload, cbPayload); - if (RT_FAILURE(rc)) - throw rc; + int vrc = copyFrom(uTypePayload, pvPayload, cbPayload); + if (RT_FAILURE(vrc)) + throw vrc; } virtual ~GuestWaitEventPayload(void) @@ -1140,8 +1142,7 @@ protected: Clear(); - int rc = VINF_SUCCESS; - + int vrc = VINF_SUCCESS; if (cbPayload) { pvData = RTMemAlloc(cbPayload); @@ -1153,7 +1154,7 @@ protected: cbData = cbPayload; } else - rc = VERR_NO_MEMORY; + vrc = VERR_NO_MEMORY; } else { @@ -1163,7 +1164,7 @@ protected: cbData = 0; } - return rc; + return vrc; } protected: @@ -1186,12 +1187,12 @@ protected: public: - uint32_t ContextID(void) { return mCID; }; - int GuestResult(void) { return mGuestRc; } - int Result(void) { return mRc; } - GuestWaitEventPayload & Payload(void) { return mPayload; } - int SignalInternal(int rc, int guestRc, const GuestWaitEventPayload *pPayload); - int Wait(RTMSINTERVAL uTimeoutMS); + uint32_t ContextID(void) { return mCID; }; + int GuestResult(void) { return mGuestRc; } + int Result(void) { return mVrc; } + GuestWaitEventPayload &Payload(void) { return mPayload; } + int SignalInternal(int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload); + int Wait(RTMSINTERVAL uTimeoutMS); protected: @@ -1199,21 +1200,18 @@ protected: protected: - /* Shutdown indicator. */ + /** Shutdown indicator. */ bool mfAborted; - /* Associated context ID (CID). */ + /** Associated context ID (CID). */ uint32_t mCID; - /** The event semaphore for triggering - * the actual event. */ + /** The event semaphore for triggering the actual event. */ RTSEMEVENT mEventSem; - /** The event's overall result. If - * set to VERR_GSTCTL_GUEST_ERROR, - * mGuestRc will contain the actual - * error code from the guest side. */ - int mRc; - /** The event'S overall result from the - * guest side. If used, mRc must be - * set to VERR_GSTCTL_GUEST_ERROR. */ + /** The event's overall result. + * If set to VERR_GSTCTL_GUEST_ERROR, mGuestRc will contain the actual + * error code from the guest side. */ + int mVrc; + /** The event'S overall result from the guest side. + * If used, mVrc must be set to VERR_GSTCTL_GUEST_ERROR. */ int mGuestRc; /** The event's payload data. Optional. */ GuestWaitEventPayload mPayload; @@ -1236,7 +1234,7 @@ public: int Init(uint32_t uCID, const GuestEventTypes &lstEvents); int Cancel(void); const ComPtr<IEvent> Event(void) { return mEvent; } - bool HasGuestError(void) const { return mRc == VERR_GSTCTL_GUEST_ERROR; } + bool HasGuestError(void) const { return mVrc == VERR_GSTCTL_GUEST_ERROR; } int GetGuestError(void) const { return mGuestRc; } int SignalExternal(IEvent *pEvent); const GuestEventTypes &Types(void) { return mEventTypes; } @@ -1270,11 +1268,11 @@ public: /** Signals a wait event using a public guest event; also used for * for external event listeners. */ int signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent); - /** Signals a wait event using a guest rc. */ - int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int guestRc, const GuestWaitEventPayload *pPayload); + /** Signals a wait event using a guest vrc. */ + int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrcGuest, const GuestWaitEventPayload *pPayload); /** Signals a wait event without letting public guest events know, * extended director's cut version. */ - int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int rc, int guestRc, const GuestWaitEventPayload *pPayload); + int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload); public: diff --git a/src/VBox/Main/include/GuestDirectoryImpl.h b/src/VBox/Main/include/GuestDirectoryImpl.h index ecdcb76bfc3..cfc55553d57 100644 --- a/src/VBox/Main/include/GuestDirectoryImpl.h +++ b/src/VBox/Main/include/GuestDirectoryImpl.h @@ -67,15 +67,15 @@ public: public: /** @name Public internal methods. * @{ */ - int i_closeInternal(int *pGuestRc); - int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pGuestRc); + int i_closeInternal(int *pvrcGuest); + int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pvrcGuest); int i_readInternal(GuestFsObjData &objData, int *prcGuest); /** @} */ public: /** @name Public static internal methods. * @{ */ - static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat); + static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat); /** @} */ private: diff --git a/src/VBox/Main/include/GuestProcessImpl.h b/src/VBox/Main/include/GuestProcessImpl.h index aa99eacc364..86fadf76385 100644 --- a/src/VBox/Main/include/GuestProcessImpl.h +++ b/src/VBox/Main/include/GuestProcessImpl.h @@ -72,22 +72,22 @@ public: * @{ */ inline int i_checkPID(uint32_t uPID); ProcessStatus_T i_getStatus(void); - int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc); - int i_startProcess(uint32_t cMsTimeout, int *pGuestRc); - int i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pGuestRc); + int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pvrcGuest); + int i_startProcess(uint32_t cMsTimeout, int *pvrcGuest); + int i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pvrcGuest); int i_startProcessAsync(void); - int i_terminateProcess(uint32_t uTimeoutMS, int *pGuestRc); + int i_terminateProcess(uint32_t uTimeoutMS, int *pvrcGuest); ProcessWaitResult_T i_waitFlagsToResult(uint32_t fWaitFlags); - int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc); + int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pvrcGuest); int i_waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed); int i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, void* pvData, size_t cbData, uint32_t *pcbRead); - int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pGuestRc); - int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc); + int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pvrcGuest); + int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pvrcGuest); /** @} */ /** @name Static internal methods. * @{ */ - static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat); + static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat); static Utf8Str i_statusToString(ProcessStatus_T enmStatus); static bool i_isGuestError(int guestRc); static ProcessWaitResult_T i_waitFlagsToResultEx(uint32_t fWaitFlags, ProcessStatus_T oldStatus, ProcessStatus_T newStatus, uint32_t uProcFlags, uint32_t uProtocol); @@ -107,7 +107,7 @@ protected: int i_onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData); int i_onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData); int i_prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); - int i_setProcessStatus(ProcessStatus_T procStatus, int procRc); + int i_setProcessStatus(ProcessStatus_T procStatus, int vrcProc); static int i_startProcessThreadTask(GuestProcessStartTask *pTask); /** @} */ @@ -209,8 +209,8 @@ private: */ struct GuestProcessToolErrorInfo { - /** Return code from the guest side for executing the process tool. */ - int rcGuest; + /** Return (VBox status) code from the guest side for executing the process tool. */ + int vrcGuest; /** The process tool's returned exit code. */ int32_t iExitCode; }; @@ -239,7 +239,7 @@ public: public: - int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pGuestRc); + int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pvrcGuest); void uninit(void); @@ -253,9 +253,9 @@ public: /** Returns the stderr output from the guest process tool. */ GuestProcessStream &getStdErr(void) { return mStdErr; } - int wait(uint32_t fToolWaitFlags, int *pGuestRc); + int wait(uint32_t fToolWaitFlags, int *pvrcGuest); - int waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStreamBlock, int *pGuestRc); + int waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStreamBlock, int *pvrcGuest); bool isRunning(void); @@ -263,18 +263,18 @@ public: int getTerminationStatus(int32_t *piExitCode = NULL); - int terminate(uint32_t uTimeoutMS, int *pGuestRc); + int terminate(uint32_t uTimeoutMS, int *pvrcGuest); public: /** Wrapped @name Static run methods. * @{ */ - static int run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pGuestRc); + static int run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pvrcGuest); static int runErrorInfo(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, GuestProcessToolErrorInfo &errorInfo); static int runEx(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, - GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *pGuestRc); + GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *pvrcGuest); static int runExErrorInfo(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, GuestProcessToolErrorInfo &errorInfo); diff --git a/src/VBox/Main/include/GuestSessionImpl.h b/src/VBox/Main/include/GuestSessionImpl.h index 2b42d67a4cc..9c360d9de8b 100644 --- a/src/VBox/Main/include/GuestSessionImpl.h +++ b/src/VBox/Main/include/GuestSessionImpl.h @@ -290,32 +290,32 @@ public: ComPtr<IProgress> &pProgress); HRESULT i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination, ComPtr<IProgress> &pProgress); - int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc); + int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest); HRESULT i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, DirectoryCopyFlag_T *pfFlags); bool i_directoryExists(const Utf8Str &strPath); inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir); int i_directoryUnregister(GuestDirectory *pDirectory); - int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pGuestRc); - int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc); + int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest); + int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest); int i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, - ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc); - int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); + ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest); + int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); HRESULT i_fileCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, FileCopyFlag_T *pfFlags); inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile); int i_fileUnregister(GuestFile *pFile); - int i_fileRemove(const Utf8Str &strPath, int *pGuestRc); + int i_fileRemove(const Utf8Str &strPath, int *pvrcGuest); int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, FileSharingMode_T aSharingMode, ULONG aCreationMode, const std::vector<FileOpenExFlag_T> &aFlags, - ComObjPtr<GuestFile> &pFile, int *prcGuest); - int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc); - int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); - int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc); + ComObjPtr<GuestFile> &pFile, int *pvrcGuest); + int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest); + int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); + int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest); int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, - Utf8Str &strName, uint32_t fMode, bool fSecure, int *pGuestRc); - int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); + Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest); + int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); const GuestCredentials &i_getCredentials(void); EventSource *i_getEventSource(void) { return mEventSource; } Utf8Str i_getName(void); @@ -327,7 +327,7 @@ public: int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData); PathStyle_T i_getGuestPathStyle(void); static PathStyle_T i_getHostPathStyle(void); - int i_startSession(int *pGuestRc); + int i_startSession(int *pvrcGuest); int i_startSessionAsync(void); Guest *i_getParent(void) { return mParent; } uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; } @@ -335,22 +335,22 @@ public: int i_objectUnregister(uint32_t uObjectID); int i_objectsUnregister(void); int i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessionStatus); - int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pGuestRc); - int i_pathUserDocuments(Utf8Str &strPath, int *prcGuest); - int i_pathUserHome(Utf8Str &strPath, int *prcGuest); + int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest); + int i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest); + int i_pathUserHome(Utf8Str &strPath, int *pvrcGuest); int i_processUnregister(GuestProcess *pProcess); int i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress); inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess); inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess); int i_sendMessage(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms, uint64_t fDst = VBOX_GUESTCTRL_DST_SESSION); - int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc); - int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */); - int i_shutdown(uint32_t fFlags, int *prcGuest); + int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession); + int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */); + int i_shutdown(uint32_t fFlags, int *pvrcGuest); int i_determineProtocolVersion(void); - int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc); + int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest); int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, - GuestSessionStatus_T *pSessionStatus, int *pGuestRc); + GuestSessionStatus_T *pSessionStatus, int *pvrcGuest); /** @} */ public: diff --git a/src/VBox/Main/include/GuestSessionImplTasks.h b/src/VBox/Main/include/GuestSessionImplTasks.h index 3e512df52ee..1e04ef989a6 100644 --- a/src/VBox/Main/include/GuestSessionImplTasks.h +++ b/src/VBox/Main/include/GuestSessionImplTasks.h @@ -217,11 +217,10 @@ public: virtual HRESULT Init(const Utf8Str &strTaskDesc) { setTaskDesc(strTaskDesc); - int rc = createAndSetProgressObject(); /* Single operation by default. */ - if (RT_FAILURE(rc)) - return E_FAIL; - - return S_OK; + int vrc = createAndSetProgressObject(); /* Single operation by default. */ + if (RT_SUCCESS(vrc)) + return S_OK; + return E_FAIL; } /** Returns the task's progress object. */ @@ -261,8 +260,8 @@ protected: int setProgress(ULONG uPercent); int setProgressSuccess(void); - HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg); - HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo); + HRESULT setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg); + HRESULT setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo); inline void setTaskDesc(const Utf8Str &strTaskDesc) throw() { diff --git a/src/VBox/Main/src-client/GuestCtrlPrivate.cpp b/src/VBox/Main/src-client/GuestCtrlPrivate.cpp index e9f0667b4cb..97142831729 100644 --- a/src/VBox/Main/src-client/GuestCtrlPrivate.cpp +++ b/src/VBox/Main/src-client/GuestCtrlPrivate.cpp @@ -202,8 +202,8 @@ int GuestFsObjData::FromLs(const GuestProcessStreamBlock &strmBlk, bool fLong) mFileAttrs = szAttribs; /* Object size. */ - int rc = strmBlk.GetInt64Ex("st_size", &mObjectSize); - ASSERT_GUEST_RC_RETURN(rc, rc); + int vrc = strmBlk.GetInt64Ex("st_size", &mObjectSize); + ASSERT_GUEST_RC_RETURN(vrc, vrc); strmBlk.GetInt64Ex("alloc", &mAllocatedSize); /* INode number and device. */ @@ -260,8 +260,8 @@ int GuestFsObjData::FromRm(const GuestProcessStreamBlock &strmBlk) /* Object name. */ mName = strmBlk.GetString("fname"); - /* Return the stream block's rc. */ - return strmBlk.GetRc(); + /* Return the stream block's vrc. */ + return strmBlk.GetVrc(); } /** @@ -295,11 +295,10 @@ int GuestFsObjData::FromMkTemp(const GuestProcessStreamBlock &strmBlk) mName = strmBlk.GetString("name"); ASSERT_GUEST_RETURN(mName.isNotEmpty(), VERR_NOT_FOUND); - /* Assign the stream block's rc. */ - int rc = strmBlk.GetRc(); - - LogFlowFuncLeaveRC(rc); - return rc; + /* Assign the stream block's vrc. */ + int const vrc = strmBlk.GetVrc(); + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -425,13 +424,11 @@ size_t GuestProcessStreamBlock::GetCount(void) const * @return VBox status code. * @retval VERR_NOT_FOUND if the return code string ("rc") was not found. */ -int GuestProcessStreamBlock::GetRc(void) const +int GuestProcessStreamBlock::GetVrc(void) const { const char *pszValue = GetString("rc"); if (pszValue) - { return RTStrToInt16(pszValue); - } /** @todo We probably should have a dedicated error for that, VERR_GSTCTL_GUEST_TOOLBOX_whatever. */ return VERR_NOT_FOUND; } @@ -490,8 +487,8 @@ int32_t GuestProcessStreamBlock::GetInt32(const char *pszKey, int32_t iDefault) if (pszValue) { int32_t iRet; - int rc = RTStrToInt32Full(pszValue, 0, &iRet); - if (RT_SUCCESS(rc)) + int vrc = RTStrToInt32Full(pszValue, 0, &iRet); + if (RT_SUCCESS(vrc)) return iRet; ASSERT_GUEST_MSG_FAILED(("%s=%s\n", pszKey, pszValue)); } @@ -524,16 +521,16 @@ int GuestProcessStreamBlock::SetValue(const char *pszKey, const char *pszValue) { AssertPtrReturn(pszKey, VERR_INVALID_POINTER); - int rc = VINF_SUCCESS; + int vrc = VINF_SUCCESS; try { - Utf8Str Utf8Key(pszKey); + Utf8Str const strKey(pszKey); /* Take a shortcut and prevent crashes on some funny versions * of STL if map is empty initially. */ if (!mPairs.empty()) { - GuestCtrlStreamPairMapIter it = mPairs.find(Utf8Key); + GuestCtrlStreamPairMapIter it = mPairs.find(strKey); if (it != mPairs.end()) mPairs.erase(it); } @@ -541,14 +538,14 @@ int GuestProcessStreamBlock::SetValue(const char *pszKey, const char *pszValue) if (pszValue) { GuestProcessStreamValue val(pszValue); - mPairs[Utf8Key] = val; + mPairs[strKey] = val; } } - catch (const std::exception &ex) + catch (const std::exception &) { - RT_NOREF(ex); + /** @todo set vrc? */ } - return rc; + return vrc; } /////////////////////////////////////////////////////////////////////////////// @@ -578,7 +575,7 @@ int GuestProcessStream::AddData(const BYTE *pbData, size_t cbData) AssertPtrReturn(pbData, VERR_INVALID_POINTER); AssertReturn(cbData, VERR_INVALID_PARAMETER); - int rc = VINF_SUCCESS; + int vrc = VINF_SUCCESS; /* Rewind the buffer if it's empty. */ size_t cbInBuf = m_cbUsed - m_offBuffer; @@ -619,14 +616,14 @@ int GuestProcessStream::AddData(const BYTE *pbData, size_t cbData) m_cbAllocated = cbAlloc; } else - rc = VERR_NO_MEMORY; + vrc = VERR_NO_MEMORY; } else - rc = VERR_TOO_MUCH_DATA; + vrc = VERR_TOO_MUCH_DATA; } /* Finally, copy the data. */ - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { if (cbData + m_cbUsed <= m_cbAllocated) { @@ -634,11 +631,11 @@ int GuestProcessStream::AddData(const BYTE *pbData, size_t cbData) m_cbUsed += cbData; } else - rc = VERR_BUFFER_OVERFLOW; + vrc = VERR_BUFFER_OVERFLOW; } } - return rc; + return vrc; } /** @@ -670,10 +667,10 @@ void GuestProcessStream::Dump(const char *pszFile) m_pbBuffer, m_cbAllocated, m_cbUsed, m_offBuffer, pszFile)); RTFILE hFile; - int rc = RTFileOpen(&hFile, pszFile, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE); - if (RT_SUCCESS(rc)) + int vrc = RTFileOpen(&hFile, pszFile, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE); + if (RT_SUCCESS(vrc)) { - rc = RTFileWrite(hFile, m_pbBuffer, m_cbUsed, NULL /* pcbWritten */); + vrc = RTFileWrite(hFile, m_pbBuffer, m_cbUsed, NULL /* pcbWritten */); RTFileClose(hFile); } } @@ -706,7 +703,7 @@ int GuestProcessStream::ParseBlock(GuestProcessStreamBlock &streamBlock) if (m_offBuffer == m_cbUsed) return VERR_NO_DATA; - int rc = VINF_SUCCESS; + int vrc = VINF_SUCCESS; char * const pszOff = (char *)&m_pbBuffer[m_offBuffer]; size_t cbLeft = m_offBuffer < m_cbUsed ? m_cbUsed - m_offBuffer : 0; char *pszStart = pszOff; @@ -715,7 +712,7 @@ int GuestProcessStream::ParseBlock(GuestProcessStreamBlock &streamBlock) char * const pszPairEnd = RTStrEnd(pszStart, cbLeft); if (!pszPairEnd) { - rc = VERR_MORE_DATA; + vrc = VERR_MORE_DATA; break; } size_t const cchPair = (size_t)(pszPairEnd - pszStart); @@ -724,14 +721,14 @@ int GuestProcessStream::ParseBlock(GuestProcessStreamBlock &streamBlock) *pszSep = '\0'; /* Terminate the separator so that we can use pszStart as our key from now on. */ else { - rc = VERR_MORE_DATA; /** @todo r=bird: This is BOGUS because we'll be stuck here if the guest feeds us bad data! */ + vrc = VERR_MORE_DATA; /** @todo r=bird: This is BOGUS because we'll be stuck here if the guest feeds us bad data! */ break; } char const * const pszVal = pszSep + 1; - rc = streamBlock.SetValue(pszStart, pszVal); - if (RT_FAILURE(rc)) - return rc; + vrc = streamBlock.SetValue(pszStart, pszVal); + if (RT_FAILURE(vrc)) + return vrc; /* Next pair. */ pszStart = pszPairEnd + 1; @@ -749,7 +746,7 @@ int GuestProcessStream::ParseBlock(GuestProcessStreamBlock &streamBlock) cbDistance++; m_offBuffer += cbDistance; - return rc; + return vrc; } GuestBase::GuestBase(void) @@ -769,10 +766,9 @@ GuestBase::~GuestBase(void) */ int GuestBase::baseInit(void) { - int rc = RTCritSectInit(&mWaitEventCritSect); - - LogFlowFuncLeaveRC(rc); - return rc; + int const vrc = RTCritSectInit(&mWaitEventCritSect); + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -783,13 +779,13 @@ void GuestBase::baseUninit(void) LogFlowThisFuncEnter(); /* Make sure to cancel any outstanding wait events. */ - int rc2 = cancelWaitEvents(); - AssertRC(rc2); + int vrc2 = cancelWaitEvents(); + AssertRC(vrc2); - rc2 = RTCritSectDelete(&mWaitEventCritSect); - AssertRC(rc2); + vrc2 = RTCritSectDelete(&mWaitEventCritSect); + AssertRC(vrc2); - LogFlowFuncLeaveRC(rc2); + LogFlowFuncLeaveRC(vrc2); /* No return value. */ } @@ -802,8 +798,8 @@ int GuestBase::cancelWaitEvents(void) { LogFlowThisFuncEnter(); - int rc = RTCritSectEnter(&mWaitEventCritSect); - if (RT_SUCCESS(rc)) + int vrc = RTCritSectEnter(&mWaitEventCritSect); + if (RT_SUCCESS(vrc)) { GuestEventGroup::iterator itEventGroups = mWaitEventGroups.begin(); while (itEventGroups != mWaitEventGroups.end()) @@ -819,8 +815,8 @@ int GuestBase::cancelWaitEvents(void) * wait events map. Don't delete it though, this (hopefully) * is done by the caller using unregisterWaitEvent(). */ - int rc2 = pEvent->Cancel(); - AssertRC(rc2); + int vrc2 = pEvent->Cancel(); + AssertRC(vrc2); ++itEvents; } @@ -828,13 +824,13 @@ int GuestBase::cancelWaitEvents(void) ++itEventGroups; } - int rc2 = RTCritSectLeave(&mWaitEventCritSect); - if (RT_SUCCESS(rc)) - rc = rc2; + int vrc2 = RTCritSectLeave(&mWaitEventCritSect); + if (RT_SUCCESS(vrc)) + vrc = vrc2; } - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -883,9 +879,9 @@ int GuestBase::dispatchGeneric(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOS GuestWaitEventPayload evPayload(dataCb.uType, dataCb.pvPayload, dataCb.cbPayload); vrc = signalWaitEventInternal(pCtxCb, dataCb.rc, &evPayload); } - catch (int rcEx) /* Thrown by GuestWaitEventPayload constructor. */ + catch (int vrcEx) /* Thrown by GuestWaitEventPayload constructor. */ { - vrc = rcEx; + vrc = vrcEx; } } else @@ -902,9 +898,9 @@ int GuestBase::dispatchGeneric(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOS { vrc = VERR_NO_MEMORY; } - catch (int rc) + catch (int vrc) { - vrc = rc; + vrc = vrc; } LogFlowFuncLeaveRC(vrc); @@ -989,19 +985,19 @@ int GuestBase::registerWaitEventEx(uint32_t uSessionID, uint32_t uObjectID, cons AssertPtrReturn(ppEvent, VERR_INVALID_POINTER); uint32_t idContext; - int rc = generateContextID(uSessionID, uObjectID, &idContext); - AssertRCReturn(rc, rc); + int vrc = generateContextID(uSessionID, uObjectID, &idContext); + AssertRCReturn(vrc, vrc); GuestWaitEvent *pEvent = new GuestWaitEvent(); AssertPtrReturn(pEvent, VERR_NO_MEMORY); - rc = pEvent->Init(idContext, lstEvents); - AssertRCReturn(rc, rc); + vrc = pEvent->Init(idContext, lstEvents); + AssertRCReturn(vrc, vrc); LogFlowThisFunc(("New event=%p, CID=%RU32\n", pEvent, idContext)); - rc = RTCritSectEnter(&mWaitEventCritSect); - if (RT_SUCCESS(rc)) + vrc = RTCritSectEnter(&mWaitEventCritSect); + if (RT_SUCCESS(vrc)) { /* * Check that we don't have any context ID collisions (should be very unlikely). @@ -1014,14 +1010,14 @@ int GuestBase::registerWaitEventEx(uint32_t uSessionID, uint32_t uObjectID, cons uint32_t cTries = 0; do { - rc = generateContextID(uSessionID, uObjectID, &idContext); - AssertRCBreak(rc); + vrc = generateContextID(uSessionID, uObjectID, &idContext); + AssertRCBreak(vrc); LogFunc(("Found context ID duplicate; trying a different context ID: %#x\n", idContext)); if (mWaitEvents.find(idContext) != mWaitEvents.end()) - rc = VERR_GSTCTL_MAX_CID_COUNT_REACHED; - } while (RT_FAILURE_NP(rc) && cTries++ < 10); + vrc = VERR_GSTCTL_MAX_CID_COUNT_REACHED; + } while (RT_FAILURE_NP(vrc) && cTries++ < 10); } - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { /* * Insert event into matching event group. This is for faster per-group lookup of all events later. @@ -1044,14 +1040,14 @@ int GuestBase::registerWaitEventEx(uint32_t uSessionID, uint32_t uObjectID, cons --ItType; mWaitEventGroups[*ItType].erase(idContext); } - rc = VERR_NO_MEMORY; + vrc = VERR_NO_MEMORY; break; } } else Assert(cInserts > 0); /* else: lstEvents has duplicate entries. */ } - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { Assert(cInserts > 0 || lstEvents.size() == 0); RT_NOREF(cInserts); @@ -1067,23 +1063,23 @@ int GuestBase::registerWaitEventEx(uint32_t uSessionID, uint32_t uObjectID, cons { for (GuestEventTypes::const_iterator ItType = lstEvents.begin(); ItType != lstEvents.end(); ++ItType) mWaitEventGroups[*ItType].erase(idContext); - rc = VERR_NO_MEMORY; + vrc = VERR_NO_MEMORY; } } } RTCritSectLeave(&mWaitEventCritSect); } - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { *ppEvent = pEvent; - return rc; + return vrc; } if (pEvent) delete pEvent; - return rc; + return vrc; } /** @@ -1096,11 +1092,11 @@ int GuestBase::registerWaitEventEx(uint32_t uSessionID, uint32_t uObjectID, cons */ int GuestBase::signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent) { - int rc = RTCritSectEnter(&mWaitEventCritSect); + int vrc = RTCritSectEnter(&mWaitEventCritSect); #ifdef DEBUG uint32_t cEvents = 0; #endif - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { GuestEventGroup::iterator itGroup = mWaitEventGroups.find(aType); if (itGroup != mWaitEventGroups.end()) @@ -1113,8 +1109,8 @@ int GuestBase::signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent) ItWaitEvt->second, aType, ItWaitEvt->first, VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(ItWaitEvt->first), VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(ItWaitEvt->first), VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(ItWaitEvt->first))); - int rc2 = ItWaitEvt->second->SignalExternal(aEvent); - AssertRC(rc2); + int vrc2 = ItWaitEvt->second->SignalExternal(aEvent); + AssertRC(vrc2); /* Take down the wait event object details before we erase it from this list and invalid ItGrpEvt. */ const GuestEventTypes &EvtTypes = ItWaitEvt->second->Types(); @@ -1139,34 +1135,31 @@ int GuestBase::signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent) } } - int rc2 = RTCritSectLeave(&mWaitEventCritSect); - if (RT_SUCCESS(rc)) - rc = rc2; + int vrc2 = RTCritSectLeave(&mWaitEventCritSect); + if (RT_SUCCESS(vrc)) + vrc = vrc2; } #ifdef DEBUG - LogFlowThisFunc(("Signalled %RU32 events, rc=%Rrc\n", cEvents, rc)); + LogFlowThisFunc(("Signalled %RU32 events, vrc=%Rrc\n", cEvents, vrc)); #endif - return rc; + return vrc; } /** * Signals a wait event which is registered to a specific callback (bound to a context ID (CID)). * * @returns VBox status code. - * @param pCbCtx Pointer to host service callback context. - * @param rcGuest Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR. - * @param pPayload Additional wait event payload data set set on return. Optional. + * @param pCbCtx Pointer to host service callback context. + * @param vrcGuest Guest return VBox status code to set. + * @param pPayload Additional wait event payload data set set on return. Optional. */ -int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, - int rcGuest, const GuestWaitEventPayload *pPayload) +int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrcGuest, const GuestWaitEventPayload *pPayload) { - if (RT_SUCCESS(rcGuest)) - return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS, - 0 /* Guest rc */, pPayload); + if (RT_SUCCESS(vrcGuest)) + return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS, VINF_SUCCESS /* vrcGuest */, pPayload); - return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR, - rcGuest, pPayload); + return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR, vrcGuest, pPayload); } /** @@ -1174,39 +1167,39 @@ int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, * Extended version. * * @returns VBox status code. - * @param pCbCtx Pointer to host service callback context. - * @param rc Return code (rc) to set as wait result. - * @param rcGuest Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR. - * @param pPayload Additional wait event payload data set set on return. Optional. + * @param pCbCtx Pointer to host service callback context. + * @param vrc Return VBox status code to set as wait result. + * @param vrcGuest Guest return VBox status code to set additionally, if + * vrc is set to VERR_GSTCTL_GUEST_ERROR. + * @param pPayload Additional wait event payload data set set on return. Optional. */ -int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, - int rc, int rcGuest, +int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload) { AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER); /* pPayload is optional. */ - int rc2 = RTCritSectEnter(&mWaitEventCritSect); - if (RT_SUCCESS(rc2)) + int vrc2 = RTCritSectEnter(&mWaitEventCritSect); + if (RT_SUCCESS(vrc2)) { GuestWaitEvents::iterator itEvent = mWaitEvents.find(pCbCtx->uContextID); if (itEvent != mWaitEvents.end()) { - LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc, rcGuest=%Rrc, pPayload=%p) ...\n", - itEvent->second, itEvent->first, rc, rcGuest, pPayload)); + LogFlowThisFunc(("Signalling event=%p (CID %RU32, vrc=%Rrc, vrcGuest=%Rrc, pPayload=%p) ...\n", + itEvent->second, itEvent->first, vrc, vrcGuest, pPayload)); GuestWaitEvent *pEvent = itEvent->second; AssertPtr(pEvent); - rc2 = pEvent->SignalInternal(rc, rcGuest, pPayload); + vrc2 = pEvent->SignalInternal(vrc, vrcGuest, pPayload); } else - rc2 = VERR_NOT_FOUND; + vrc2 = VERR_NOT_FOUND; - int rc3 = RTCritSectLeave(&mWaitEventCritSect); - if (RT_SUCCESS(rc2)) - rc2 = rc3; + int vrc3 = RTCritSectLeave(&mWaitEventCritSect); + if (RT_SUCCESS(vrc2)) + vrc2 = vrc3; } - return rc2; + return vrc2; } /** @@ -1222,8 +1215,8 @@ int GuestBase::unregisterWaitEvent(GuestWaitEvent *pWaitEvt) if (!pWaitEvt) /* Nothing to unregister. */ return VINF_SUCCESS; - int rc = RTCritSectEnter(&mWaitEventCritSect); - if (RT_SUCCESS(rc)) + int vrc = RTCritSectEnter(&mWaitEventCritSect); + if (RT_SUCCESS(vrc)) { LogFlowThisFunc(("pWaitEvt=%p\n", pWaitEvt)); @@ -1280,15 +1273,15 @@ int GuestBase::unregisterWaitEvent(GuestWaitEvent *pWaitEvt) catch (const std::exception &ex) { RT_NOREF(ex); - AssertFailedStmt(rc = VERR_NOT_FOUND); + AssertFailedStmt(vrc = VERR_NOT_FOUND); } - int rc2 = RTCritSectLeave(&mWaitEventCritSect); - if (RT_SUCCESS(rc)) - rc = rc2; + int vrc2 = RTCritSectLeave(&mWaitEventCritSect); + if (RT_SUCCESS(vrc)) + vrc = vrc2; } - return rc; + return vrc; } /** @@ -1317,8 +1310,8 @@ int GuestBase::waitForEvent(GuestWaitEvent *pWaitEvt, uint32_t msTimeout, VBoxEv { if (pType) { - HRESULT hr = pThisEvent->COMGETTER(Type)(pType); - if (FAILED(hr)) + HRESULT hrc = pThisEvent->COMGETTER(Type)(pType); + if (FAILED(hrc)) vrc = VERR_COM_UNEXPECTED; } if ( RT_SUCCESS(vrc) @@ -1354,7 +1347,7 @@ int GuestBase::waitForEvent(GuestWaitEvent *pWaitEvt, uint32_t msTimeout, VBoxEv */ /* static */ Utf8Str GuestBase::getErrorAsString(const GuestErrorInfo& guestErrorInfo) { - AssertMsg(RT_FAILURE(guestErrorInfo.getRc()), ("Guest rc does not indicate a failure\n")); + AssertMsg(RT_FAILURE(guestErrorInfo.getVrc()), ("Guest vrc does not indicate a failure\n")); Utf8Str strErr; @@ -1368,19 +1361,19 @@ int GuestBase::waitForEvent(GuestWaitEvent *pWaitEvt, uint32_t msTimeout, VBoxEv switch (guestErrorInfo.getType()) { case GuestErrorInfo::Type_Session: - strErr = GuestSession::i_guestErrorToString(guestErrorInfo.getRc()); + strErr = GuestSession::i_guestErrorToString(guestErrorInfo.getVrc()); break; case GuestErrorInfo::Type_Process: - strErr = GuestProcess::i_guestErrorToString(guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str()); + strErr = GuestProcess::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str()); break; case GuestErrorInfo::Type_File: - strErr = GuestFile::i_guestErrorToString(guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str()); + strErr = GuestFile::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str()); break; case GuestErrorInfo::Type_Directory: - strErr = GuestDirectory::i_guestErrorToString(guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str()); + strErr = GuestDirectory::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str()); break; CASE_TOOL_ERROR(GuestErrorInfo::Type_ToolCat, VBOXSERVICE_TOOL_CAT); @@ -1391,9 +1384,9 @@ int GuestBase::waitForEvent(GuestWaitEvent *pWaitEvt, uint32_t msTimeout, VBoxEv CASE_TOOL_ERROR(GuestErrorInfo::Type_ToolStat, VBOXSERVICE_TOOL_STAT); default: - AssertMsgFailed(("Type not implemented (type=%RU32, rc=%Rrc)\n", guestErrorInfo.getType(), guestErrorInfo.getRc())); - strErr = Utf8StrFmt("Unknown / Not implemented -- Please file a bug report (type=%RU32, rc=%Rrc)\n", - guestErrorInfo.getType(), guestErrorInfo.getRc()); + AssertMsgFailed(("Type not implemented (type=%RU32, vrc=%Rrc)\n", guestErrorInfo.getType(), guestErrorInfo.getVrc())); + strErr = Utf8StrFmt("Unknown / Not implemented -- Please file a bug report (type=%RU32, vrc=%Rrc)\n", + guestErrorInfo.getType(), guestErrorInfo.getVrc()); break; } @@ -1551,7 +1544,7 @@ GuestWaitEventBase::GuestWaitEventBase(void) : mfAborted(false), mCID(0), mEventSem(NIL_RTSEMEVENT), - mRc(VINF_SUCCESS), + mVrc(VINF_SUCCESS), mGuestRc(VINF_SUCCESS) { } @@ -1582,37 +1575,37 @@ int GuestWaitEventBase::Init(uint32_t uCID) * Signals a wait event. * * @returns VBox status code. - * @param rc Return code (rc) to set as wait result. - * @param rcGuest Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR. - * @param pPayload Additional wait event payload data set set on return. Optional. + * @param vrc Return VBox status code to set as wait result. + * @param vrcGuest Guest return VBox status code to set additionally, if + * @a vrc is set to VERR_GSTCTL_GUEST_ERROR. + * @param pPayload Additional wait event payload data set set on return. Optional. */ -int GuestWaitEventBase::SignalInternal(int rc, int rcGuest, - const GuestWaitEventPayload *pPayload) +int GuestWaitEventBase::SignalInternal(int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload) { if (mfAborted) return VERR_CANCELLED; #ifdef VBOX_STRICT - if (rc == VERR_GSTCTL_GUEST_ERROR) - AssertMsg(RT_FAILURE(rcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", rcGuest)); + if (vrc == VERR_GSTCTL_GUEST_ERROR) + AssertMsg(RT_FAILURE(vrcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", vrcGuest)); else - AssertMsg(RT_SUCCESS(rcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", rcGuest)); + AssertMsg(RT_SUCCESS(vrcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", vrcGuest)); #endif - int rc2; + int vrc2; if (pPayload) - rc2 = mPayload.CopyFromDeep(*pPayload); + vrc2 = mPayload.CopyFromDeep(*pPayload); else - rc2 = VINF_SUCCESS; - if (RT_SUCCESS(rc2)) + vrc2 = VINF_SUCCESS; + if (RT_SUCCESS(vrc2)) { - mRc = rc; - mGuestRc = rcGuest; + mVrc = vrc; + mGuestRc = vrcGuest; - rc2 = RTSemEventSignal(mEventSem); + vrc2 = RTSemEventSignal(mEventSem); } - return rc2; + return vrc2; } /** @@ -1628,31 +1621,26 @@ int GuestWaitEventBase::SignalInternal(int rc, int rcGuest, */ int GuestWaitEventBase::Wait(RTMSINTERVAL msTimeout) { - int rc = VINF_SUCCESS; - - if (mfAborted) - rc = VERR_CANCELLED; - - if (RT_SUCCESS(rc)) + int vrc; + if (!mfAborted) { AssertReturn(mEventSem != NIL_RTSEMEVENT, VERR_CANCELLED); - rc = RTSemEventWait(mEventSem, msTimeout ? msTimeout : RT_INDEFINITE_WAIT); - if ( RT_SUCCESS(rc) + vrc = RTSemEventWait(mEventSem, msTimeout ? msTimeout : RT_INDEFINITE_WAIT); + if ( RT_SUCCESS(vrc) && mfAborted) - { - rc = VERR_CANCELLED; - } + vrc = VERR_CANCELLED; - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { /* If waiting succeeded, return the overall * result code. */ - rc = mRc; + vrc = mVrc; } } - - return rc; + else + vrc = VERR_CANCELLED; + return vrc; } GuestWaitEvent::GuestWaitEvent(void) @@ -1700,13 +1688,11 @@ int GuestWaitEvent::Init(uint32_t uCID) */ int GuestWaitEvent::Init(uint32_t uCID, const GuestEventTypes &lstEvents) { - int rc = GuestWaitEventBase::Init(uCID); - if (RT_SUCCESS(rc)) - { + int vrc = GuestWaitEventBase::Init(uCID); + if (RT_SUCCESS(vrc)) mEventTypes = lstEvents; - } - return rc; + return vrc; } /** diff --git a/src/VBox/Main/src-client/GuestDirectoryImpl.cpp b/src/VBox/Main/src-client/GuestDirectoryImpl.cpp index 49f030f670e..5f20dfd0e1d 100644 --- a/src/VBox/Main/src-client/GuestDirectoryImpl.cpp +++ b/src/VBox/Main/src-client/GuestDirectoryImpl.cpp @@ -112,7 +112,7 @@ int GuestDirectory::init(Console *pConsole, GuestSession *pSession, ULONG aObjec * Start the process synchronously and keep it around so that we can use * it later in subsequent read() calls. */ - vrc = mData.mProcessTool.init(mSession, procInfo, false /* Async */, NULL /* Guest rc */); + vrc = mData.mProcessTool.init(mSession, procInfo, false /*fAsync*/, NULL /*pvrcGuest*/); if (RT_SUCCESS(vrc)) { /* As we need to know if the directory we were about to open exists and and is accessible, @@ -243,23 +243,23 @@ int GuestDirectory::i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGU * Converts a given guest directory error to a string. * * @returns Error string. - * @param rcGuest Guest file error to return string for. + * @param vrcGuest Guest file error to return string for. * @param pcszWhat Hint of what was involved when the error occurred. */ /* static */ -Utf8Str GuestDirectory::i_guestErrorToString(int rcGuest, const char *pcszWhat) +Utf8Str GuestDirectory::i_guestErrorToString(int vrcGuest, const char *pcszWhat) { AssertPtrReturn(pcszWhat, ""); Utf8Str strErr; - switch (rcGuest) + switch (vrcGuest) { #define CASE_MSG(a_iRc, ...) \ case a_iRc: strErr.printf(__VA_ARGS__); break; CASE_MSG(VERR_CANT_CREATE , tr("Access to guest directory \"%s\" is denied"), pcszWhat); CASE_MSG(VERR_DIR_NOT_EMPTY, tr("Guest directory \"%s\" is not empty"), pcszWhat); default: - strErr.printf(tr("Error %Rrc for guest directory \"%s\" occurred\n"), rcGuest, pcszWhat); + strErr.printf(tr("Error %Rrc for guest directory \"%s\" occurred\n"), vrcGuest, pcszWhat); break; } diff --git a/src/VBox/Main/src-client/GuestProcessImpl.cpp b/src/VBox/Main/src-client/GuestProcessImpl.cpp index a0cbfab4dc4..bc9a6538c33 100644 --- a/src/VBox/Main/src-client/GuestProcessImpl.cpp +++ b/src/VBox/Main/src-client/GuestProcessImpl.cpp @@ -222,18 +222,18 @@ int GuestProcess::init(Console *aConsole, GuestSession *aSession, ULONG aObjectI AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED); - HRESULT hr; + HRESULT hrc; int vrc = bindToSession(aConsole, aSession, aObjectID); if (RT_SUCCESS(vrc)) { - hr = unconst(mEventSource).createObject(); - if (FAILED(hr)) + hrc = unconst(mEventSource).createObject(); + if (FAILED(hrc)) vrc = VERR_NO_MEMORY; else { - hr = mEventSource->init(); - if (FAILED(hr)) + hrc = mEventSource->init(); + if (FAILED(hrc)) vrc = VERR_COM_UNEXPECTED; } } @@ -244,20 +244,20 @@ int GuestProcess::init(Console *aConsole, GuestSession *aSession, ULONG aObjectI { GuestProcessListener *pListener = new GuestProcessListener(); ComObjPtr<GuestProcessListenerImpl> thisListener; - hr = thisListener.createObject(); - if (SUCCEEDED(hr)) - hr = thisListener->init(pListener, this); + hrc = thisListener.createObject(); + if (SUCCEEDED(hrc)) + hrc = thisListener->init(pListener, this); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hrc)) { com::SafeArray <VBoxEventType_T> eventTypes; eventTypes.push_back(VBoxEventType_OnGuestProcessStateChanged); eventTypes.push_back(VBoxEventType_OnGuestProcessInputNotify); eventTypes.push_back(VBoxEventType_OnGuestProcessOutput); - hr = mEventSource->RegisterListener(thisListener, + hrc = mEventSource->RegisterListener(thisListener, ComSafeArrayAsInParam(eventTypes), TRUE /* Active listener */); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hrc)) { vrc = baseInit(); if (RT_SUCCESS(vrc)) @@ -540,16 +540,16 @@ ProcessStatus_T GuestProcess::i_getStatus(void) * Converts a given guest process error to a string. * * @returns Error as a string. - * @param rcGuest Guest process error to return string for. - * @param pcszWhat Hint of what was involved when the error occurred. + * @param vrcGuest Guest process error to return string for. + * @param pcszWhat Hint of what was involved when the error occurred. */ /* static */ -Utf8Str GuestProcess::i_guestErrorToString(int rcGuest, const char *pcszWhat) +Utf8Str GuestProcess::i_guestErrorToString(int vrcGuest, const char *pcszWhat) { AssertPtrReturn(pcszWhat, ""); Utf8Str strErr; - switch (rcGuest) + switch (vrcGuest) { #define CASE_MSG(a_iRc, ...) \ case a_iRc: strErr.printf(__VA_ARGS__); break; @@ -566,7 +566,7 @@ Utf8Str GuestProcess::i_guestErrorToString(int rcGuest, const char *pcszWhat) CASE_MSG(VERR_GSTCTL_MAX_CID_OBJECTS_REACHED, tr("Maximum number of concurrent guest processes has been reached")); CASE_MSG(VERR_NOT_FOUND, tr("The guest execution service is not ready (yet)")); default: - strErr.printf(tr("Error %Rrc for guest process \"%s\" occurred\n"), rcGuest, pcszWhat); + strErr.printf(tr("Error %Rrc for guest process \"%s\" occurred\n"), vrcGuest, pcszWhat); break; #undef CASE_MSG } @@ -621,13 +621,13 @@ Utf8Str GuestProcess::i_statusToString(ProcessStatus_T enmStatus) * * @return bool @c true if the passed in error code indicates an error which came * from the guest side, or @c false if not. - * @param rc Error code to check. + * @param vrc Error code to check. */ /* static */ -bool GuestProcess::i_isGuestError(int rc) +bool GuestProcess::i_isGuestError(int vrc) { - return ( rc == VERR_GSTCTL_GUEST_ERROR - || rc == VERR_GSTCTL_PROCESS_EXIT_CODE); + return vrc == VERR_GSTCTL_GUEST_ERROR + || vrc == VERR_GSTCTL_PROCESS_EXIT_CODE; } /** @@ -637,9 +637,9 @@ bool GuestProcess::i_isGuestError(int rc) */ inline bool GuestProcess::i_isAlive(void) { - return ( mData.mStatus == ProcessStatus_Started - || mData.mStatus == ProcessStatus_Paused - || mData.mStatus == ProcessStatus_Terminating); + return mData.mStatus == ProcessStatus_Started + || mData.mStatus == ProcessStatus_Paused + || mData.mStatus == ProcessStatus_Terminating; } /** @@ -649,13 +649,13 @@ inline bool GuestProcess::i_isAlive(void) */ inline bool GuestProcess::i_hasEnded(void) { - return ( mData.mStatus == ProcessStatus_TerminatedNormally - || mData.mStatus == ProcessStatus_TerminatedSignal - || mData.mStatus == ProcessStatus_TerminatedAbnormally - || mData.mStatus == ProcessStatus_TimedOutKilled - || mData.mStatus == ProcessStatus_TimedOutAbnormally - || mData.mStatus == ProcessStatus_Down - || mData.mStatus == ProcessStatus_Error); + return mData.mStatus == ProcessStatus_TerminatedNormally + || mData.mStatus == ProcessStatus_TerminatedSignal + || mData.mStatus == ProcessStatus_TerminatedAbnormally + || mData.mStatus == ProcessStatus_TimedOutKilled + || mData.mStatus == ProcessStatus_TimedOutAbnormally + || mData.mStatus == ProcessStatus_Down + || mData.mStatus == ProcessStatus_Error; } /** @@ -801,7 +801,7 @@ int GuestProcess::i_onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXG if (RT_SUCCESS(vrc)) { ProcessStatus_T procStatus = ProcessStatus_Undefined; - int procRc = VINF_SUCCESS; + int vrcProc = VINF_SUCCESS; switch (dataCb.uStatus) { @@ -858,7 +858,7 @@ int GuestProcess::i_onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXG case PROC_STS_ERROR: { - procRc = dataCb.uFlags; /* mFlags contains the IPRT error sent from the guest. */ + vrcProc = dataCb.uFlags; /* mFlags contains the IPRT error sent from the guest. */ procStatus = ProcessStatus_Error; break; } @@ -872,11 +872,10 @@ int GuestProcess::i_onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXG } } - LogFlowThisFunc(("Got rc=%Rrc, procSts=%RU32, procRc=%Rrc\n", - vrc, procStatus, procRc)); + LogFlowThisFunc(("Got vrc=%Rrc, procSts=%RU32, vrcProc=%Rrc\n", vrc, procStatus, vrcProc)); /* Set the process status. */ - int vrc2 = i_setProcessStatus(procStatus, procRc); + int vrc2 = i_setProcessStatus(procStatus, vrcProc); if (RT_SUCCESS(vrc)) vrc = vrc2; } @@ -971,7 +970,7 @@ int GuestProcess::i_onSessionStatusChange(GuestSessionStatus_T enmSessionStatus) { AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - vrc = i_setProcessStatus(ProcessStatus_Down, 0 /* rc, ignored */); + vrc = i_setProcessStatus(ProcessStatus_Down, VINF_SUCCESS /* vrcProc, ignored */); } LogFlowFuncLeaveRC(vrc); @@ -990,16 +989,16 @@ int GuestProcess::i_onSessionStatusChange(GuestSessionStatus_T enmSessionStatus) * @param cbData Size (in bytes) of \a pvData on input. * @param pcbRead Where to return to size (in bytes) read on success. * Optional. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, - void *pvData, size_t cbData, uint32_t *pcbRead, int *prcGuest) + void *pvData, size_t cbData, uint32_t *pcbRead, int *pvrcGuest) { - LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, prcGuest=%p\n", - mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, prcGuest)); + LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, pvrcGuest=%p\n", + mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, pvrcGuest)); AssertReturn(uSize, VERR_INVALID_PARAMETER); AssertPtrReturn(pvData, VERR_INVALID_POINTER); AssertReturn(cbData >= uSize, VERR_INVALID_PARAMETER); @@ -1019,8 +1018,8 @@ int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeout { if (pcbRead) *pcbRead = 0; - if (prcGuest) - *prcGuest = VINF_SUCCESS; + if (pvrcGuest) + *pvrcGuest = VINF_SUCCESS; return VINF_SUCCESS; /* Nothing to read anymore. */ } @@ -1080,35 +1079,34 @@ int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeout * * @returns VBox status code. * @param procStatus Guest process status to set. - * @param procRc Guest process result code to set. + * @param vrcProc Guest process result code to set. * * @note Takes the write lock. */ -int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int procRc) +int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int vrcProc) { LogFlowThisFuncEnter(); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, procRc=%Rrc\n", - mData.mStatus, procStatus, procRc)); + LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, vrcProc=%Rrc\n", mData.mStatus, procStatus, vrcProc)); if (procStatus == ProcessStatus_Error) { - AssertMsg(RT_FAILURE(procRc), ("Guest rc must be an error (%Rrc)\n", procRc)); + AssertMsg(RT_FAILURE(vrcProc), ("Guest vrcProc must be an error (%Rrc)\n", vrcProc)); /* Do not allow overwriting an already set error. If this happens * this means we forgot some error checking/locking somewhere. */ - AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest rc already set (to %Rrc)\n", mData.mLastError)); + AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest vrcProc already set (to %Rrc)\n", mData.mLastError)); } else - AssertMsg(RT_SUCCESS(procRc), ("Guest rc must not be an error (%Rrc)\n", procRc)); + AssertMsg(RT_SUCCESS(vrcProc), ("Guest vrcProc must not be an error (%Rrc)\n", vrcProc)); int vrc = VINF_SUCCESS; if (mData.mStatus != procStatus) /* Was there a process status change? */ { mData.mStatus = procStatus; - mData.mLastError = procRc; + mData.mLastError = vrcProc; ComObjPtr<VirtualBoxErrorInfo> errorInfo; HRESULT hrc = errorInfo.createObject(); @@ -1152,12 +1150,12 @@ int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int procRc) * * @returns VBox status code. * @param cMsTimeout Timeout (in ms) to wait for starting the process. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ -int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *prcGuest) +int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *pvrcGuest) { LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n", cMsTimeout, mData.mProcess.mExecutable.c_str(), mData.mProcess.mTimeoutMS, mData.mProcess.mFlags, @@ -1185,7 +1183,7 @@ int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *prcGuest) if (RT_FAILURE(vrc)) return vrc; - vrc = i_startProcessInner(cMsTimeout, alock, pEvent, prcGuest); + vrc = i_startProcessInner(cMsTimeout, alock, pEvent, pvrcGuest); unregisterWaitEvent(pEvent); @@ -1200,10 +1198,10 @@ int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *prcGuest) * @param cMsTimeout Timeout (in ms) to wait for starting the process. * @param rLock Write lock to use for serialization. * @param pEvent Event to use for notifying waiters. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *prcGuest) +int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pvrcGuest) { GuestSession *pSession = mSession; AssertPtr(pSession); @@ -1317,8 +1315,7 @@ int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, RTStrFree(pszArgs); if (RT_SUCCESS(vrc)) - vrc = i_waitForStatusChange(pEvent, cMsTimeout, - NULL /* Process status */, prcGuest); + vrc = i_waitForStatusChange(pEvent, cMsTimeout, NULL /* Process status */, pvrcGuest); return vrc; } @@ -1372,7 +1369,7 @@ int GuestProcess::i_startProcessThreadTask(GuestProcessStartTask *pTask) if (FAILED(autoCaller.hrc())) return VERR_COM_UNEXPECTED; - int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, NULL /* Guest rc, ignored */); + int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, NULL /* pvrcGuest, ignored */); /* Nothing to do here anymore. */ LogFlowFunc(("pProcess=%p, vrc=%Rrc\n", (GuestProcess *)pProcess, vrc)); @@ -1386,14 +1383,13 @@ int GuestProcess::i_startProcessThreadTask(GuestProcessStartTask *pTask) * @retval VWRN_INVALID_STATE if process not in running state (anymore). * @retval VERR_NOT_SUPPORTED if process termination is not supported on the guest. * @param uTimeoutMS Timeout (in ms) to wait for process termination. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ -int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *prcGuest) +int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *pvrcGuest) { - /* prcGuest is optional. */ LogFlowThisFunc(("uTimeoutMS=%RU32\n", uTimeoutMS)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -1442,7 +1438,7 @@ int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *prcGuest) vrc = sendMessage(HOST_MSG_EXEC_TERMINATE, i, paParms); if (RT_SUCCESS(vrc)) vrc = i_waitForStatusChange(pEvent, uTimeoutMS, - NULL /* ProcessStatus */, prcGuest); + NULL /* ProcessStatus */, pvrcGuest); unregisterWaitEvent(pEvent); } } @@ -1590,19 +1586,18 @@ ProcessWaitResult_T GuestProcess::i_waitFlagsToResult(uint32_t fWaitFlags) * @param fWaitFlags Process wait flags to wait for. * @param uTimeoutMS Timeout (in ms) to wait. * @param waitResult Where to return the process wait result on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * @note Takes the read lock. */ -int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, - ProcessWaitResult_T &waitResult, int *prcGuest) +int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pvrcGuest) { AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, prcGuest=%p\n", - fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, prcGuest)); + LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, vrcProc=%Rrc, pvrcGuest=%p\n", + fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, pvrcGuest)); /* Did some error occur before? Then skip waiting and return. */ ProcessStatus_T curStatus = mData.mStatus; @@ -1610,10 +1605,10 @@ int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, { waitResult = ProcessWaitResult_Error; AssertMsg(RT_FAILURE(mData.mLastError), - ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError)); - if (prcGuest) - *prcGuest = mData.mLastError; /* Return last set error. */ - LogFlowThisFunc(("Process is in error state (rcGuest=%Rrc)\n", mData.mLastError)); + ("No error vrc (%Rrc) set when guest process indicated an error\n", mData.mLastError)); + if (pvrcGuest) + *pvrcGuest = mData.mLastError; /* Return last set error. */ + LogFlowThisFunc(("Process is in error state (vrcGuest=%Rrc)\n", mData.mLastError)); return VERR_GSTCTL_GUEST_ERROR; } @@ -1622,9 +1617,9 @@ int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, /* No waiting needed? Return immediately using the last set error. */ if (waitResult != ProcessWaitResult_None) { - if (prcGuest) - *prcGuest = mData.mLastError; /* Return last set error (if any). */ - LogFlowThisFunc(("Nothing to wait for (rcGuest=%Rrc)\n", mData.mLastError)); + if (pvrcGuest) + *pvrcGuest = mData.mLastError; /* Return last set error (if any). */ + LogFlowThisFunc(("Nothing to wait for (vrcGuest=%Rrc)\n", mData.mLastError)); return RT_SUCCESS(mData.mLastError) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; } @@ -1668,9 +1663,8 @@ int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, } vrc = i_waitForStatusChange(pEvent, - uTimeoutMS == RT_INDEFINITE_WAIT - ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS, - &newStatus, prcGuest); + uTimeoutMS == RT_INDEFINITE_WAIT ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS, + &newStatus, pvrcGuest); if (RT_SUCCESS(vrc)) { alock.acquire(); @@ -1692,8 +1686,7 @@ int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, unregisterWaitEvent(pEvent); - LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, rc=%Rrc\n", - waitResult, newStatus, vrc)); + LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, vrc=%Rrc\n", waitResult, newStatus, vrc)); return vrc; } @@ -1725,21 +1718,20 @@ int GuestProcess::i_waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, if (pInputStatus) { - HRESULT hr2 = pProcessEvent->COMGETTER(Status)(pInputStatus); - ComAssertComRC(hr2); + HRESULT hrc2 = pProcessEvent->COMGETTER(Status)(pInputStatus); + ComAssertComRC(hrc2); } if (pcbProcessed) { - HRESULT hr2 = pProcessEvent->COMGETTER(Processed)((ULONG*)pcbProcessed); - ComAssertComRC(hr2); + HRESULT hrc2 = pProcessEvent->COMGETTER(Processed)((ULONG*)pcbProcessed); + ComAssertComRC(hrc2); } } else vrc = VWRN_GSTCTL_OBJECTSTATE_CHANGED; } - LogFlowThisFunc(("Returning pEvent=%p, uHandle=%RU32, rc=%Rrc\n", - pEvent, uHandle, vrc)); + LogFlowThisFunc(("Returning pEvent=%p, uHandle=%RU32, vrc=%Rrc\n", pEvent, uHandle, vrc)); return vrc; } @@ -1781,15 +1773,15 @@ int GuestProcess::i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint Assert(!pProcessEvent.isNull()); ULONG uHandleEvent; - HRESULT hr = pProcessEvent->COMGETTER(Handle)(&uHandleEvent); - if ( SUCCEEDED(hr) + HRESULT hrc = pProcessEvent->COMGETTER(Handle)(&uHandleEvent); + if ( SUCCEEDED(hrc) && uHandleEvent == uHandle) { if (pvData) { com::SafeArray <BYTE> data; - hr = pProcessEvent->COMGETTER(Data)(ComSafeArrayAsOutParam(data)); - ComAssertComRC(hr); + hrc = pProcessEvent->COMGETTER(Data)(ComSafeArrayAsOutParam(data)); + ComAssertComRC(hrc); size_t cbRead = data.size(); if (cbRead) { @@ -1801,8 +1793,7 @@ int GuestProcess::i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint else vrc = VERR_BUFFER_OVERFLOW; - LogFlowThisFunc(("Read %zu bytes (uHandle=%RU32), rc=%Rrc\n", - cbRead, uHandleEvent, vrc)); + LogFlowThisFunc(("Read %zu bytes (uHandle=%RU32), vrc=%Rrc\n", cbRead, uHandleEvent, vrc)); } } @@ -1810,14 +1801,14 @@ int GuestProcess::i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint && pcbRead) { ULONG cbRead; - hr = pProcessEvent->COMGETTER(Processed)(&cbRead); - ComAssertComRC(hr); + hrc = pProcessEvent->COMGETTER(Processed)(&cbRead); + ComAssertComRC(hrc); *pcbRead = (uint32_t)cbRead; } break; } - else if (FAILED(hr)) + else if (FAILED(hrc)) vrc = VERR_COM_UNEXPECTED; } else @@ -1844,15 +1835,15 @@ int GuestProcess::i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint * @param pEvent Guest wait event to wait for. * @param uTimeoutMS Timeout (in ms) to wait. * @param pProcessStatus Where to return the process status on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. */ int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, - ProcessStatus_T *pProcessStatus, int *prcGuest) + ProcessStatus_T *pProcessStatus, int *pvrcGuest) { AssertPtrReturn(pEvent, VERR_INVALID_POINTER); /* pProcessStatus is optional. */ - /* prcGuest is optional. */ + /* pvrcGuest is optional. */ VBoxEventType_T evtType; ComPtr<IEvent> pIEvent; @@ -1865,32 +1856,31 @@ int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeou Assert(!pProcessEvent.isNull()); ProcessStatus_T procStatus; - HRESULT hr = pProcessEvent->COMGETTER(Status)(&procStatus); - ComAssertComRC(hr); + HRESULT hrc = pProcessEvent->COMGETTER(Status)(&procStatus); + ComAssertComRC(hrc); if (pProcessStatus) *pProcessStatus = procStatus; ComPtr<IVirtualBoxErrorInfo> errorInfo; - hr = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam()); - ComAssertComRC(hr); + hrc = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam()); + ComAssertComRC(hrc); LONG lGuestRc; - hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); - ComAssertComRC(hr); + hrc = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); + ComAssertComRC(hrc); - LogFlowThisFunc(("Got procStatus=%RU32, rcGuest=%RI32 (%Rrc)\n", - procStatus, lGuestRc, lGuestRc)); + LogFlowThisFunc(("Got procStatus=%RU32, vrcGuest=%RI32 (%Rrc)\n", procStatus, lGuestRc, lGuestRc)); if (RT_FAILURE((int)lGuestRc)) vrc = VERR_GSTCTL_GUEST_ERROR; - if (prcGuest) - *prcGuest = (int)lGuestRc; + if (pvrcGuest) + *pvrcGuest = (int)lGuestRc; } - /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make prcGuest is set. */ - else if (vrc == VERR_GSTCTL_GUEST_ERROR && prcGuest) - *prcGuest = pEvent->GuestResult(); - Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !prcGuest || *prcGuest != (int)0xcccccccc); + /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make pvrcGuest is set. */ + else if (vrc == VERR_GSTCTL_GUEST_ERROR && pvrcGuest) + *pvrcGuest = pEvent->GuestResult(); + Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !pvrcGuest || *pvrcGuest != (int)0xcccccccc); LogFlowFuncLeaveRC(vrc); return vrc; @@ -1940,16 +1930,16 @@ bool GuestProcess::i_waitResultImpliesEx(ProcessWaitResult_T waitResult, Process * @param cbData Size (in bytes) of \a pvData to write. * @param uTimeoutMS Timeout (in ms) to wait. * @param puWritten Where to return the size (in bytes) written. Optional. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags, - void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *prcGuest) + void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pvrcGuest) { - LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, prcGuest=%p\n", - mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, prcGuest)); + LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, pvrcGuest=%p\n", + mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, pvrcGuest)); /* All is optional. There can be 0 byte writes. */ AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -1957,8 +1947,8 @@ int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags, { if (puWritten) *puWritten = 0; - if (prcGuest) - *prcGuest = VINF_SUCCESS; + if (pvrcGuest) + *pvrcGuest = VINF_SUCCESS; return VINF_SUCCESS; /* Not available for writing (anymore). */ } @@ -2008,7 +1998,7 @@ int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags, &inputStatus, &cbProcessed); if (RT_SUCCESS(vrc)) { - /** @todo Set rcGuest. */ + /** @todo Set vrcGuest. */ if (puWritten) *puWritten = cbProcessed; @@ -2018,8 +2008,7 @@ int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags, unregisterWaitEvent(pEvent); - LogFlowThisFunc(("Returning cbProcessed=%RU32, rc=%Rrc\n", - cbProcessed, vrc)); + LogFlowThisFunc(("Returning cbProcessed=%RU32, vrc=%Rrc\n", cbProcessed, vrc)); return vrc; } @@ -2069,8 +2058,7 @@ HRESULT GuestProcess::read(ULONG aHandle, ULONG aToRead, ULONG aTimeoutMS, std:: } } - LogFlowThisFunc(("rc=%Rrc, cbRead=%RU32\n", vrc, cbRead)); - + LogFlowThisFunc(("vrc=%Rrc, cbRead=%RU32\n", vrc, cbRead)); LogFlowFuncLeaveRC(vrc); return hrc; } @@ -2242,7 +2230,7 @@ HRESULT GuestProcess::write(ULONG aHandle, ULONG aFlags, const std::vector<BYTE> } } - LogFlowThisFunc(("rc=%Rrc, aWritten=%RU32\n", vrc, cbWritten)); + LogFlowThisFunc(("vrc=%Rrc, aWritten=%RU32\n", vrc, cbWritten)); *aWritten = (ULONG)cbWritten; @@ -2282,11 +2270,11 @@ GuestProcessTool::~GuestProcessTool(void) * @param pGuestSession Guest session the process tools should be started in. * @param startupInfo Guest process startup info to use for starting. * @param fAsync Whether to start asynchronously or not. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ int GuestProcessTool::init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, - bool fAsync, int *prcGuest) + bool fAsync, int *pvrcGuest) { LogFlowThisFunc(("pGuestSession=%p, exe=%s, fAsync=%RTbool\n", pGuestSession, startupInfo.mExecutable.c_str(), fAsync)); @@ -2316,8 +2304,8 @@ int GuestProcessTool::init(GuestSession *pGuestSession, const GuestProcessStartu vrc = VERR_GSTCTL_GUEST_ERROR; } - if (prcGuest) - *prcGuest = vrcGuest; + if (pvrcGuest) + *pvrcGuest = vrcGuest; } LogFlowFuncLeaveRC(vrc); @@ -2372,8 +2360,7 @@ int GuestProcessTool::getCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock break; } while (RT_SUCCESS(vrc)); - LogFlowThisFunc(("rc=%Rrc, %RU64 pairs\n", - vrc, strmBlock.GetCount())); + LogFlowThisFunc(("vrc=%Rrc, %RU64 pairs\n", vrc, strmBlock.GetCount())); return vrc; } @@ -2385,8 +2372,8 @@ int GuestProcessTool::getCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock int GuestProcessTool::getRc(void) const { LONG exitCode = -1; - HRESULT hr = pProcess->COMGETTER(ExitCode(&exitCode)); - AssertComRC(hr); + HRESULT hrc = pProcess->COMGETTER(ExitCode(&exitCode)); + AssertComRC(hrc); return GuestProcessTool::exitCodeToRc(mStartupInfo, exitCode); } @@ -2401,8 +2388,8 @@ bool GuestProcessTool::isRunning(void) AssertReturn(!pProcess.isNull(), false); ProcessStatus_T procStatus = ProcessStatus_Undefined; - HRESULT hr = pProcess->COMGETTER(Status(&procStatus)); - AssertComRC(hr); + HRESULT hrc = pProcess->COMGETTER(Status(&procStatus)); + AssertComRC(hrc); if ( procStatus == ProcessStatus_Started || procStatus == ProcessStatus_Paused @@ -2451,12 +2438,12 @@ int GuestProcessTool::run( GuestSession *pGuestSession, if (RT_SUCCESS(vrc)) { /* Make sure to check the error information we got from the guest tool. */ - if (GuestProcess::i_isGuestError(errorInfo.rcGuest)) + if (GuestProcess::i_isGuestError(errorInfo.vrcGuest)) { - if (errorInfo.rcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */ + if (errorInfo.vrcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */ vrcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode); else /* At least return something. */ - vrcGuest = errorInfo.rcGuest; + vrcGuest = errorInfo.vrcGuest; if (pvrcGuest) *pvrcGuest = vrcGuest; @@ -2465,7 +2452,7 @@ int GuestProcessTool::run( GuestSession *pGuestSession, } } - LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode)); + LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode)); return vrc; } @@ -2479,12 +2466,11 @@ int GuestProcessTool::run( GuestSession *pGuestSession, * @param errorInfo Error information returned for error handling. */ /* static */ -int GuestProcessTool::runErrorInfo( GuestSession *pGuestSession, - const GuestProcessStartupInfo &startupInfo, - GuestProcessToolErrorInfo &errorInfo) +int GuestProcessTool::runErrorInfo(GuestSession *pGuestSession, + GuestProcessStartupInfo const &startupInfo, + GuestProcessToolErrorInfo &errorInfo) { - return runExErrorInfo(pGuestSession, startupInfo, - NULL /* paStrmOutObjects */, 0 /* cStrmOutObjects */, errorInfo); + return runExErrorInfo(pGuestSession, startupInfo, NULL /* paStrmOutObjects */, 0 /* cStrmOutObjects */, errorInfo); } /** @@ -2499,11 +2485,11 @@ int GuestProcessTool::runErrorInfo( GuestSession *pGuestSessio * @param pvrcGuest Error code returned from the guest side if VERR_GSTCTL_GUEST_ERROR is returned. Optional. */ /* static */ -int GuestProcessTool::runEx( GuestSession *pGuestSession, - const GuestProcessStartupInfo &startupInfo, - GuestCtrlStreamObjects *paStrmOutObjects, - uint32_t cStrmOutObjects, - int *pvrcGuest /* = NULL */) +int GuestProcessTool::runEx(GuestSession *pGuestSession, + GuestProcessStartupInfo const &startupInfo, + GuestCtrlStreamObjects *paStrmOutObjects, + uint32_t cStrmOutObjects, + int *pvrcGuest /* = NULL */) { int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; @@ -2512,12 +2498,12 @@ int GuestProcessTool::runEx( GuestSession *pGuestSession, if (RT_SUCCESS(vrc)) { /* Make sure to check the error information we got from the guest tool. */ - if (GuestProcess::i_isGuestError(errorInfo.rcGuest)) + if (GuestProcess::i_isGuestError(errorInfo.vrcGuest)) { - if (errorInfo.rcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */ + if (errorInfo.vrcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */ vrcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode); else /* At least return something. */ - vrcGuest = errorInfo.rcGuest; + vrcGuest = errorInfo.vrcGuest; if (pvrcGuest) *pvrcGuest = vrcGuest; @@ -2526,7 +2512,7 @@ int GuestProcessTool::runEx( GuestSession *pGuestSession, } } - LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode)); + LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode)); return vrc; } @@ -2546,11 +2532,11 @@ int GuestProcessTool::runEx( GuestSession *pGuestSession, * @param errorInfo Error information returned for error handling. */ /* static */ -int GuestProcessTool::runExErrorInfo( GuestSession *pGuestSession, - const GuestProcessStartupInfo &startupInfo, - GuestCtrlStreamObjects *paStrmOutObjects, - uint32_t cStrmOutObjects, - GuestProcessToolErrorInfo &errorInfo) +int GuestProcessTool::runExErrorInfo(GuestSession *pGuestSession, + GuestProcessStartupInfo const &startupInfo, + GuestCtrlStreamObjects *paStrmOutObjects, + uint32_t cStrmOutObjects, + GuestProcessToolErrorInfo &errorInfo) { AssertPtrReturn(pGuestSession, VERR_INVALID_POINTER); /* paStrmOutObjects is optional. */ @@ -2558,7 +2544,7 @@ int GuestProcessTool::runExErrorInfo( GuestSession *pGuestSess /** @todo Check if this is a valid toolbox. */ GuestProcessTool procTool; - int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.rcGuest); + int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.vrcGuest); if (RT_SUCCESS(vrc)) { while (cStrmOutObjects--) @@ -2568,7 +2554,7 @@ int GuestProcessTool::runExErrorInfo( GuestSession *pGuestSess GuestProcessStreamBlock strmBlk; vrc = procTool.waitEx( paStrmOutObjects ? GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK - : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.rcGuest); + : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.vrcGuest); if (paStrmOutObjects) paStrmOutObjects->push_back(strmBlk); } @@ -2585,12 +2571,12 @@ int GuestProcessTool::runExErrorInfo( GuestSession *pGuestSess if (RT_SUCCESS(vrc)) { /* Make sure the process runs until completion. */ - vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.rcGuest); + vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.vrcGuest); if (RT_SUCCESS(vrc)) - errorInfo.rcGuest = procTool.getTerminationStatus(&errorInfo.iExitCode); + errorInfo.vrcGuest = procTool.getTerminationStatus(&errorInfo.iExitCode); } - LogFlowFunc(("Returned rc=%Rrc, rcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode)); + LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode)); return vrc; } @@ -2612,8 +2598,8 @@ int GuestProcessTool::getTerminationStatus(int32_t *piExitCode /* = NULL */) if (!isRunning()) { LONG iExitCode = -1; - HRESULT hr = pProcess->COMGETTER(ExitCode(&iExitCode)); - AssertComRC(hr); + HRESULT hrc = pProcess->COMGETTER(ExitCode(&iExitCode)); + AssertComRC(hrc); if (piExitCode) *piExitCode = iExitCode; @@ -2632,12 +2618,12 @@ int GuestProcessTool::getTerminationStatus(int32_t *piExitCode /* = NULL */) * * @returns VBox status code. * @param fToolWaitFlags Guest process tool wait flags to use for waiting. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *prcGuest) +int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *pvrcGuest) { - return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, prcGuest); + return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, pvrcGuest); } /** @@ -2646,12 +2632,12 @@ int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *prcGuest) * @returns VBox status code. * @param fToolWaitFlags Guest process tool wait flags to use for waiting. * @param pStrmBlkOut Where to store the guest process output. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *prcGuest) +int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pvrcGuest) { - LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, prcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, prcGuest)); + LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, pvrcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, pvrcGuest)); /* Can we parse the next block without waiting? */ int vrc; @@ -2735,7 +2721,7 @@ int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *p fHandleStdErr = true; /* Since waiting for stdout / stderr is not supported by the guest, * wait a bit to not hog the CPU too much when polling for data. */ - RTThreadSleep(1); /* Optional, don't check rc. */ + RTThreadSleep(1); /* Optional, don't check vrc. */ break; case ProcessWaitResult_Error: @@ -2827,10 +2813,9 @@ int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *p if (RT_FAILURE(vrcGuest)) vrc = VERR_GSTCTL_GUEST_ERROR; - LogFlowThisFunc(("Loop ended with rc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n", - vrc, vrcGuest, waitRes)); - if (prcGuest) - *prcGuest = vrcGuest; + LogFlowThisFunc(("Loop ended with vrc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n", vrc, vrcGuest, waitRes)); + if (pvrcGuest) + *pvrcGuest = vrcGuest; LogFlowFuncLeaveRC(vrc); return vrc; @@ -2841,16 +2826,16 @@ int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *p * * @returns VBox status code. * @param uTimeoutMS Timeout (in ms) to wait. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *prcGuest) +int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *pvrcGuest) { LogFlowThisFuncEnter(); int vrc; if (!pProcess.isNull()) - vrc = pProcess->i_terminateProcess(uTimeoutMS, prcGuest); + vrc = pProcess->i_terminateProcess(uTimeoutMS, pvrcGuest); else vrc = VERR_NOT_FOUND; @@ -2972,7 +2957,7 @@ Utf8Str GuestProcessTool::guestErrorToString(const char *pszTool, const GuestErr Utf8Str strErr; /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ - switch (guestErrorInfo.getRc()) + switch (guestErrorInfo.getVrc()) { case VERR_ACCESS_DENIED: strErr.printf(tr("Access to \"%s\" denied"), guestErrorInfo.getWhat().c_str()); @@ -3022,7 +3007,7 @@ Utf8Str GuestProcessTool::guestErrorToString(const char *pszTool, const GuestErr default: strErr.printf(tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"), - guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str(), pszTool); + guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str(), pszTool); break; } diff --git a/src/VBox/Main/src-client/GuestSessionImpl.cpp b/src/VBox/Main/src-client/GuestSessionImpl.cpp index 7f43919be07..93b31712432 100644 --- a/src/VBox/Main/src-client/GuestSessionImpl.cpp +++ b/src/VBox/Main/src-client/GuestSessionImpl.cpp @@ -107,7 +107,8 @@ public: void handler() { - /* Ignore rc */ GuestSession::i_startSessionThreadTask(this); + /* Ignore return code */ + GuestSession::i_startSessionThreadTask(this); } }; @@ -146,11 +147,10 @@ public: case VBoxEventType_OnGuestSessionStateChanged: { AssertPtrReturn(mSession, E_POINTER); - int rc2 = mSession->signalWaitEvent(aType, aEvent); - RT_NOREF(rc2); + int vrc2 = mSession->signalWaitEvent(aType, aEvent); + RT_NOREF(vrc2); #ifdef DEBUG_andy - LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in rc=%Rrc\n", - aType, mSession, rc2)); + LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in vrc2=%Rrc\n", aType, mSession, vrc2)); #endif break; } @@ -244,46 +244,46 @@ int GuestSession::init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, * distinguish callbacks which are for this session directly, or for * objects (like files, directories, ...) which are bound to this session. */ - int rc = i_objectRegister(NULL /* pObject */, SESSIONOBJECTTYPE_SESSION, &mData.mObjectID); - if (RT_SUCCESS(rc)) + int vrc = i_objectRegister(NULL /* pObject */, SESSIONOBJECTTYPE_SESSION, &mData.mObjectID); + if (RT_SUCCESS(vrc)) { - rc = mData.mEnvironmentChanges.initChangeRecord(pGuest->i_isGuestInWindowsNtFamily() - ? RTENV_CREATE_F_ALLOW_EQUAL_FIRST_IN_VAR : 0); - if (RT_SUCCESS(rc)) + vrc = mData.mEnvironmentChanges.initChangeRecord(pGuest->i_isGuestInWindowsNtFamily() + ? RTENV_CREATE_F_ALLOW_EQUAL_FIRST_IN_VAR : 0); + if (RT_SUCCESS(vrc)) { - rc = RTCritSectInit(&mWaitEventCritSect); - AssertRC(rc); + vrc = RTCritSectInit(&mWaitEventCritSect); + AssertRC(vrc); } } - if (RT_SUCCESS(rc)) - rc = i_determineProtocolVersion(); + if (RT_SUCCESS(vrc)) + vrc = i_determineProtocolVersion(); - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { /* * <Replace this if you figure out what the code is doing.> */ - HRESULT hr = unconst(mEventSource).createObject(); - if (SUCCEEDED(hr)) - hr = mEventSource->init(); - if (SUCCEEDED(hr)) + HRESULT hrc = unconst(mEventSource).createObject(); + if (SUCCEEDED(hrc)) + hrc = mEventSource->init(); + if (SUCCEEDED(hrc)) { try { GuestSessionListener *pListener = new GuestSessionListener(); ComObjPtr<GuestSessionListenerImpl> thisListener; - hr = thisListener.createObject(); - if (SUCCEEDED(hr)) - hr = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */ - if (SUCCEEDED(hr)) + hrc = thisListener.createObject(); + if (SUCCEEDED(hrc)) + hrc = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */ + if (SUCCEEDED(hrc)) { com::SafeArray <VBoxEventType_T> eventTypes; eventTypes.push_back(VBoxEventType_OnGuestSessionStateChanged); - hr = mEventSource->RegisterListener(thisListener, - ComSafeArrayAsInParam(eventTypes), - TRUE /* Active listener */); - if (SUCCEEDED(hr)) + hrc = mEventSource->RegisterListener(thisListener, + ComSafeArrayAsInParam(eventTypes), + TRUE /* Active listener */); + if (SUCCEEDED(hrc)) { mLocalListener = thisListener; @@ -291,7 +291,7 @@ int GuestSession::init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, * Mark this object as operational and return success. */ autoInitSpan.setSucceeded(); - LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool rc=VINF_SUCCESS\n", + LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool vrc=VINF_SUCCESS\n", mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal)); return VINF_SUCCESS; } @@ -299,16 +299,16 @@ int GuestSession::init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, } catch (std::bad_alloc &) { - hr = E_OUTOFMEMORY; + hrc = E_OUTOFMEMORY; } } - rc = Global::vboxStatusCodeFromCOM(hr); + vrc = Global::vboxStatusCodeFromCOM(hrc); } autoInitSpan.setFailed(); - LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => rc=%Rrc\n", - mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, rc)); - return rc; + LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => vrc=%Rrc\n", + mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, vrc)); + return vrc; } /** @@ -545,78 +545,78 @@ HRESULT GuestSession::setCurrentDirectory(const com::Utf8Str &aCurrentDirectory) HRESULT GuestSession::getUserHome(com::Utf8Str &aUserHome) { - HRESULT hr = i_isStartedExternal(); - if (FAILED(hr)) - return hr; + HRESULT hrc = i_isStartedExternal(); + if (FAILED(hrc)) + return hrc; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_pathUserHome(aUserHome, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_pathUserHome(aUserHome, &vrcGuest); if (RT_FAILURE(vrc)) { switch (vrc) { case VERR_GSTCTL_GUEST_ERROR: { - switch (rcGuest) + switch (vrcGuest) { case VERR_NOT_SUPPORTED: - hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Getting the user's home path is not supported by installed Guest Additions")); break; default: - hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, - tr("Getting the user's home path failed on the guest: %Rrc"), rcGuest); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, + tr("Getting the user's home path failed on the guest: %Rrc"), vrcGuest); break; } break; } default: - hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc); break; } } - return hr; + return hrc; } HRESULT GuestSession::getUserDocuments(com::Utf8Str &aUserDocuments) { - HRESULT hr = i_isStartedExternal(); - if (FAILED(hr)) - return hr; + HRESULT hrc = i_isStartedExternal(); + if (FAILED(hrc)) + return hrc; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_pathUserDocuments(aUserDocuments, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_pathUserDocuments(aUserDocuments, &vrcGuest); if (RT_FAILURE(vrc)) { switch (vrc) { case VERR_GSTCTL_GUEST_ERROR: { - switch (rcGuest) + switch (vrcGuest) { case VERR_NOT_SUPPORTED: - hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Getting the user's documents path is not supported by installed Guest Additions")); break; default: - hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, - tr("Getting the user's documents path failed on the guest: %Rrc"), rcGuest); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, + tr("Getting the user's documents path failed on the guest: %Rrc"), vrcGuest); break; } break; } default: - hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc); break; } } - return hr; + return hrc; } HRESULT GuestSession::getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories) @@ -672,14 +672,14 @@ HRESULT GuestSession::getEventSource(ComPtr<IEventSource> &aEventSource) * @returns VBox status code. * @param uFlags Guest session close flags. * @param uTimeoutMS Timeout (in ms) to wait. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the read lock. */ -int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *prcGuest) +int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest) { - AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); + AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); LogFlowThisFunc(("uFlags=%x, uTimeoutMS=%RU32\n", uFlags, uTimeoutMS)); @@ -733,7 +733,7 @@ int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *prcG vrc = i_sendMessage(HOST_MSG_SESSION_CLOSE, i, paParms, VBOX_GUESTCTRL_DST_BOTH); if (RT_SUCCESS(vrc)) vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS, - NULL /* Session status */, prcGuest); + NULL /* Session status */, pvrcGuest); unregisterWaitEvent(pEvent); @@ -940,13 +940,12 @@ HRESULT GuestSession::i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, b * @param strPath Path on guest to directory to create. * @param uMode Creation mode to use (octal, 0777 max). * @param uFlags Directory creation flags to use. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, - uint32_t uFlags, int *prcGuest) +int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest) { - AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); + AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n", strPath.c_str(), uMode, uFlags)); @@ -992,7 +991,7 @@ int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, } if (RT_SUCCESS(vrc)) - vrc = GuestProcessTool::run(this, procInfo, prcGuest); + vrc = GuestProcessTool::run(this, procInfo, pvrcGuest); LogFlowFuncLeaveRC(vrc); return vrc; @@ -1007,10 +1006,9 @@ int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, bool GuestSession::i_directoryExists(const Utf8Str &strPath) { GuestFsObjData objDataIgnored; - int rcGuestIgnored; - int rc = i_directoryQueryInfo(strPath, true /* fFollowSymlinks */, objDataIgnored, &rcGuestIgnored); - - return RT_SUCCESS(rc); + int vrcGuestIgnored; + int const vrc = i_directoryQueryInfo(strPath, true /* fFollowSymlinks */, objDataIgnored, &vrcGuestIgnored); + return RT_SUCCESS(vrc); } /** @@ -1039,16 +1037,16 @@ inline bool GuestSession::i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDire * @param strPath Path to directory to query information for. * @param fFollowSymlinks Whether to follow symlinks or not. * @param objData Where to store the information returned on success. - * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. + * @param pvrcGuest Guest VBox status code, when returning + * VERR_GSTCTL_GUEST_ERROR. */ -int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, - GuestFsObjData &objData, int *prcGuest) +int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) { - AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); + AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); LogFlowThisFunc(("strPath=%s, fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); - int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, prcGuest); + int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest); if (RT_SUCCESS(vrc)) { vrc = objData.mType == FsObjType_Directory @@ -1079,9 +1077,9 @@ int GuestSession::i_directoryUnregister(GuestDirectory *pDirectory) LogFlowFunc(("Removing directory (objectID=%RU32) ...\n", idObject)); - int rc = i_objectUnregister(idObject); - if (RT_FAILURE(rc)) - return rc; + int vrc = i_objectUnregister(idObject); + if (RT_FAILURE(vrc)) + return vrc; SessionDirectories::iterator itDirs = mData.mDirectories.find(idObject); AssertReturn(itDirs != mData.mDirectories.end(), VERR_NOT_FOUND); @@ -1092,8 +1090,8 @@ int GuestSession::i_directoryUnregister(GuestDirectory *pDirectory) LogFlowFunc(("Removing directory ID=%RU32 (session %RU32, now total %zu directories)\n", idObject, mData.mSession.mID, mData.mDirectories.size())); - rc = pDirConsumed->i_onUnregister(); - AssertRCReturn(rc, rc); + vrc = pDirConsumed->i_onUnregister(); + AssertRCReturn(vrc, vrc); mData.mDirectories.erase(itDirs); @@ -1103,8 +1101,8 @@ int GuestSession::i_directoryUnregister(GuestDirectory *pDirectory) pDirConsumed.setNull(); - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -1113,15 +1111,15 @@ int GuestSession::i_directoryUnregister(GuestDirectory *pDirectory) * @returns VBox status code. * @param strPath Path of directory on guest to remove. * @param fFlags Directory remove flags to use. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the read lock. */ -int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *prcGuest) +int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest) { AssertReturn(!(fFlags & ~DIRREMOVEREC_FLAG_VALID_MASK), VERR_INVALID_PARAMETER); - AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); + AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); LogFlowThisFunc(("strPath=%s, uFlags=0x%x\n", strPath.c_str(), fFlags)); @@ -1147,8 +1145,8 @@ int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int { vrc = pEvent->Wait(30 * 1000); if ( vrc == VERR_GSTCTL_GUEST_ERROR - && prcGuest) - *prcGuest = pEvent->GuestResult(); + && pvrcGuest) + *pvrcGuest = pEvent->GuestResult(); } unregisterWaitEvent(pEvent); @@ -1170,12 +1168,13 @@ int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int * @param fMode File mode to use for creation (octal, umask-style). * Ignored when \a fSecure is specified. * @param fSecure Whether to perform a secure creation or not. - * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. + * @param pvrcGuest Guest VBox status code, when returning + * VERR_GSTCTL_GUEST_ERROR. */ int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName, - uint32_t fMode, bool fSecure, int *prcGuest) + uint32_t fMode, bool fSecure, int *pvrcGuest) { - AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); + AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); AssertReturn(fSecure || !(fMode & ~07777), VERR_INVALID_PARAMETER); LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool, fMode=%o, fSecure=%RTbool\n", @@ -1233,8 +1232,8 @@ int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strP if (RT_FAILURE(vrc)) { vrcGuest = vrc; - if (prcGuest) - *prcGuest = vrcGuest; + if (pvrcGuest) + *pvrcGuest = vrcGuest; vrc = VERR_GSTCTL_GUEST_ERROR; } } @@ -1244,8 +1243,8 @@ int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strP if (RT_SUCCESS(vrc)) strName = objData.mName; } - else if (prcGuest) - *prcGuest = vrcGuest; + else if (pvrcGuest) + *pvrcGuest = vrcGuest; LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); return vrc; @@ -1258,25 +1257,23 @@ int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strP * @returns VERR_GSTCTL_GUEST_ERROR on received guest error. * @param openInfo Open information to use. * @param pDirectory Where to return the guest directory object on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ -int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, - ComObjPtr<GuestDirectory> &pDirectory, int *prcGuest) +int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest) { - AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); + AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); - LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n", - openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags)); + LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n", openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Create the directory object. */ - HRESULT hr = pDirectory.createObject(); - if (FAILED(hr)) - return Global::vboxStatusCodeFromCOM(hr); + HRESULT hrc = pDirectory.createObject(); + if (FAILED(hrc)) + return Global::vboxStatusCodeFromCOM(hrc); /* Register a new object ID. */ uint32_t idObject; @@ -1332,8 +1329,8 @@ int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, if (RT_SUCCESS(vrc)) { /* Nothing further to do here yet. */ - if (prcGuest) - *prcGuest = VINF_SUCCESS; + if (pvrcGuest) + *pvrcGuest = VINF_SUCCESS; } LogFlowFuncLeaveRC(vrc); @@ -1361,7 +1358,7 @@ int GuestSession::i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTC /* * Find the object. */ - int rc = VERR_NOT_FOUND; + int vrc = VERR_NOT_FOUND; const uint32_t idObject = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCtxCb->uContextID); SessionObjects::const_iterator itObj = mData.mObjects.find(idObject); if (itObj != mData.mObjects.end()) @@ -1377,7 +1374,7 @@ int GuestSession::i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTC { alock.release(); - rc = i_dispatchToThis(pCtxCb, pSvcCb); + vrc = i_dispatchToThis(pCtxCb, pSvcCb); break; } case SESSIONOBJECTTYPE_DIRECTORY: @@ -1387,7 +1384,7 @@ int GuestSession::i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTC alock.release(); - rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); + vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); break; } case SESSIONOBJECTTYPE_FILE: @@ -1397,7 +1394,7 @@ int GuestSession::i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTC alock.release(); - rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); + vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); break; } case SESSIONOBJECTTYPE_PROCESS: @@ -1407,18 +1404,18 @@ int GuestSession::i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTC alock.release(); - rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); + vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); break; } default: AssertMsgFailed(("%d\n", itObj->second.enmType)); - rc = VERR_INTERNAL_ERROR_4; + vrc = VERR_INTERNAL_ERROR_4; break; } } - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -1437,27 +1434,25 @@ int GuestSession::i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTR LogFlowThisFunc(("sessionID=%RU32, CID=%RU32, uMessage=%RU32, pSvcCb=%p\n", mData.mSession.mID, pCbCtx->uContextID, pCbCtx->uMessage, pSvcCbData)); - int rc; + int vrc; switch (pCbCtx->uMessage) { case GUEST_MSG_DISCONNECTED: /** @todo Handle closing all guest objects. */ - rc = VERR_INTERNAL_ERROR; + vrc = VERR_INTERNAL_ERROR; break; case GUEST_MSG_SESSION_NOTIFY: /* Guest Additions >= 4.3.0. */ - { - rc = i_onSessionStatusChange(pCbCtx, pSvcCbData); + vrc = i_onSessionStatusChange(pCbCtx, pSvcCbData); break; - } default: - rc = dispatchGeneric(pCbCtx, pSvcCbData); + vrc = dispatchGeneric(pCbCtx, pSvcCbData); break; } - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -1551,9 +1546,9 @@ int GuestSession::i_fileUnregister(GuestFile *pFile) LogFlowFunc(("Removing file (objectID=%RU32) ...\n", idObject)); - int rc = i_objectUnregister(idObject); - if (RT_FAILURE(rc)) - return rc; + int vrc = i_objectUnregister(idObject); + if (RT_FAILURE(vrc)) + return vrc; SessionFiles::iterator itFiles = mData.mFiles.find(idObject); AssertReturn(itFiles != mData.mFiles.end(), VERR_NOT_FOUND); @@ -1564,8 +1559,8 @@ int GuestSession::i_fileUnregister(GuestFile *pFile) LogFlowFunc(("Removing file ID=%RU32 (session %RU32, now total %zu files)\n", pFileConsumed->getObjectID(), mData.mSession.mID, mData.mFiles.size())); - rc = pFileConsumed->i_onUnregister(); - AssertRCReturn(rc, rc); + vrc = pFileConsumed->i_onUnregister(); + AssertRCReturn(vrc, vrc); mData.mFiles.erase(itFiles); @@ -1575,8 +1570,8 @@ int GuestSession::i_fileUnregister(GuestFile *pFile) pFileConsumed.setNull(); - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -1585,10 +1580,10 @@ int GuestSession::i_fileUnregister(GuestFile *pFile) * @returns VBox status code. * @returns VERR_GSTCTL_GUEST_ERROR on received guest error. * @param strPath Path of file on guest to remove. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestSession::i_fileRemove(const Utf8Str &strPath, int *prcGuest) +int GuestSession::i_fileRemove(const Utf8Str &strPath, int *pvrcGuest) { LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); @@ -1622,16 +1617,16 @@ int GuestSession::i_fileRemove(const Utf8Str &strPath, int *prcGuest) if (RT_FAILURE(vrc)) { vrcGuest = vrc; - if (prcGuest) - *prcGuest = vrcGuest; + if (pvrcGuest) + *pvrcGuest = vrcGuest; vrc = VERR_GSTCTL_GUEST_ERROR; } } else vrc = VERR_BROKEN_PIPE; } - else if (prcGuest) - *prcGuest = vrcGuest; + else if (pvrcGuest) + *pvrcGuest = vrcGuest; LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); return vrc; @@ -1649,14 +1644,14 @@ int GuestSession::i_fileRemove(const Utf8Str &strPath, int *prcGuest) * @param aCreationMode Creation mode to use. * @param aFlags Open flags to use. * @param pFile Where to return the file object on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ int GuestSession::i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, FileSharingMode_T aSharingMode, ULONG aCreationMode, const std::vector<FileOpenExFlag_T> &aFlags, - ComObjPtr<GuestFile> &pFile, int *prcGuest) + ComObjPtr<GuestFile> &pFile, int *pvrcGuest) { GuestFileOpenInfo openInfo; openInfo.mFilename = aPath; @@ -1670,7 +1665,7 @@ int GuestSession::i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAcce openInfo.mfOpenEx |= aFlags[i]; /* Validation is done in i_fileOpen(). */ - return i_fileOpen(openInfo, pFile, prcGuest); + return i_fileOpen(openInfo, pFile, pvrcGuest); } /** @@ -1680,12 +1675,12 @@ int GuestSession::i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAcce * @returns VERR_GSTCTL_GUEST_ERROR on received guest error. * @param openInfo Open information to use for opening the file. * @param pFile Where to return the file object on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the write lock. */ -int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *prcGuest) +int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest) { LogFlowThisFunc(("strFile=%s, enmAccessMode=0x%x, enmOpenAction=0x%x, uCreationMode=%RU32, mfOpenEx=%RU32\n", openInfo.mFilename.c_str(), openInfo.mAccessMode, openInfo.mOpenAction, openInfo.mCreationMode, @@ -1696,8 +1691,8 @@ int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestF /* Guest Additions < 4.3 don't support handling guest files, skip. */ if (mData.mProtocolVersion < 2) { - if (prcGuest) - *prcGuest = VERR_NOT_SUPPORTED; + if (pvrcGuest) + *pvrcGuest = VERR_NOT_SUPPORTED; return VERR_GSTCTL_GUEST_ERROR; } @@ -1705,25 +1700,25 @@ int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestF return VERR_INVALID_PARAMETER; /* Create the directory object. */ - HRESULT hr = pFile.createObject(); - if (FAILED(hr)) + HRESULT hrc = pFile.createObject(); + if (FAILED(hrc)) return VERR_COM_UNEXPECTED; /* Register a new object ID. */ uint32_t idObject; - int rc = i_objectRegister(pFile, SESSIONOBJECTTYPE_FILE, &idObject); - if (RT_FAILURE(rc)) + int vrc = i_objectRegister(pFile, SESSIONOBJECTTYPE_FILE, &idObject); + if (RT_FAILURE(vrc)) { pFile.setNull(); - return rc; + return vrc; } Console *pConsole = mParent->i_getConsole(); AssertPtr(pConsole); - rc = pFile->init(pConsole, this /* GuestSession */, idObject, openInfo); - if (RT_FAILURE(rc)) - return rc; + vrc = pFile->init(pConsole, this /* GuestSession */, idObject, openInfo); + if (RT_FAILURE(vrc)) + return vrc; /* * Since this is a synchronous guest call we have to @@ -1746,44 +1741,41 @@ int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestF } catch (std::bad_alloc &) { - rc = VERR_NO_MEMORY; + vrc = VERR_NO_MEMORY; } - if (RT_SUCCESS(rc)) + if (RT_SUCCESS(vrc)) { - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &rcGuest); - if ( rc == VERR_GSTCTL_GUEST_ERROR - && prcGuest) - { - *prcGuest = rcGuest; - } + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + vrc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &vrcGuest); + if ( vrc == VERR_GSTCTL_GUEST_ERROR + && pvrcGuest) + *pvrcGuest = vrcGuest; } - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** * Queries information from a file on the guest. * * @returns IPRT status code. VERR_NOT_A_FILE if the queried file system object on the guest is not a file, - * or VERR_GSTCTL_GUEST_ERROR if prcGuest contains more error information from the guest. + * or VERR_GSTCTL_GUEST_ERROR if pvrcGuest contains + * more error information from the guest. * @param strPath Absolute path of file to query information for. * @param fFollowSymlinks Whether or not to follow symbolic links on the guest. * @param objData Where to store the acquired information. - * @param prcGuest Where to store the guest rc. Optional. + * @param pvrcGuest Where to store the guest VBox status code. + * Optional. */ -int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest) +int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) { LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); - int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, prcGuest); + int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest); if (RT_SUCCESS(vrc)) - { - vrc = objData.mType == FsObjType_File - ? VINF_SUCCESS : VERR_NOT_A_FILE; - } + vrc = objData.mType == FsObjType_File ? VINF_SUCCESS : VERR_NOT_A_FILE; LogFlowFuncLeaveRC(vrc); return vrc; @@ -1798,15 +1790,15 @@ int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, * @param strPath Path of file on guest to query size for. * @param fFollowSymlinks \c true when wanting to follow symbolic links, \c false if not. * @param pllSize Where to return the queried file size on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ -int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *prcGuest) +int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest) { AssertPtrReturn(pllSize, VERR_INVALID_POINTER); GuestFsObjData objData; - int vrc = i_fileQueryInfo(strPath, fFollowSymlinks, objData, prcGuest); + int vrc = i_fileQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest); if (RT_SUCCESS(vrc)) *pllSize = objData.mObjectSize; @@ -1820,10 +1812,11 @@ int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, * @param strPath Path to file system object to query information for. * @param fFollowSymlinks Whether to follow symbolic links or not. * @param objData Where to return the file system object data, if found. - * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. - * Any other return code indicates some host side error. + * @param pvrcGuest Guest VBox status code, when returning + * VERR_GSTCTL_GUEST_ERROR. Any other return code + * indicates some host side error. */ -int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest) +int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) { LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); @@ -1859,16 +1852,16 @@ int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, Gu if (RT_FAILURE(vrc)) { vrcGuest = vrc; - if (prcGuest) - *prcGuest = vrcGuest; + if (pvrcGuest) + *pvrcGuest = vrcGuest; vrc = VERR_GSTCTL_GUEST_ERROR; } } else vrc = VERR_BROKEN_PIPE; } - else if (prcGuest) - *prcGuest = vrcGuest; + else if (pvrcGuest) + *pvrcGuest = vrcGuest; LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); return vrc; @@ -1900,12 +1893,12 @@ Utf8Str GuestSession::i_getName(void) * @returns Stringified error description. */ /* static */ -Utf8Str GuestSession::i_guestErrorToString(int rcGuest) +Utf8Str GuestSession::i_guestErrorToString(int vrcGuest) { Utf8Str strError; /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ - switch (rcGuest) + switch (vrcGuest) { case VERR_INVALID_VM_HANDLE: strError.printf(tr("VMM device is not available (is the VM running?)")); @@ -1940,7 +1933,7 @@ Utf8Str GuestSession::i_guestErrorToString(int rcGuest) break; default: - strError.printf("%Rrc", rcGuest); + strError.printf("%Rrc", vrcGuest); break; } @@ -2069,17 +2062,16 @@ int GuestSession::i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXG AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - LogFlowThisFunc(("ID=%RU32, uType=%RU32, rcGuest=%Rrc\n", - mData.mSession.mID, dataCb.uType, dataCb.uResult)); + LogFlowThisFunc(("ID=%RU32, uType=%RU32, vrcGuest=%Rrc\n", mData.mSession.mID, dataCb.uType, dataCb.uResult)); GuestSessionStatus_T sessionStatus = GuestSessionStatus_Undefined; - int rcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */ + int vrcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */ switch (dataCb.uType) { case GUEST_SESSION_NOTIFYTYPE_ERROR: sessionStatus = GuestSessionStatus_Error; - LogRel(("Guest Control: Error starting Session '%s' (%Rrc) \n", mData.mSession.mName.c_str(), rcGuest)); + LogRel(("Guest Control: Error starting Session '%s' (%Rrc) \n", mData.mSession.mName.c_str(), vrcGuest)); break; case GUEST_SESSION_NOTIFYTYPE_STARTED: @@ -2150,15 +2142,15 @@ int GuestSession::i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXG if (RT_SUCCESS(vrc)) { - if (RT_FAILURE(rcGuest)) + if (RT_FAILURE(vrcGuest)) sessionStatus = GuestSessionStatus_Error; } /* Set the session status. */ if (RT_SUCCESS(vrc)) - vrc = i_setSessionStatus(sessionStatus, rcGuest); + vrc = i_setSessionStatus(sessionStatus, vrcGuest); - LogFlowThisFunc(("ID=%RU32, rcGuest=%Rrc\n", mData.mSession.mID, rcGuest)); + LogFlowThisFunc(("ID=%RU32, vrcGuest=%Rrc\n", mData.mSession.mID, vrcGuest)); LogFlowFuncLeaveRC(vrc); return vrc; @@ -2212,12 +2204,12 @@ PathStyle_T GuestSession::i_getHostPathStyle(void) * Starts the guest session on the guest. * * @returns VBox status code. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the read and write locks. */ -int GuestSession::i_startSession(int *prcGuest) +int GuestSession::i_startSession(int *pvrcGuest) { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -2231,7 +2223,7 @@ int GuestSession::i_startSession(int *prcGuest) { alock.release(); /* Release lock before changing status. */ - /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS); + i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS); /* ignore return code*/ LogFlowThisFunc(("Installed Guest Additions don't support opening dedicated sessions, skipping\n")); return VINF_SUCCESS; } @@ -2286,7 +2278,7 @@ int GuestSession::i_startSession(int *prcGuest) { vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start, 30 * 1000 /* 30s timeout */, - NULL /* Session status */, prcGuest); + NULL /* Session status */, pvrcGuest); } else { @@ -2296,7 +2288,7 @@ int GuestSession::i_startSession(int *prcGuest) * this also marks the end state. Internally just calling this * same function again will work though. */ - /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Error, vrc); + i_setSessionStatus(GuestSessionStatus_Error, vrc); /* ignore return code */ } unregisterWaitEvent(pEvent); @@ -2361,7 +2353,7 @@ int GuestSession::i_startSessionThreadTask(GuestSessionTaskInternalStart *pTask) if (FAILED(autoCaller.hrc())) return VERR_COM_INVALID_OBJECT_STATE; - int vrc = pSession->i_startSession(NULL /* Guest rc, ignored */); + int vrc = pSession->i_startSession(NULL /*pvrcGuest*/); /* Nothing to do here anymore. */ LogFlowFuncLeaveRC(vrc); @@ -2441,14 +2433,14 @@ int GuestSession::i_objectUnregister(uint32_t idObject) { AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - int rc = VINF_SUCCESS; - AssertMsgStmt(ASMBitTestAndClear(&mData.bmObjectIds, idObject), ("idObject=%#x\n", idObject), rc = VERR_NOT_FOUND); + int vrc = VINF_SUCCESS; + AssertMsgStmt(ASMBitTestAndClear(&mData.bmObjectIds, idObject), ("idObject=%#x\n", idObject), vrc = VERR_NOT_FOUND); SessionObjects::iterator ItObj = mData.mObjects.find(idObject); AssertMsgReturn(ItObj != mData.mObjects.end(), ("idObject=%#x\n", idObject), VERR_NOT_FOUND); mData.mObjects.erase(ItObj); - return rc; + return vrc; } /** @@ -2547,11 +2539,11 @@ int GuestSession::i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessi * @param strSource Source path on guest to rename. * @param strDest Destination path on guest to rename \a strSource to. * @param uFlags Renaming flags. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * @note Takes the read lock. */ -int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *prcGuest) +int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest) { AssertReturn(!(uFlags & ~PATHRENAME_FLAG_VALID_MASK), VERR_INVALID_PARAMETER); @@ -2582,8 +2574,8 @@ int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, { vrc = pEvent->Wait(30 * 1000); if ( vrc == VERR_GSTCTL_GUEST_ERROR - && prcGuest) - *prcGuest = pEvent->GuestResult(); + && pvrcGuest) + *pvrcGuest = pEvent->GuestResult(); } unregisterWaitEvent(pEvent); @@ -2596,13 +2588,14 @@ int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, * Returns the user's absolute documents path, if any. * * @returns VBox status code. - * @param strPath Where to store the user's document path. - * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. - * Any other return code indicates some host side error. + * @param strPath Where to store the user's document path. + * @param pvrcGuest Guest VBox status code, when returning + * VERR_GSTCTL_GUEST_ERROR. Any other return code indicates + * some host side error. * * @note Takes the read lock. */ -int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *prcGuest) +int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest) { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -2632,8 +2625,8 @@ int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *prcGuest) { if (vrc == VERR_GSTCTL_GUEST_ERROR) { - if (prcGuest) - *prcGuest = pEvent->GuestResult(); + if (pvrcGuest) + *pvrcGuest = pEvent->GuestResult(); } } } @@ -2648,13 +2641,14 @@ int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *prcGuest) * Returns the user's absolute home path, if any. * * @returns VBox status code. - * @param strPath Where to store the user's home path. - * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. - * Any other return code indicates some host side error. + * @param strPath Where to store the user's home path. + * @param pvrcGuest Guest VBox status code, when returning + * VERR_GSTCTL_GUEST_ERROR. Any other return code indicates + * some host side error. * * @note Takes the read lock. */ -int GuestSession::i_pathUserHome(Utf8Str &strPath, int *prcGuest) +int GuestSession::i_pathUserHome(Utf8Str &strPath, int *pvrcGuest) { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -2684,8 +2678,8 @@ int GuestSession::i_pathUserHome(Utf8Str &strPath, int *prcGuest) { if (vrc == VERR_GSTCTL_GUEST_ERROR) { - if (prcGuest) - *prcGuest = pEvent->GuestResult(); + if (pvrcGuest) + *pvrcGuest = pEvent->GuestResult(); } } } @@ -2716,9 +2710,9 @@ int GuestSession::i_processUnregister(GuestProcess *pProcess) LogFlowFunc(("Removing process (objectID=%RU32) ...\n", idObject)); - int rc = i_objectUnregister(idObject); - if (RT_FAILURE(rc)) - return rc; + int vrc = i_objectUnregister(idObject); + if (RT_FAILURE(vrc)) + return vrc; SessionProcesses::iterator itProcs = mData.mProcesses.find(idObject); AssertReturn(itProcs != mData.mProcesses.end(), VERR_NOT_FOUND); @@ -2727,14 +2721,14 @@ int GuestSession::i_processUnregister(GuestProcess *pProcess) ComObjPtr<GuestProcess> pProc = pProcess; ULONG uPID; - HRESULT hr = pProc->COMGETTER(PID)(&uPID); - ComAssertComRC(hr); + HRESULT hrc = pProc->COMGETTER(PID)(&uPID); + ComAssertComRC(hrc); LogFlowFunc(("Removing process ID=%RU32 (session %RU32, guest PID %RU32, now total %zu processes)\n", idObject, mData.mSession.mID, uPID, mData.mProcesses.size())); - rc = pProcess->i_onUnregister(); - AssertRCReturn(rc, rc); + vrc = pProcess->i_onUnregister(); + AssertRCReturn(vrc, vrc); mData.mProcesses.erase(itProcs); @@ -2744,8 +2738,8 @@ int GuestSession::i_processUnregister(GuestProcess *pProcess) pProc.setNull(); - LogFlowFuncLeaveRC(rc); - return rc; + LogFlowFuncLeaveRC(vrc); + return vrc; } /** @@ -2817,23 +2811,22 @@ int GuestSession::i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); /* Create the process object. */ - HRESULT hr = pProcess.createObject(); - if (FAILED(hr)) + HRESULT hrc = pProcess.createObject(); + if (FAILED(hrc)) return VERR_COM_UNEXPECTED; /* Register a new object ID. */ uint32_t idObject; - int rc = i_objectRegister(pProcess, SESSIONOBJECTTYPE_PROCESS, &idObject); - if (RT_FAILURE(rc)) + int vrc = i_objectRegister(pProcess, SESSIONOBJECTTYPE_PROCESS, &idObject); + if (RT_FAILURE(vrc)) { pProcess.setNull(); - return rc; + return vrc; } - rc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */, idObject, - procInfo, mData.mpBaseEnvironment); - if (RT_FAILURE(rc)) - return rc; + vrc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */, idObject, procInfo, mData.mpBaseEnvironment); + if (RT_FAILURE(vrc)) + return vrc; /* Add the created process to our map. */ try @@ -2849,10 +2842,10 @@ int GuestSession::i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr } catch (std::bad_alloc &) { - rc = VERR_NO_MEMORY; + vrc = VERR_NO_MEMORY; } - return rc; + return vrc; } /** @@ -2899,8 +2892,8 @@ inline int GuestSession::i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> * return VERR_COM_INVALID_OBJECT_STATE; ULONG uCurPID; - HRESULT hr = pCurProc->COMGETTER(PID)(&uCurPID); - ComAssertComRC(hr); + HRESULT hrc = pCurProc->COMGETTER(PID)(&uCurPID); + ComAssertComRC(hrc); if (uCurPID == uPID) { @@ -2963,24 +2956,23 @@ int GuestSession::i_sendMessage(uint32_t uMessage, uint32_t uParms, PVBOXHGCMSVC * * @returns VBox status code. * @param sessionStatus Session status to set. - * @param sessionRc Session result to set (for error handling). + * @param vrcSession Session result to set (for error handling). * * @note Takes the write lock. */ -int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc) +int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession) { - LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, sessionRc=%Rrc\n", - mData.mStatus, sessionStatus, sessionRc)); + LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, vrcSession=%Rrc\n", mData.mStatus, sessionStatus, vrcSession)); if (sessionStatus == GuestSessionStatus_Error) { - AssertMsg(RT_FAILURE(sessionRc), ("Guest rc must be an error (%Rrc)\n", sessionRc)); + AssertMsg(RT_FAILURE(vrcSession), ("Guest vrcSession must be an error (%Rrc)\n", vrcSession)); /* Do not allow overwriting an already set error. If this happens * this means we forgot some error checking/locking somewhere. */ - AssertMsg(RT_SUCCESS(mData.mVrc), ("Guest rc already set (to %Rrc)\n", mData.mVrc)); + AssertMsg(RT_SUCCESS(mData.mVrc), ("Guest mVrc already set (to %Rrc)\n", mData.mVrc)); } else - AssertMsg(RT_SUCCESS(sessionRc), ("Guest rc must not be an error (%Rrc)\n", sessionRc)); + AssertMsg(RT_SUCCESS(vrcSession), ("Guest vrcSession must not be an error (%Rrc)\n", vrcSession)); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -2989,18 +2981,17 @@ int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int ses if (mData.mStatus != sessionStatus) { mData.mStatus = sessionStatus; - mData.mVrc = sessionRc; + mData.mVrc = vrcSession; /* Make sure to notify all underlying objects first. */ vrc = i_objectsNotifyAboutStatusChange(sessionStatus); ComObjPtr<VirtualBoxErrorInfo> errorInfo; - HRESULT hr = errorInfo.createObject(); - ComAssertComRC(hr); - int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, sessionRc, - COM_IIDOF(IGuestSession), getComponentName(), - i_guestErrorToString(sessionRc)); - AssertRC(rc2); + HRESULT hrc = errorInfo.createObject(); + ComAssertComRC(hrc); + int vrc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, vrcSession, COM_IIDOF(IGuestSession), getComponentName(), + i_guestErrorToString(vrcSession)); + AssertRC(vrc2); alock.release(); /* Release lock before firing off event. */ @@ -3012,20 +3003,20 @@ int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int ses } /** @todo Unused --remove? */ -int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */) +int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */) { - RT_NOREF(enmWaitResult, rc); + RT_NOREF(enmWaitResult, vrc); - /*LogFlowThisFunc(("enmWaitResult=%d, rc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n", - enmWaitResult, rc, mData.mWaitCount, mData.mWaitEvent));*/ + /*LogFlowThisFunc(("enmWaitResult=%d, vrc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n", + enmWaitResult, vrc, mData.mWaitCount, mData.mWaitEvent));*/ /* Note: No write locking here -- already done in the caller. */ - int vrc = VINF_SUCCESS; + int vrc2 = VINF_SUCCESS; /*if (mData.mWaitEvent) - vrc = mData.mWaitEvent->Signal(enmWaitResult, rc);*/ - LogFlowFuncLeaveRC(vrc); - return vrc; + vrc2 = mData.mWaitEvent->Signal(enmWaitResult, vrc);*/ + LogFlowFuncLeaveRC(vrc2); + return vrc2; } /** @@ -3033,13 +3024,14 @@ int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc * Needs supported Guest Additions installed. * * @returns VBox status code. VERR_NOT_SUPPORTED if not supported by Guest Additions. - * @param fFlags Guest shutdown flags. - * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. - * Any other return code indicates some host side error. + * @param fFlags Guest shutdown flags. + * @param pvrcGuest Guest VBox status code, when returning + * VERR_GSTCTL_GUEST_ERROR. Any other return code indicates + * some host side error. * * @note Takes the read lock. */ -int GuestSession::i_shutdown(uint32_t fFlags, int *prcGuest) +int GuestSession::i_shutdown(uint32_t fFlags, int *pvrcGuest) { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -3062,7 +3054,7 @@ int GuestSession::i_shutdown(uint32_t fFlags, int *prcGuest) alock.release(); /* Drop lock before sending. */ - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; vrc = i_sendMessage(HOST_MSG_SHUTDOWN, i, paParms); if (RT_SUCCESS(vrc)) @@ -3071,18 +3063,16 @@ int GuestSession::i_shutdown(uint32_t fFlags, int *prcGuest) if (RT_FAILURE(vrc)) { if (vrc == VERR_GSTCTL_GUEST_ERROR) - rcGuest = pEvent->GuestResult(); + vrcGuest = pEvent->GuestResult(); } } if (RT_FAILURE(vrc)) { - LogRel(("Guest Control: Shutting down guest failed, rc=%Rrc\n", - vrc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : vrc)); - + LogRel(("Guest Control: Shutting down guest failed, vrc=%Rrc\n", vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc)); if ( vrc == VERR_GSTCTL_GUEST_ERROR - && prcGuest) - *prcGuest = rcGuest; + && pvrcGuest) + *pvrcGuest = vrcGuest; } unregisterWaitEvent(pEvent); @@ -3141,19 +3131,19 @@ int GuestSession::i_determineProtocolVersion(void) * @param fWaitFlags Wait flags to use. * @param uTimeoutMS Timeout (in ms) to wait. * @param waitResult Where to return the wait result on success. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. * * @note Takes the read lock. */ -int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *prcGuest) +int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest) { LogFlowThisFuncEnter(); AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER); - /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, prcGuest=%p\n", - fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, prcGuest));*/ + /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, pvrcGuest=%p\n", + fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, pvrcGuest));*/ AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -3161,9 +3151,9 @@ int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionW if (mData.mStatus == GuestSessionStatus_Error) { waitResult = GuestSessionWaitResult_Error; - AssertMsg(RT_FAILURE(mData.mVrc), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mVrc)); - if (prcGuest) - *prcGuest = mData.mVrc; /* Return last set error. */ + AssertMsg(RT_FAILURE(mData.mVrc), ("No error mVrc (%Rrc) set when guest session indicated an error\n", mData.mVrc)); + if (pvrcGuest) + *pvrcGuest = mData.mVrc; /* Return last set error. */ return VERR_GSTCTL_GUEST_ERROR; } @@ -3240,13 +3230,13 @@ int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionW } } - LogFlowThisFunc(("sessionStatus=%RU32, sessionRc=%Rrc, waitResult=%RU32\n", mData.mStatus, mData.mVrc, waitResult)); + LogFlowThisFunc(("sessionStatus=%RU32, vrcSession=%Rrc, waitResult=%RU32\n", mData.mStatus, mData.mVrc, waitResult)); /* No waiting needed? Return immediately using the last set error. */ if (waitResult != GuestSessionWaitResult_None) { - if (prcGuest) - *prcGuest = mData.mVrc; /* Return last set error (if any). */ + if (pvrcGuest) + *pvrcGuest = mData.mVrc; /* Return last set error (if any). */ return RT_SUCCESS(mData.mVrc) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; } @@ -3277,7 +3267,7 @@ int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionW GuestSessionStatus_T sessionStatus; vrc = i_waitForStatusChange(pEvent, fWaitFlags, - uTimeoutMS - (tsNow - tsStart), &sessionStatus, prcGuest); + uTimeoutMS - (tsNow - tsStart), &sessionStatus, pvrcGuest); if (RT_SUCCESS(vrc)) { switch (sessionStatus) @@ -3350,11 +3340,11 @@ int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionW * @param fWaitFlags Wait flags to use. * @param uTimeoutMS Timeout (in ms) to wait. * @param pSessionStatus Where to return the guest session status. - * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR - * was returned. Optional. + * @param pvrcGuest Where to return the guest error when + * VERR_GSTCTL_GUEST_ERROR was returned. Optional. */ int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, - GuestSessionStatus_T *pSessionStatus, int *prcGuest) + GuestSessionStatus_T *pSessionStatus, int *pvrcGuest) { RT_NOREF(fWaitFlags); AssertPtrReturn(pEvent, VERR_INVALID_POINTER); @@ -3375,16 +3365,16 @@ int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFl *pSessionStatus = sessionStatus; ComPtr<IVirtualBoxErrorInfo> errorInfo; - HRESULT hr = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam()); - ComAssertComRC(hr); + HRESULT hrc = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam()); + ComAssertComRC(hrc); LONG lGuestRc; - hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); - ComAssertComRC(hr); + hrc = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); + ComAssertComRC(hrc); if (RT_FAILURE((int)lGuestRc)) vrc = VERR_GSTCTL_GUEST_ERROR; - if (prcGuest) - *prcGuest = (int)lGuestRc; + if (pvrcGuest) + *pvrcGuest = (int)lGuestRc; LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: %RU32 (%Rrc)\n", mData.mSession.mID, sessionStatus, @@ -3393,10 +3383,10 @@ int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFl else /** @todo Re-visit this. Can this happen more frequently? */ AssertMsgFailedReturn(("Got unexpected event type %#x\n", evtType), VERR_WRONG_ORDER); } - /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make prcGuest is set. */ - else if (vrc == VERR_GSTCTL_GUEST_ERROR && prcGuest) - *prcGuest = pEvent->GuestResult(); - Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !prcGuest || *prcGuest != (int)0xcccccccc); + /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make pvrcGuest is set. */ + else if (vrc == VERR_GSTCTL_GUEST_ERROR && pvrcGuest) + *pvrcGuest = pEvent->GuestResult(); + Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !pvrcGuest || *pvrcGuest != (int)0xcccccccc); LogFlowFuncLeaveRC(vrc); return vrc; @@ -3412,8 +3402,8 @@ HRESULT GuestSession::close() /* Note: Don't check if the session is ready via i_isStartedExternal() here; * the session (already) could be in a stopped / aborted state. */ - int vrc = VINF_SUCCESS; /* Shut up MSVC. */ - int rcGuest = VINF_SUCCESS; + int vrc = VINF_SUCCESS; /* Shut up MSVC. */ + int vrcGuest = VINF_SUCCESS; uint32_t msTimeout = RT_MS_10SEC; /* 10s timeout by default */ for (int i = 0; i < 3; i++) @@ -3426,7 +3416,7 @@ HRESULT GuestSession::close() } /* Close session on guest. */ - vrc = i_closeSession(0 /* Flags */, msTimeout, &rcGuest); + vrc = i_closeSession(0 /* Flags */, msTimeout, &vrcGuest); if ( RT_SUCCESS(vrc) || vrc != VERR_TIMEOUT) /* If something else happened there is no point in retrying further. */ break; @@ -3444,14 +3434,14 @@ HRESULT GuestSession::close() if (RT_SUCCESS(vrc)) vrc = vrc2; - LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", vrc, rcGuest)); + LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); if (RT_FAILURE(vrc)) { if (vrc == VERR_GSTCTL_GUEST_ERROR) { - GuestErrorInfo ge(GuestErrorInfo::Type_Session, rcGuest, mData.mSession.mName.c_str()); - return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Closing guest session failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Session, vrcGuest, mData.mSession.mName.c_str()); + return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Closing guest session failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } return setError(VBOX_E_IPRT_ERROR, tr("Closing guest session \"%s\" failed with %Rrc"), @@ -3550,15 +3540,15 @@ HRESULT GuestSession::copyFromGuest(const std::vector<com::Utf8Str> &aSources, c while (itSource != aSources.end()) { GuestFsObjData objData; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, &vrcGuest); if ( RT_FAILURE(vrc) && !fContinueOnErrors) { if (GuestProcess::i_isGuestError(vrc)) { - GuestErrorInfo ge(GuestErrorInfo::Type_Process, rcGuest, (*itSource).c_str()); - return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying type for guest source failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Process, vrcGuest, (*itSource).c_str()); + return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying type for guest source failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } return setError(E_FAIL, tr("Querying type for guest source \"%s\" failed: %Rrc"), (*itSource).c_str(), vrc); @@ -3756,14 +3746,15 @@ HRESULT GuestSession::directoryCreate(const com::Utf8Str &aPath, ULONG aMode, LogFlowThisFuncEnter(); - ComObjPtr <GuestDirectory> pDirectory; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &rcGuest); + ComObjPtr <GuestDirectory> pDirectory; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &vrcGuest); if (RT_FAILURE(vrc)) { if (GuestProcess::i_isGuestError(vrc)) { - GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str()); - return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Guest directory creation failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); + return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Guest directory creation failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } switch (vrc) @@ -3802,16 +3793,16 @@ HRESULT GuestSession::directoryCreateTemp(const com::Utf8Str &aTemplateName, ULO LogFlowThisFuncEnter(); - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), &vrcGuest); if (!RT_SUCCESS(vrc)) { switch (vrc) { case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolMkTemp, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Temporary guest directory creation failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolMkTemp, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Temporary guest directory creation failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -3837,9 +3828,9 @@ HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL aFollowSym LogFlowThisFuncEnter(); GuestFsObjData objData; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); + int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &vrcGuest); if (RT_SUCCESS(vrc)) *aExists = TRUE; else @@ -3848,15 +3839,15 @@ HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL aFollowSym { case VERR_GSTCTL_GUEST_ERROR: { - switch (rcGuest) + switch (vrcGuest) { case VERR_PATH_NOT_FOUND: *aExists = FALSE; break; default: { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying directory existence failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying directory existence failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -3909,8 +3900,9 @@ HRESULT GuestSession::directoryOpen(const com::Utf8Str &aPath, const com::Utf8St openInfo.mFilter = aFilter; openInfo.mFlags = fFlags; - ComObjPtr<GuestDirectory> pDirectory; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_directoryOpen(openInfo, pDirectory, &rcGuest); + ComObjPtr<GuestDirectory> pDirectory; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_directoryOpen(openInfo, pDirectory, &vrcGuest); if (RT_SUCCESS(vrc)) { /* Return directory object to the caller. */ @@ -3927,8 +3919,8 @@ HRESULT GuestSession::directoryOpen(const com::Utf8Str &aPath, const com::Utf8St case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Opening guest directory failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Opening guest directory failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -3955,8 +3947,8 @@ HRESULT GuestSession::directoryRemove(const com::Utf8Str &aPath) /* No flags; only remove the directory when empty. */ uint32_t fFlags = DIRREMOVEREC_FLAG_NONE; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_directoryRemove(aPath, fFlags, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_directoryRemove(aPath, fFlags, &vrcGuest); if (RT_FAILURE(vrc)) { switch (vrc) @@ -3968,8 +3960,8 @@ HRESULT GuestSession::directoryRemove(const com::Utf8Str &aPath) case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Removing guest directory failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Removing guest directory failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -4036,8 +4028,8 @@ HRESULT GuestSession::directoryRemoveRecursive(const com::Utf8Str &aPath, const if (FAILED(hrc)) return hrc; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_directoryRemove(aPath, fFlags, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_directoryRemove(aPath, fFlags, &vrcGuest); if (RT_FAILURE(vrc)) { switch (vrc) @@ -4049,8 +4041,8 @@ HRESULT GuestSession::directoryRemoveRecursive(const com::Utf8Str &aPath, const case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Recursively removing guest directory failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Recursively removing guest directory failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -4175,8 +4167,9 @@ HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks LogFlowThisFuncEnter(); - GuestFsObjData objData; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fileQueryInfo(aPath, RT_BOOL(aFollowSymlinks), objData, &rcGuest); + GuestFsObjData objData; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fileQueryInfo(aPath, RT_BOOL(aFollowSymlinks), objData, &vrcGuest); if (RT_SUCCESS(vrc)) { *aExists = TRUE; @@ -4187,7 +4180,7 @@ HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks { case VERR_GSTCTL_GUEST_ERROR: { - switch (rcGuest) + switch (vrcGuest) { case VERR_PATH_NOT_FOUND: RT_FALL_THROUGH(); @@ -4196,8 +4189,8 @@ HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks default: { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file existence failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file existence failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -4301,8 +4294,8 @@ HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAc return setError(E_INVALIDARG, tr("Unsupported FileOpenExFlag value(s) in aFlags (%#x)"), fOpenEx); ComObjPtr <GuestFile> pFile; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, &vrcGuest); if (RT_SUCCESS(vrc)) /* Return directory object to the caller. */ hrc = pFile.queryInterfaceTo(aFile.asOutParam()); @@ -4317,8 +4310,8 @@ HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAc case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_File, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Opening guest file failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_File, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Opening guest file failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -4340,18 +4333,17 @@ HRESULT GuestSession::fileQuerySize(const com::Utf8Str &aPath, BOOL aFollowSymli if (FAILED(hrc)) return hrc; - int64_t llSize; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fileQuerySize(aPath, aFollowSymlinks != FALSE, &llSize, &rcGuest); + int64_t llSize; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fileQuerySize(aPath, aFollowSymlinks != FALSE, &llSize, &vrcGuest); if (RT_SUCCESS(vrc)) - { *aSize = llSize; - } else { if (GuestProcess::i_isGuestError(vrc)) { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file size failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file size failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } else @@ -4390,27 +4382,23 @@ HRESULT GuestSession::fsObjExists(const com::Utf8Str &aPath, BOOL aFollowSymlink *aExists = false; GuestFsObjData objData; - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &vrcGuest); if (RT_SUCCESS(vrc)) - { *aExists = TRUE; - } else { if (GuestProcess::i_isGuestError(vrc)) { - if ( rcGuest == VERR_NOT_A_FILE - || rcGuest == VERR_PATH_NOT_FOUND - || rcGuest == VERR_FILE_NOT_FOUND - || rcGuest == VERR_INVALID_NAME) - { + if ( vrcGuest == VERR_NOT_A_FILE + || vrcGuest == VERR_PATH_NOT_FOUND + || vrcGuest == VERR_FILE_NOT_FOUND + || vrcGuest == VERR_INVALID_NAME) hrc = S_OK; /* Ignore these vrc values. */ - } else { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file existence information failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file existence information failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } } @@ -4432,8 +4420,9 @@ HRESULT GuestSession::fsObjQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSyml LogFlowThisFunc(("aPath=%s, aFollowSymlinks=%RTbool\n", aPath.c_str(), RT_BOOL(aFollowSymlinks))); - GuestFsObjData Info; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, Info, &rcGuest); + GuestFsObjData Info; + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, Info, &vrcGuest); if (RT_SUCCESS(vrc)) { ComObjPtr<GuestFsObjInfo> ptrFsObjInfo; @@ -4451,8 +4440,8 @@ HRESULT GuestSession::fsObjQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSyml { if (GuestProcess::i_isGuestError(vrc)) { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file information failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file information failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } else @@ -4473,14 +4462,14 @@ HRESULT GuestSession::fsObjRemove(const com::Utf8Str &aPath) LogFlowThisFunc(("aPath=%s\n", aPath.c_str())); - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_fileRemove(aPath, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_fileRemove(aPath, &vrcGuest); if (RT_FAILURE(vrc)) { if (GuestProcess::i_isGuestError(vrc)) { - GuestErrorInfo ge(GuestErrorInfo::Type_ToolRm, rcGuest, aPath.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Removing guest file failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_ToolRm, vrcGuest, aPath.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Removing guest file failed: %s"), GuestBase::getErrorAsString(ge).c_str()); } else @@ -4528,8 +4517,8 @@ HRESULT GuestSession::fsObjRename(const com::Utf8Str &aSource, fBackend = PATHRENAME_FLAG_NO_REPLACE; /* Call worker to do the job. */ - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; - int vrc = i_pathRename(aSource, aDestination, fBackend, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; + int vrc = i_pathRename(aSource, aDestination, fBackend, &vrcGuest); if (RT_FAILURE(vrc)) { switch (vrc) @@ -4541,8 +4530,8 @@ HRESULT GuestSession::fsObjRename(const com::Utf8Str &aSource, case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_Process, rcGuest, aSource.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Renaming guest path failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Process, vrcGuest, aSource.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Renaming guest path failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } @@ -4606,9 +4595,9 @@ HRESULT GuestSession::processCreateEx(const com::Utf8Str &aExecutable, const std ProcessPriority_T aPriority, const std::vector<LONG> &aAffinity, ComPtr<IGuestProcess> &aGuestProcess) { - HRESULT hr = i_isStartedExternal(); - if (FAILED(hr)) - return hr; + HRESULT hrc = i_isStartedExternal(); + if (FAILED(hrc)) + return hrc; /* * Must have an executable to execute. If none is given, we try use the @@ -4675,8 +4664,8 @@ HRESULT GuestSession::processCreateEx(const com::Utf8Str &aExecutable, const std if (RT_SUCCESS(vrc)) { ComPtr<IGuestProcess> pIProcess; - hr = pProcess.queryInterfaceTo(pIProcess.asOutParam()); - if (SUCCEEDED(hr)) + hrc = pProcess.queryInterfaceTo(pIProcess.asOutParam()); + if (SUCCEEDED(hrc)) { /* * Start the process. @@ -4690,25 +4679,25 @@ HRESULT GuestSession::processCreateEx(const com::Utf8Str &aExecutable, const std return S_OK; } - hr = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc); + hrc = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc); } } else if (vrc == VERR_GSTCTL_MAX_CID_OBJECTS_REACHED) - hr = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"), + hrc = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"), VBOX_GUESTCTRL_MAX_OBJECTS); else - hr = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc); + hrc = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc); } else - hr = setErrorBoth(vrc == VERR_ENV_INVALID_VAR_NAME ? E_INVALIDARG : Global::vboxStatusCodeToCOM(vrc), vrc, + hrc = setErrorBoth(vrc == VERR_ENV_INVALID_VAR_NAME ? E_INVALIDARG : Global::vboxStatusCodeToCOM(vrc), vrc, tr("Failed to apply environment variable '%s', index %u (%Rrc)'"), aEnvironment[idxError].c_str(), idxError, vrc); } else - hr = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc); + hrc = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc); LogFlowFuncLeaveRC(vrc); - return hr; + return hrc; } HRESULT GuestSession::processGet(ULONG aPid, ComPtr<IGuestProcess> &aGuestProcess) @@ -4721,20 +4710,20 @@ HRESULT GuestSession::processGet(ULONG aPid, ComPtr<IGuestProcess> &aGuestProces AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); - HRESULT hr = S_OK; + HRESULT hrc = S_OK; ComObjPtr<GuestProcess> pProcess; - int rc = i_processGetByPID(aPid, &pProcess); - if (RT_FAILURE(rc)) - hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid); + int vrc = i_processGetByPID(aPid, &pProcess); + if (RT_FAILURE(vrc)) + hrc = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid); /* This will set (*aProcess) to NULL if pProgress is NULL. */ - HRESULT hr2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam()); - if (SUCCEEDED(hr)) - hr = hr2; + HRESULT hrc2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam()); + if (SUCCEEDED(hrc)) + hrc = hrc2; - LogFlowThisFunc(("aProcess=%p, hr=%Rhrc\n", (IGuestProcess*)aGuestProcess, hr)); - return hr; + LogFlowThisFunc(("aProcess=%p, hrc=%Rhrc\n", (IGuestProcess*)aGuestProcess, hrc)); + return hrc; } HRESULT GuestSession::symlinkCreate(const com::Utf8Str &aSource, const com::Utf8Str &aTarget, SymlinkType_T aType) @@ -4768,8 +4757,8 @@ HRESULT GuestSession::waitFor(ULONG aWaitFor, ULONG aTimeoutMS, GuestSessionWait /* * Note: Do not hold any locks here while waiting! */ - int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; GuestSessionWaitResult_T waitResult; - int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest); + int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; GuestSessionWaitResult_T waitResult; + int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &vrcGuest); if (RT_SUCCESS(vrc)) *aReason = waitResult; else @@ -4778,8 +4767,8 @@ HRESULT GuestSession::waitFor(ULONG aWaitFor, ULONG aTimeoutMS, GuestSessionWait { case VERR_GSTCTL_GUEST_ERROR: { - GuestErrorInfo ge(GuestErrorInfo::Type_Session, rcGuest, mData.mSession.mName.c_str()); - hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Waiting for guest process failed: %s"), + GuestErrorInfo ge(GuestErrorInfo::Type_Session, vrcGuest, mData.mSession.mName.c_str()); + hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Waiting for guest process failed: %s"), GuestBase::getErrorAsString(ge).c_str()); break; } diff --git a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp index 979c6bbd92e..29b558aaff8 100644 --- a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp +++ b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp @@ -110,14 +110,14 @@ int GuestSessionTask::createAndSetProgressObject(ULONG cOperations /* = 1 */) /* Create the progress object. */ ComObjPtr<Progress> pProgress; - HRESULT hr = pProgress.createObject(); - if (FAILED(hr)) + HRESULT hrc = pProgress.createObject(); + if (FAILED(hrc)) return VERR_COM_UNEXPECTED; - hr = pProgress->init(static_cast<IGuestSession*>(mSession), - Bstr(mDesc).raw(), - TRUE /* aCancelable */, cOperations, Bstr(mDesc).raw()); - if (FAILED(hr)) + hrc = pProgress->init(static_cast<IGuestSession*>(mSession), + Bstr(mDesc).raw(), + TRUE /* aCancelable */, cOperations, Bstr(mDesc).raw()); + if (FAILED(hrc)) return VERR_COM_UNEXPECTED; mProgress = pProgress; @@ -158,10 +158,8 @@ int GuestSessionTask::getGuestProperty(const ComObjPtr<Guest> &pGuest, Assert(!pMachine.isNull()); Bstr strTemp, strFlags; LONG64 i64Timestamp; - HRESULT hr = pMachine->GetGuestProperty(Bstr(strPath).raw(), - strTemp.asOutParam(), - &i64Timestamp, strFlags.asOutParam()); - if (SUCCEEDED(hr)) + HRESULT hrc = pMachine->GetGuestProperty(Bstr(strPath).raw(), strTemp.asOutParam(), &i64Timestamp, strFlags.asOutParam()); + if (SUCCEEDED(hrc)) { strValue = strTemp; return VINF_SUCCESS; @@ -191,8 +189,8 @@ int GuestSessionTask::setProgress(ULONG uPercent) AssertMsgFailed(("Setting value of an already completed progress\n")); return VINF_SUCCESS; } - HRESULT hr = mProgress->SetCurrentOperationProgress(uPercent); - if (FAILED(hr)) + HRESULT hrc = mProgress->SetCurrentOperationProgress(uPercent); + if (FAILED(hrc)) return VERR_COM_UNEXPECTED; return VINF_SUCCESS; @@ -217,9 +215,9 @@ int GuestSessionTask::setProgressSuccess(void) ULONG cOps; mProgress->COMGETTER(OperationCount(&cOps)); AssertMsg(uCurOp + 1 /* Zero-based */ == cOps, ("Not all operations done yet (%u/%u)\n", uCurOp + 1, cOps)); #endif - HRESULT hr = mProgress->i_notifyComplete(S_OK); - if (FAILED(hr)) - return VERR_COM_UNEXPECTED; /** @todo Find a better rc. */ + HRESULT hrc = mProgress->i_notifyComplete(S_OK); + if (FAILED(hrc)) + return VERR_COM_UNEXPECTED; /** @todo Find a better vrc. */ } return VINF_SUCCESS; @@ -228,16 +226,16 @@ int GuestSessionTask::setProgressSuccess(void) /** * Sets the task's progress object to an error using a string message. * - * @returns Returns \a hr for convenience. - * @param hr Progress operation result to set. + * @returns Returns \a hrc for convenience. + * @param hrc Progress operation result to set. * @param strMsg Message to set. */ -HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg) +HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg) { - LogFlowFunc(("hr=%Rhrc, strMsg=%s\n", hr, strMsg.c_str())); + LogFlowFunc(("hrc=%Rhrc, strMsg=%s\n", hrc, strMsg.c_str())); if (mProgress.isNull()) /* Progress is optional. */ - return hr; /* Return original rc. */ + return hrc; /* Return original status. */ BOOL fCanceled; BOOL fCompleted; @@ -246,30 +244,30 @@ HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg) && SUCCEEDED(mProgress->COMGETTER(Completed(&fCompleted))) && !fCompleted) { - HRESULT hr2 = mProgress->i_notifyComplete(hr, - COM_IIDOF(IGuestSession), - GuestSession::getStaticComponentName(), - /* Make sure to hand-in the message via format string to avoid problems - * with (file) paths which e.g. contain "%s" and friends. Can happen with - * randomly generated Validation Kit stuff. */ - "%s", strMsg.c_str()); - if (FAILED(hr2)) - return hr2; + HRESULT hrc2 = mProgress->i_notifyComplete(hrc, + COM_IIDOF(IGuestSession), + GuestSession::getStaticComponentName(), + /* Make sure to hand-in the message via format string to avoid problems + * with (file) paths which e.g. contain "%s" and friends. Can happen with + * randomly generated Validation Kit stuff. */ + "%s", strMsg.c_str()); + if (FAILED(hrc2)) + return hrc2; } - return hr; /* Return original rc. */ + return hrc; /* Return original status. */ } /** * Sets the task's progress object to an error using a string message and a guest error info object. * - * @returns Returns \a hr for convenience. - * @param hr Progress operation result to set. + * @returns Returns \a hrc for convenience. + * @param hrc Progress operation result to set. * @param strMsg Message to set. * @param guestErrorInfo Guest error info to use. */ -HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo) +HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo) { - return setProgressErrorMsg(hr, strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo)); + return setProgressErrorMsg(hrc, strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo)); } /** @@ -1370,12 +1368,13 @@ int FsList::AddDirFromHost(const Utf8Str &strPath, const Utf8Str &strSubDir, } if (RT_FAILURE(vrc)) - LogRel2(("Guest Control: Unable to query symbolic link info for \"%s\", rc=%Rrc\n", + LogRel2(("Guest Control: Unable to query symbolic link info for \"%s\", vrc=%Rrc\n", pszPathReal, vrc)); } else { - LogRel2(("Guest Control: Unable to resolve symlink for \"%s\", rc=%Rrc\n", strPathAbs.c_str(), vrc)); + LogRel2(("Guest Control: Unable to resolve symlink for \"%s\", vrc=%Rrc\n", + strPathAbs.c_str(), vrc)); if (vrc == VERR_FILE_NOT_FOUND) /* Broken symlink, skip. */ vrc = VINF_SUCCESS; } @@ -1400,7 +1399,7 @@ int FsList::AddDirFromHost(const Utf8Str &strPath, const Utf8Str &strSubDir, vrc = VERR_NOT_SUPPORTED; } else - LogFlowFunc(("Unable to query \"%s\", rc=%Rrc\n", strPathAbs.c_str(), vrc)); + LogFlowFunc(("Unable to query \"%s\", vrc=%Rrc\n", strPathAbs.c_str(), vrc)); LogFlowFuncLeaveRC(vrc); return vrc; @@ -2656,7 +2655,7 @@ int GuestSessionTaskUpdateAdditions::runFileOnGuest(GuestSession *pSession, Gues GuestErrorInfo(GuestErrorInfo::Type_Process, vrcGuest, procInfo.mExecutable.c_str())); break; - case VERR_INVALID_STATE: /** @todo Special guest control rc needed! */ + case VERR_INVALID_STATE: /** @todo Special guest control vrc needed! */ setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"), procInfo.mExecutable.c_str())); @@ -2683,10 +2682,10 @@ int GuestSessionTaskUpdateAdditions::runFileOnGuest(GuestSession *pSession, Gues int GuestSessionTaskUpdateAdditions::waitForGuestSession(ComObjPtr<Guest> pGuest) { int vrc = VERR_GSTCTL_GUEST_ERROR; - int rc = VERR_TIMEOUT; + int vrcRet = VERR_TIMEOUT; uint64_t tsStart = RTTimeSystemMilliTS(); - const uint64_t timeoutMs = 600 * 1000; + const uint64_t cMsTimeout = 10 * RT_MS_1MIN; AssertReturn(!pGuest.isNull(), VERR_TIMEOUT); @@ -2702,22 +2701,20 @@ int GuestSessionTaskUpdateAdditions::waitForGuestSession(ComObjPtr<Guest> pGuest vrc = pGuest->i_sessionCreate(startupInfo, guestCreds, pSession); if (RT_SUCCESS(vrc)) { - int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */ - Assert(!pSession.isNull()); + int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */ vrc = pSession->i_startSession(&vrcGuest); if (RT_SUCCESS(vrc)) { - GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None; - int rcGuest = 0; /* unused. */ - /* Wait for VBoxService to start. */ - vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &rcGuest); + GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None; + int vrcGuest2 = VINF_SUCCESS; /* unused. */ + vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &vrcGuest2); if (RT_SUCCESS(vrc)) { vrc = pSession->Close(); - rc = 0; + vrcRet = VINF_SUCCESS; break; } } @@ -2727,9 +2724,9 @@ int GuestSessionTaskUpdateAdditions::waitForGuestSession(ComObjPtr<Guest> pGuest RTThreadSleep(100); - } while ((RTTimeSystemMilliTS() - tsStart) < timeoutMs); + } while ((RTTimeSystemMilliTS() - tsStart) < cMsTimeout); - return rc; + return vrcRet; } /** @copydoc GuestSessionTask::Run */ |