Changeset 98272 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 24, 2023 10:57:32 AM (2 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r98103 r98272 102 102 { 103 103 Assert(m_cRefs <= 1); 104 int rc = RTEnvDestroy(m_hEnv); AssertRC(rc);104 int vrc = RTEnvDestroy(m_hEnv); AssertRC(vrc); 105 105 m_hEnv = NIL_RTENV; 106 106 } … … 170 170 void reset(void) 171 171 { 172 int rc = RTEnvReset(m_hEnv);173 AssertRC( rc);172 int vrc = RTEnvReset(m_hEnv); 173 AssertRC(vrc); 174 174 } 175 175 … … 215 215 for (size_t i = 0; i < cArray; i++) 216 216 { 217 int rc = RTEnvPutEx(m_hEnv, rArray[i].c_str());218 if (RT_FAILURE( rc))217 int vrc = RTEnvPutEx(m_hEnv, rArray[i].c_str()); 218 if (RT_FAILURE(vrc)) 219 219 { 220 220 if (pidxError) 221 221 *pidxError = i; 222 return rc;222 return vrc; 223 223 } 224 224 } … … 275 275 int copyUtf8Block(const char *pszzBlock, size_t cbBlock, bool fNoEqualMeansUnset = false) 276 276 { 277 int rc = VINF_SUCCESS;277 int vrc = VINF_SUCCESS; 278 278 while (cbBlock > 0 && *pszzBlock != '\0') 279 279 { … … 281 281 if (!pszEnd) 282 282 return VERR_BUFFER_UNDERFLOW; 283 int rc2;283 int vrc2; 284 284 if (fNoEqualMeansUnset || strchr(pszzBlock, '=')) 285 rc2 = RTEnvPutEx(m_hEnv, pszzBlock);285 vrc2 = RTEnvPutEx(m_hEnv, pszzBlock); 286 286 else 287 rc2 = RTEnvSetEx(m_hEnv, pszzBlock, "");288 if (RT_FAILURE( rc2) && RT_SUCCESS(rc))289 rc =rc2;287 vrc2 = RTEnvSetEx(m_hEnv, pszzBlock, ""); 288 if (RT_FAILURE(vrc2) && RT_SUCCESS(vrc)) 289 vrc = vrc2; 290 290 291 291 /* Advance. */ … … 298 298 299 299 /* The remainder must be zero padded. */ 300 if (RT_SUCCESS( rc))300 if (RT_SUCCESS(vrc)) 301 301 { 302 302 if (ASMMemIsZero(pszzBlock, cbBlock)) … … 304 304 return VERR_TOO_MUCH_DATA; 305 305 } 306 return rc;306 return vrc; 307 307 } 308 308 … … 318 318 { 319 319 size_t cchNeeded; 320 int rc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded);321 if ( RT_SUCCESS( rc)322 || rc == VERR_BUFFER_OVERFLOW)320 int vrc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded); 321 if ( RT_SUCCESS(vrc) 322 || vrc == VERR_BUFFER_OVERFLOW) 323 323 { 324 324 try 325 325 { 326 326 pValue->reserve(cchNeeded + 1); 327 rc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL);327 vrc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL); 328 328 pValue->jolt(); 329 329 } 330 330 catch (std::bad_alloc &) 331 331 { 332 rc = VERR_NO_STR_MEMORY;332 vrc = VERR_NO_STR_MEMORY; 333 333 } 334 334 } 335 return rc;335 return vrc; 336 336 } 337 337 … … 384 384 , m_fFlags(fFlags) 385 385 { 386 int rc = cloneCommon(rThat, fChangeRecord);387 if (RT_FAILURE( rc))388 throw (Global::vboxStatusCodeToCOM(rc));386 int vrc = cloneCommon(rThat, fChangeRecord); 387 if (RT_FAILURE(vrc)) 388 throw Global::vboxStatusCodeToCOM(vrc); 389 389 } 390 390 … … 399 399 int cloneCommon(const GuestEnvironmentBase &rThat, bool fChangeRecord) 400 400 { 401 int rc = VINF_SUCCESS;401 int vrc = VINF_SUCCESS; 402 402 RTENV hNewEnv = NIL_RTENV; 403 403 if (rThat.m_hEnv != NIL_RTENV) … … 407 407 */ 408 408 if (RTEnvIsChangeRecord(rThat.m_hEnv) == fChangeRecord) 409 rc = RTEnvClone(&hNewEnv, rThat.m_hEnv);409 vrc = RTEnvClone(&hNewEnv, rThat.m_hEnv); 410 410 else 411 411 { 412 412 /* Need to type convert it. */ 413 413 if (fChangeRecord) 414 rc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags);414 vrc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags); 415 415 else 416 rc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags);417 if (RT_SUCCESS( rc))416 vrc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags); 417 if (RT_SUCCESS(vrc)) 418 418 { 419 rc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv);420 if (RT_FAILURE( rc))419 vrc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv); 420 if (RT_FAILURE(vrc)) 421 421 RTEnvDestroy(hNewEnv); 422 422 } … … 430 430 */ 431 431 if (fChangeRecord) 432 rc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags);432 vrc = RTEnvCreateChangeRecordEx(&hNewEnv, rThat.m_fFlags); 433 433 else 434 rc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags);434 vrc = RTEnvCreateEx(&hNewEnv, rThat.m_fFlags); 435 435 } 436 if (RT_SUCCESS( rc))436 if (RT_SUCCESS(vrc)) 437 437 { 438 438 RTEnvDestroy(m_hEnv); … … 440 440 m_fFlags = rThat.m_fFlags; 441 441 } 442 return rc;442 return vrc; 443 443 } 444 444 … … 517 517 GuestEnvironment &operator=(const GuestEnvironmentBase &rThat) 518 518 { 519 int rc = copy(rThat);520 if (RT_FAILURE( rc))521 throw (Global::vboxStatusCodeToCOM(rc));519 int vrc = copy(rThat); 520 if (RT_FAILURE(vrc)) 521 throw Global::vboxStatusCodeToCOM(vrc); 522 522 return *this; 523 523 } … … 599 599 GuestEnvironmentChanges &operator=(const GuestEnvironmentBase &rThat) 600 600 { 601 int rc = copy(rThat);602 if (RT_FAILURE( rc))603 throw (Global::vboxStatusCodeToCOM(rc));601 int vrc = copy(rThat); 602 if (RT_FAILURE(vrc)) 603 throw Global::vboxStatusCodeToCOM(vrc); 604 604 return *this; 605 605 } … … 656 656 * 657 657 * @param eType Error type to use. 658 * @param rc IPRT-style rcto use.658 * @param vrc VBox status code to use. 659 659 * @param pcszWhat Subject to use. 660 660 */ 661 GuestErrorInfo(GuestErrorInfo::Type eType, int rc, const char *pcszWhat)662 { 663 int rc2 = setV(eType,rc, pcszWhat);664 if (RT_FAILURE( rc2))665 throw rc2;666 } 667 668 /** 669 * Returns the (IPRT-style) rc ofthis error.661 GuestErrorInfo(GuestErrorInfo::Type eType, int vrc, const char *pcszWhat) 662 { 663 int vrc2 = setV(eType, vrc, pcszWhat); 664 if (RT_FAILURE(vrc2)) 665 throw vrc2; 666 } 667 668 /** 669 * Returns the VBox status code for this error. 670 670 * 671 671 * @returns VBox status code. 672 672 */ 673 int get Rc(void) const { return mRc; }673 int getVrc(void) const { return mVrc; } 674 674 675 675 /** … … 692 692 * @returns VBox status code. 693 693 * @param eType Error type to use. 694 * @param rc IPRT-style rcto use.694 * @param vrc VBox status code to use. 695 695 * @param pcszWhat Subject to use. 696 696 */ 697 int setV(GuestErrorInfo::Type eType, int rc, const char *pcszWhat)697 int setV(GuestErrorInfo::Type eType, int vrc, const char *pcszWhat) 698 698 { 699 699 mType = eType; 700 m Rc =rc;700 mVrc = vrc; 701 701 mWhat = pcszWhat; 702 702 … … 708 708 /** Error type. */ 709 709 Type mType; 710 /** IPRT-style errorcode. */711 int m Rc;710 /** VBox status (error) code. */ 711 int mVrc; 712 712 /** Subject string related to this error. */ 713 713 Utf8Str mWhat; … … 983 983 const char *GetString(const char *pszKey) const; 984 984 size_t GetCount(void) const; 985 int Get Rc(void) const;985 int GetVrc(void) const; 986 986 int GetInt64Ex(const char *pszKey, int64_t *piVal) const; 987 987 int64_t GetInt64(const char *pszKey) const; … … 1057 1057 1058 1058 GuestWaitEventPayload(void) 1059 : uType(0), 1060 cbData(0), 1061 pvData(NULL) { } 1062 1063 /** 1064 * Initialization constructor. Will throw() VBox status code (rc). 1059 : uType(0) 1060 , cbData(0) 1061 , pvData(NULL) 1062 { } 1063 1064 /** 1065 * Initialization constructor. 1066 * 1067 * @throws VBox status code (vrc). 1065 1068 * 1066 1069 * @param uTypePayload Payload type to set. … … 1068 1071 * @param cbPayload Size (in bytes) of payload data to set. 1069 1072 */ 1070 GuestWaitEventPayload(uint32_t uTypePayload, 1071 const void *pvPayload, uint32_t cbPayload) 1072 : uType(0), 1073 cbData(0), 1074 pvData(NULL) 1075 { 1076 int rc = copyFrom(uTypePayload, pvPayload, cbPayload); 1077 if (RT_FAILURE(rc)) 1078 throw rc; 1073 GuestWaitEventPayload(uint32_t uTypePayload, const void *pvPayload, uint32_t cbPayload) 1074 : uType(0) 1075 , cbData(0) 1076 , pvData(NULL) 1077 { 1078 int vrc = copyFrom(uTypePayload, pvPayload, cbPayload); 1079 if (RT_FAILURE(vrc)) 1080 throw vrc; 1079 1081 } 1080 1082 … … 1141 1143 Clear(); 1142 1144 1143 int rc = VINF_SUCCESS; 1144 1145 int vrc = VINF_SUCCESS; 1145 1146 if (cbPayload) 1146 1147 { … … 1154 1155 } 1155 1156 else 1156 rc = VERR_NO_MEMORY;1157 vrc = VERR_NO_MEMORY; 1157 1158 } 1158 1159 else … … 1164 1165 } 1165 1166 1166 return rc;1167 return vrc; 1167 1168 } 1168 1169 … … 1187 1188 public: 1188 1189 1189 uint32_t 1190 int 1191 int Result(void) { return mRc; }1192 GuestWaitEventPayload &Payload(void) { return mPayload; }1193 int SignalInternal(int rc, int guestRc, const GuestWaitEventPayload *pPayload);1194 int 1190 uint32_t ContextID(void) { return mCID; }; 1191 int GuestResult(void) { return mGuestRc; } 1192 int Result(void) { return mVrc; } 1193 GuestWaitEventPayload &Payload(void) { return mPayload; } 1194 int SignalInternal(int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload); 1195 int Wait(RTMSINTERVAL uTimeoutMS); 1195 1196 1196 1197 protected: … … 1200 1201 protected: 1201 1202 1202 /* Shutdown indicator. */1203 /** Shutdown indicator. */ 1203 1204 bool mfAborted; 1204 /* Associated context ID (CID). */1205 /** Associated context ID (CID). */ 1205 1206 uint32_t mCID; 1206 /** The event semaphore for triggering 1207 * the actual event. */ 1207 /** The event semaphore for triggering the actual event. */ 1208 1208 RTSEMEVENT mEventSem; 1209 /** The event's overall result. If 1210 * set to VERR_GSTCTL_GUEST_ERROR, 1211 * mGuestRc will contain the actual 1212 * error code from the guest side. */ 1213 int mRc; 1214 /** The event'S overall result from the 1215 * guest side. If used, mRc must be 1216 * set to VERR_GSTCTL_GUEST_ERROR. */ 1209 /** The event's overall result. 1210 * If set to VERR_GSTCTL_GUEST_ERROR, mGuestRc will contain the actual 1211 * error code from the guest side. */ 1212 int mVrc; 1213 /** The event'S overall result from the guest side. 1214 * If used, mVrc must be set to VERR_GSTCTL_GUEST_ERROR. */ 1217 1215 int mGuestRc; 1218 1216 /** The event's payload data. Optional. */ … … 1237 1235 int Cancel(void); 1238 1236 const ComPtr<IEvent> Event(void) { return mEvent; } 1239 bool HasGuestError(void) const { return m Rc == VERR_GSTCTL_GUEST_ERROR; }1237 bool HasGuestError(void) const { return mVrc == VERR_GSTCTL_GUEST_ERROR; } 1240 1238 int GetGuestError(void) const { return mGuestRc; } 1241 1239 int SignalExternal(IEvent *pEvent); … … 1271 1269 * for external event listeners. */ 1272 1270 int signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent); 1273 /** Signals a wait event using a guest rc. */1274 int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int guestRc, const GuestWaitEventPayload *pPayload);1271 /** Signals a wait event using a guest vrc. */ 1272 int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrcGuest, const GuestWaitEventPayload *pPayload); 1275 1273 /** Signals a wait event without letting public guest events know, 1276 1274 * extended director's cut version. */ 1277 int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int rc, int guestRc, const GuestWaitEventPayload *pPayload);1275 int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload); 1278 1276 1279 1277 public: -
trunk/src/VBox/Main/include/GuestDirectoryImpl.h
r98103 r98272 68 68 /** @name Public internal methods. 69 69 * @{ */ 70 int i_closeInternal(int *p GuestRc);71 int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *p GuestRc);70 int i_closeInternal(int *pvrcGuest); 71 int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pvrcGuest); 72 72 int i_readInternal(GuestFsObjData &objData, int *prcGuest); 73 73 /** @} */ … … 76 76 /** @name Public static internal methods. 77 77 * @{ */ 78 static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat);78 static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat); 79 79 /** @} */ 80 80 -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r98103 r98272 73 73 inline int i_checkPID(uint32_t uPID); 74 74 ProcessStatus_T i_getStatus(void); 75 int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *p GuestRc);76 int i_startProcess(uint32_t cMsTimeout, int *p GuestRc);77 int i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *p GuestRc);75 int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pvrcGuest); 76 int i_startProcess(uint32_t cMsTimeout, int *pvrcGuest); 77 int i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pvrcGuest); 78 78 int i_startProcessAsync(void); 79 int i_terminateProcess(uint32_t uTimeoutMS, int *p GuestRc);79 int i_terminateProcess(uint32_t uTimeoutMS, int *pvrcGuest); 80 80 ProcessWaitResult_T i_waitFlagsToResult(uint32_t fWaitFlags); 81 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *p GuestRc);81 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pvrcGuest); 82 82 int i_waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed); 83 83 int i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, void* pvData, size_t cbData, uint32_t *pcbRead); 84 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *p GuestRc);85 int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *p GuestRc);84 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pvrcGuest); 85 int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pvrcGuest); 86 86 /** @} */ 87 87 88 88 /** @name Static internal methods. 89 89 * @{ */ 90 static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat);90 static Utf8Str i_guestErrorToString(int vrcGuest, const char *pcszWhat); 91 91 static Utf8Str i_statusToString(ProcessStatus_T enmStatus); 92 92 static bool i_isGuestError(int guestRc); … … 108 108 int i_onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData); 109 109 int i_prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); 110 int i_setProcessStatus(ProcessStatus_T procStatus, int procRc);110 int i_setProcessStatus(ProcessStatus_T procStatus, int vrcProc); 111 111 static int i_startProcessThreadTask(GuestProcessStartTask *pTask); 112 112 /** @} */ … … 210 210 struct GuestProcessToolErrorInfo 211 211 { 212 /** Return code from the guest side for executing the process tool. */213 int rcGuest;212 /** Return (VBox status) code from the guest side for executing the process tool. */ 213 int vrcGuest; 214 214 /** The process tool's returned exit code. */ 215 215 int32_t iExitCode; … … 240 240 public: 241 241 242 int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *p GuestRc);242 int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pvrcGuest); 243 243 244 244 void uninit(void); … … 254 254 GuestProcessStream &getStdErr(void) { return mStdErr; } 255 255 256 int wait(uint32_t fToolWaitFlags, int *p GuestRc);257 258 int waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStreamBlock, int *p GuestRc);256 int wait(uint32_t fToolWaitFlags, int *pvrcGuest); 257 258 int waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStreamBlock, int *pvrcGuest); 259 259 260 260 bool isRunning(void); … … 264 264 int getTerminationStatus(int32_t *piExitCode = NULL); 265 265 266 int terminate(uint32_t uTimeoutMS, int *p GuestRc);266 int terminate(uint32_t uTimeoutMS, int *pvrcGuest); 267 267 268 268 public: … … 270 270 /** Wrapped @name Static run methods. 271 271 * @{ */ 272 static int run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *p GuestRc);272 static int run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pvrcGuest); 273 273 274 274 static int runErrorInfo(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, GuestProcessToolErrorInfo &errorInfo); 275 275 276 276 static int runEx(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, 277 GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *p GuestRc);277 GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *pvrcGuest); 278 278 279 279 static int runExErrorInfo(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r98262 r98272 291 291 HRESULT i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination, 292 292 ComPtr<IProgress> &pProgress); 293 int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *p GuestRc);293 int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest); 294 294 HRESULT i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, DirectoryCopyFlag_T *pfFlags); 295 295 bool i_directoryExists(const Utf8Str &strPath); 296 296 inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir); 297 297 int i_directoryUnregister(GuestDirectory *pDirectory); 298 int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *p GuestRc);299 int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *p GuestRc);298 int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest); 299 int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest); 300 300 int i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, 301 ComObjPtr<GuestDirectory> &pDirectory, int *p GuestRc);302 int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *p GuestRc);301 ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest); 302 int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); 303 303 int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); 304 304 int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); … … 306 306 inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile); 307 307 int i_fileUnregister(GuestFile *pFile); 308 int i_fileRemove(const Utf8Str &strPath, int *p GuestRc);308 int i_fileRemove(const Utf8Str &strPath, int *pvrcGuest); 309 309 int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, 310 310 FileSharingMode_T aSharingMode, ULONG aCreationMode, 311 311 const std::vector<FileOpenExFlag_T> &aFlags, 312 ComObjPtr<GuestFile> &pFile, int *p rcGuest);313 int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *p GuestRc);314 int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *p GuestRc);315 int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *p GuestRc);312 ComObjPtr<GuestFile> &pFile, int *pvrcGuest); 313 int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest); 314 int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); 315 int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest); 316 316 int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, 317 Utf8Str &strName, uint32_t fMode, bool fSecure, int *p GuestRc);318 int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *p GuestRc);317 Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest); 318 int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); 319 319 const GuestCredentials &i_getCredentials(void); 320 320 EventSource *i_getEventSource(void) { return mEventSource; } … … 328 328 PathStyle_T i_getGuestPathStyle(void); 329 329 static PathStyle_T i_getHostPathStyle(void); 330 int i_startSession(int *p GuestRc);330 int i_startSession(int *pvrcGuest); 331 331 int i_startSessionAsync(void); 332 332 Guest *i_getParent(void) { return mParent; } … … 336 336 int i_objectsUnregister(void); 337 337 int i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessionStatus); 338 int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *p GuestRc);339 int i_pathUserDocuments(Utf8Str &strPath, int *p rcGuest);340 int i_pathUserHome(Utf8Str &strPath, int *p rcGuest);338 int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest); 339 int i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest); 340 int i_pathUserHome(Utf8Str &strPath, int *pvrcGuest); 341 341 int i_processUnregister(GuestProcess *pProcess); 342 342 int i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress); … … 345 345 int i_sendMessage(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms, 346 346 uint64_t fDst = VBOX_GUESTCTRL_DST_SESSION); 347 int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);348 int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);349 int i_shutdown(uint32_t fFlags, int *p rcGuest);347 int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession); 348 int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */); 349 int i_shutdown(uint32_t fFlags, int *pvrcGuest); 350 350 int i_determineProtocolVersion(void); 351 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *p GuestRc);351 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest); 352 352 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, 353 GuestSessionStatus_T *pSessionStatus, int *p GuestRc);353 GuestSessionStatus_T *pSessionStatus, int *pvrcGuest); 354 354 /** @} */ 355 355 -
trunk/src/VBox/Main/include/GuestSessionImplTasks.h
r98103 r98272 218 218 { 219 219 setTaskDesc(strTaskDesc); 220 int rc = createAndSetProgressObject(); /* Single operation by default. */ 221 if (RT_FAILURE(rc)) 222 return E_FAIL; 223 224 return S_OK; 220 int vrc = createAndSetProgressObject(); /* Single operation by default. */ 221 if (RT_SUCCESS(vrc)) 222 return S_OK; 223 return E_FAIL; 225 224 } 226 225 … … 262 261 int setProgress(ULONG uPercent); 263 262 int setProgressSuccess(void); 264 HRESULT setProgressErrorMsg(HRESULT hr , const Utf8Str &strMsg);265 HRESULT setProgressErrorMsg(HRESULT hr , const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo);263 HRESULT setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg); 264 HRESULT setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo); 266 265 267 266 inline void setTaskDesc(const Utf8Str &strTaskDesc) throw() -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r98103 r98272 203 203 204 204 /* Object size. */ 205 int rc = strmBlk.GetInt64Ex("st_size", &mObjectSize);206 ASSERT_GUEST_RC_RETURN( rc,rc);205 int vrc = strmBlk.GetInt64Ex("st_size", &mObjectSize); 206 ASSERT_GUEST_RC_RETURN(vrc, vrc); 207 207 strmBlk.GetInt64Ex("alloc", &mAllocatedSize); 208 208 … … 261 261 mName = strmBlk.GetString("fname"); 262 262 263 /* Return the stream block's rc. */264 return strmBlk.Get Rc();263 /* Return the stream block's vrc. */ 264 return strmBlk.GetVrc(); 265 265 } 266 266 … … 296 296 ASSERT_GUEST_RETURN(mName.isNotEmpty(), VERR_NOT_FOUND); 297 297 298 /* Assign the stream block's rc. */ 299 int rc = strmBlk.GetRc(); 300 301 LogFlowFuncLeaveRC(rc); 302 return rc; 298 /* Assign the stream block's vrc. */ 299 int const vrc = strmBlk.GetVrc(); 300 LogFlowFuncLeaveRC(vrc); 301 return vrc; 303 302 } 304 303 … … 426 425 * @retval VERR_NOT_FOUND if the return code string ("rc") was not found. 427 426 */ 428 int GuestProcessStreamBlock::Get Rc(void) const427 int GuestProcessStreamBlock::GetVrc(void) const 429 428 { 430 429 const char *pszValue = GetString("rc"); 431 430 if (pszValue) 432 {433 431 return RTStrToInt16(pszValue); 434 }435 432 /** @todo We probably should have a dedicated error for that, VERR_GSTCTL_GUEST_TOOLBOX_whatever. */ 436 433 return VERR_NOT_FOUND; … … 491 488 { 492 489 int32_t iRet; 493 int rc = RTStrToInt32Full(pszValue, 0, &iRet);494 if (RT_SUCCESS( rc))490 int vrc = RTStrToInt32Full(pszValue, 0, &iRet); 491 if (RT_SUCCESS(vrc)) 495 492 return iRet; 496 493 ASSERT_GUEST_MSG_FAILED(("%s=%s\n", pszKey, pszValue)); … … 525 522 AssertPtrReturn(pszKey, VERR_INVALID_POINTER); 526 523 527 int rc = VINF_SUCCESS;524 int vrc = VINF_SUCCESS; 528 525 try 529 526 { 530 Utf8Str Utf8Key(pszKey);527 Utf8Str const strKey(pszKey); 531 528 532 529 /* Take a shortcut and prevent crashes on some funny versions … … 534 531 if (!mPairs.empty()) 535 532 { 536 GuestCtrlStreamPairMapIter it = mPairs.find( Utf8Key);533 GuestCtrlStreamPairMapIter it = mPairs.find(strKey); 537 534 if (it != mPairs.end()) 538 535 mPairs.erase(it); … … 542 539 { 543 540 GuestProcessStreamValue val(pszValue); 544 mPairs[ Utf8Key] = val;545 } 546 } 547 catch (const std::exception & ex)548 { 549 RT_NOREF(ex);550 } 551 return rc;541 mPairs[strKey] = val; 542 } 543 } 544 catch (const std::exception &) 545 { 546 /** @todo set vrc? */ 547 } 548 return vrc; 552 549 } 553 550 … … 579 576 AssertReturn(cbData, VERR_INVALID_PARAMETER); 580 577 581 int rc = VINF_SUCCESS;578 int vrc = VINF_SUCCESS; 582 579 583 580 /* Rewind the buffer if it's empty. */ … … 620 617 } 621 618 else 622 rc = VERR_NO_MEMORY;619 vrc = VERR_NO_MEMORY; 623 620 } 624 621 else 625 rc = VERR_TOO_MUCH_DATA;622 vrc = VERR_TOO_MUCH_DATA; 626 623 } 627 624 628 625 /* Finally, copy the data. */ 629 if (RT_SUCCESS( rc))626 if (RT_SUCCESS(vrc)) 630 627 { 631 628 if (cbData + m_cbUsed <= m_cbAllocated) … … 635 632 } 636 633 else 637 rc = VERR_BUFFER_OVERFLOW;638 } 639 } 640 641 return rc;634 vrc = VERR_BUFFER_OVERFLOW; 635 } 636 } 637 638 return vrc; 642 639 } 643 640 … … 671 668 672 669 RTFILE hFile; 673 int rc = RTFileOpen(&hFile, pszFile, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE);674 if (RT_SUCCESS( rc))675 { 676 rc = RTFileWrite(hFile, m_pbBuffer, m_cbUsed, NULL /* pcbWritten */);670 int vrc = RTFileOpen(&hFile, pszFile, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE); 671 if (RT_SUCCESS(vrc)) 672 { 673 vrc = RTFileWrite(hFile, m_pbBuffer, m_cbUsed, NULL /* pcbWritten */); 677 674 RTFileClose(hFile); 678 675 } … … 707 704 return VERR_NO_DATA; 708 705 709 int rc= VINF_SUCCESS;706 int vrc = VINF_SUCCESS; 710 707 char * const pszOff = (char *)&m_pbBuffer[m_offBuffer]; 711 708 size_t cbLeft = m_offBuffer < m_cbUsed ? m_cbUsed - m_offBuffer : 0; … … 716 713 if (!pszPairEnd) 717 714 { 718 rc = VERR_MORE_DATA;715 vrc = VERR_MORE_DATA; 719 716 break; 720 717 } … … 725 722 else 726 723 { 727 rc = VERR_MORE_DATA; /** @todo r=bird: This is BOGUS because we'll be stuck here if the guest feeds us bad data! */724 vrc = VERR_MORE_DATA; /** @todo r=bird: This is BOGUS because we'll be stuck here if the guest feeds us bad data! */ 728 725 break; 729 726 } 730 727 char const * const pszVal = pszSep + 1; 731 728 732 rc = streamBlock.SetValue(pszStart, pszVal);733 if (RT_FAILURE( rc))734 return rc;729 vrc = streamBlock.SetValue(pszStart, pszVal); 730 if (RT_FAILURE(vrc)) 731 return vrc; 735 732 736 733 /* Next pair. */ … … 750 747 m_offBuffer += cbDistance; 751 748 752 return rc;749 return vrc; 753 750 } 754 751 … … 770 767 int GuestBase::baseInit(void) 771 768 { 772 int rc = RTCritSectInit(&mWaitEventCritSect); 773 774 LogFlowFuncLeaveRC(rc); 775 return rc; 769 int const vrc = RTCritSectInit(&mWaitEventCritSect); 770 LogFlowFuncLeaveRC(vrc); 771 return vrc; 776 772 } 777 773 … … 784 780 785 781 /* Make sure to cancel any outstanding wait events. */ 786 int rc2 = cancelWaitEvents();787 AssertRC( rc2);788 789 rc2 = RTCritSectDelete(&mWaitEventCritSect);790 AssertRC( rc2);791 792 LogFlowFuncLeaveRC( rc2);782 int vrc2 = cancelWaitEvents(); 783 AssertRC(vrc2); 784 785 vrc2 = RTCritSectDelete(&mWaitEventCritSect); 786 AssertRC(vrc2); 787 788 LogFlowFuncLeaveRC(vrc2); 793 789 /* No return value. */ 794 790 } … … 803 799 LogFlowThisFuncEnter(); 804 800 805 int rc = RTCritSectEnter(&mWaitEventCritSect);806 if (RT_SUCCESS( rc))801 int vrc = RTCritSectEnter(&mWaitEventCritSect); 802 if (RT_SUCCESS(vrc)) 807 803 { 808 804 GuestEventGroup::iterator itEventGroups = mWaitEventGroups.begin(); … … 820 816 * is done by the caller using unregisterWaitEvent(). 821 817 */ 822 int rc2 = pEvent->Cancel();823 AssertRC( rc2);818 int vrc2 = pEvent->Cancel(); 819 AssertRC(vrc2); 824 820 825 821 ++itEvents; … … 829 825 } 830 826 831 int rc2 = RTCritSectLeave(&mWaitEventCritSect);832 if (RT_SUCCESS( rc))833 rc =rc2;834 } 835 836 LogFlowFuncLeaveRC( rc);837 return rc;827 int vrc2 = RTCritSectLeave(&mWaitEventCritSect); 828 if (RT_SUCCESS(vrc)) 829 vrc = vrc2; 830 } 831 832 LogFlowFuncLeaveRC(vrc); 833 return vrc; 838 834 } 839 835 … … 884 880 vrc = signalWaitEventInternal(pCtxCb, dataCb.rc, &evPayload); 885 881 } 886 catch (int rcEx) /* Thrown by GuestWaitEventPayload constructor. */882 catch (int vrcEx) /* Thrown by GuestWaitEventPayload constructor. */ 887 883 { 888 vrc = rcEx;884 vrc = vrcEx; 889 885 } 890 886 } … … 903 899 vrc = VERR_NO_MEMORY; 904 900 } 905 catch (int rc)906 { 907 vrc = rc;901 catch (int vrc) 902 { 903 vrc = vrc; 908 904 } 909 905 … … 990 986 991 987 uint32_t idContext; 992 int rc = generateContextID(uSessionID, uObjectID, &idContext);993 AssertRCReturn( rc,rc);988 int vrc = generateContextID(uSessionID, uObjectID, &idContext); 989 AssertRCReturn(vrc, vrc); 994 990 995 991 GuestWaitEvent *pEvent = new GuestWaitEvent(); 996 992 AssertPtrReturn(pEvent, VERR_NO_MEMORY); 997 993 998 rc = pEvent->Init(idContext, lstEvents);999 AssertRCReturn( rc,rc);994 vrc = pEvent->Init(idContext, lstEvents); 995 AssertRCReturn(vrc, vrc); 1000 996 1001 997 LogFlowThisFunc(("New event=%p, CID=%RU32\n", pEvent, idContext)); 1002 998 1003 rc = RTCritSectEnter(&mWaitEventCritSect);1004 if (RT_SUCCESS( rc))999 vrc = RTCritSectEnter(&mWaitEventCritSect); 1000 if (RT_SUCCESS(vrc)) 1005 1001 { 1006 1002 /* … … 1015 1011 do 1016 1012 { 1017 rc = generateContextID(uSessionID, uObjectID, &idContext);1018 AssertRCBreak( rc);1013 vrc = generateContextID(uSessionID, uObjectID, &idContext); 1014 AssertRCBreak(vrc); 1019 1015 LogFunc(("Found context ID duplicate; trying a different context ID: %#x\n", idContext)); 1020 1016 if (mWaitEvents.find(idContext) != mWaitEvents.end()) 1021 rc = VERR_GSTCTL_MAX_CID_COUNT_REACHED;1022 } while (RT_FAILURE_NP( rc) && cTries++ < 10);1023 } 1024 if (RT_SUCCESS( rc))1017 vrc = VERR_GSTCTL_MAX_CID_COUNT_REACHED; 1018 } while (RT_FAILURE_NP(vrc) && cTries++ < 10); 1019 } 1020 if (RT_SUCCESS(vrc)) 1025 1021 { 1026 1022 /* … … 1045 1041 mWaitEventGroups[*ItType].erase(idContext); 1046 1042 } 1047 rc = VERR_NO_MEMORY;1043 vrc = VERR_NO_MEMORY; 1048 1044 break; 1049 1045 } … … 1052 1048 Assert(cInserts > 0); /* else: lstEvents has duplicate entries. */ 1053 1049 } 1054 if (RT_SUCCESS( rc))1050 if (RT_SUCCESS(vrc)) 1055 1051 { 1056 1052 Assert(cInserts > 0 || lstEvents.size() == 0); … … 1068 1064 for (GuestEventTypes::const_iterator ItType = lstEvents.begin(); ItType != lstEvents.end(); ++ItType) 1069 1065 mWaitEventGroups[*ItType].erase(idContext); 1070 rc = VERR_NO_MEMORY;1066 vrc = VERR_NO_MEMORY; 1071 1067 } 1072 1068 } … … 1075 1071 RTCritSectLeave(&mWaitEventCritSect); 1076 1072 } 1077 if (RT_SUCCESS( rc))1073 if (RT_SUCCESS(vrc)) 1078 1074 { 1079 1075 *ppEvent = pEvent; 1080 return rc;1076 return vrc; 1081 1077 } 1082 1078 … … 1084 1080 delete pEvent; 1085 1081 1086 return rc;1082 return vrc; 1087 1083 } 1088 1084 … … 1097 1093 int GuestBase::signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent) 1098 1094 { 1099 int rc = RTCritSectEnter(&mWaitEventCritSect);1095 int vrc = RTCritSectEnter(&mWaitEventCritSect); 1100 1096 #ifdef DEBUG 1101 1097 uint32_t cEvents = 0; 1102 1098 #endif 1103 if (RT_SUCCESS( rc))1099 if (RT_SUCCESS(vrc)) 1104 1100 { 1105 1101 GuestEventGroup::iterator itGroup = mWaitEventGroups.find(aType); … … 1114 1110 VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(ItWaitEvt->first), VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(ItWaitEvt->first))); 1115 1111 1116 int rc2 = ItWaitEvt->second->SignalExternal(aEvent);1117 AssertRC( rc2);1112 int vrc2 = ItWaitEvt->second->SignalExternal(aEvent); 1113 AssertRC(vrc2); 1118 1114 1119 1115 /* Take down the wait event object details before we erase it from this list and invalid ItGrpEvt. */ … … 1140 1136 } 1141 1137 1142 int rc2 = RTCritSectLeave(&mWaitEventCritSect);1143 if (RT_SUCCESS( rc))1144 rc =rc2;1138 int vrc2 = RTCritSectLeave(&mWaitEventCritSect); 1139 if (RT_SUCCESS(vrc)) 1140 vrc = vrc2; 1145 1141 } 1146 1142 1147 1143 #ifdef DEBUG 1148 LogFlowThisFunc(("Signalled %RU32 events, rc=%Rrc\n", cEvents,rc));1144 LogFlowThisFunc(("Signalled %RU32 events, vrc=%Rrc\n", cEvents, vrc)); 1149 1145 #endif 1150 return rc;1146 return vrc; 1151 1147 } 1152 1148 … … 1155 1151 * 1156 1152 * @returns VBox status code. 1157 * @param pCbCtx Pointer to host service callback context. 1158 * @param rcGuest Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR. 1159 * @param pPayload Additional wait event payload data set set on return. Optional. 1160 */ 1161 int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, 1162 int rcGuest, const GuestWaitEventPayload *pPayload) 1163 { 1164 if (RT_SUCCESS(rcGuest)) 1165 return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS, 1166 0 /* Guest rc */, pPayload); 1167 1168 return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR, 1169 rcGuest, pPayload); 1153 * @param pCbCtx Pointer to host service callback context. 1154 * @param vrcGuest Guest return VBox status code to set. 1155 * @param pPayload Additional wait event payload data set set on return. Optional. 1156 */ 1157 int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrcGuest, const GuestWaitEventPayload *pPayload) 1158 { 1159 if (RT_SUCCESS(vrcGuest)) 1160 return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS, VINF_SUCCESS /* vrcGuest */, pPayload); 1161 1162 return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR, vrcGuest, pPayload); 1170 1163 } 1171 1164 … … 1175 1168 * 1176 1169 * @returns VBox status code. 1177 * @param pCbCtx 1178 * @param rc Return code (rc)to set as wait result.1179 * @param rcGuest Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR.1180 * @param pPayload Additional wait event payload data set set on return. Optional.1181 * /1182 int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, 1183 int rc, intrcGuest,1170 * @param pCbCtx Pointer to host service callback context. 1171 * @param vrc Return VBox status code to set as wait result. 1172 * @param vrcGuest Guest return VBox status code to set additionally, if 1173 * vrc is set to VERR_GSTCTL_GUEST_ERROR. 1174 * @param pPayload Additional wait event payload data set set on return. Optional. 1175 */ 1176 int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int vrc, int vrcGuest, 1184 1177 const GuestWaitEventPayload *pPayload) 1185 1178 { … … 1187 1180 /* pPayload is optional. */ 1188 1181 1189 int rc2 = RTCritSectEnter(&mWaitEventCritSect);1190 if (RT_SUCCESS( rc2))1182 int vrc2 = RTCritSectEnter(&mWaitEventCritSect); 1183 if (RT_SUCCESS(vrc2)) 1191 1184 { 1192 1185 GuestWaitEvents::iterator itEvent = mWaitEvents.find(pCbCtx->uContextID); 1193 1186 if (itEvent != mWaitEvents.end()) 1194 1187 { 1195 LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc,rcGuest=%Rrc, pPayload=%p) ...\n",1196 itEvent->second, itEvent->first, rc,rcGuest, pPayload));1188 LogFlowThisFunc(("Signalling event=%p (CID %RU32, vrc=%Rrc, vrcGuest=%Rrc, pPayload=%p) ...\n", 1189 itEvent->second, itEvent->first, vrc, vrcGuest, pPayload)); 1197 1190 GuestWaitEvent *pEvent = itEvent->second; 1198 1191 AssertPtr(pEvent); 1199 rc2 = pEvent->SignalInternal(rc,rcGuest, pPayload);1192 vrc2 = pEvent->SignalInternal(vrc, vrcGuest, pPayload); 1200 1193 } 1201 1194 else 1202 rc2 = VERR_NOT_FOUND;1203 1204 int rc3 = RTCritSectLeave(&mWaitEventCritSect);1205 if (RT_SUCCESS( rc2))1206 rc2 =rc3;1207 } 1208 1209 return rc2;1195 vrc2 = VERR_NOT_FOUND; 1196 1197 int vrc3 = RTCritSectLeave(&mWaitEventCritSect); 1198 if (RT_SUCCESS(vrc2)) 1199 vrc2 = vrc3; 1200 } 1201 1202 return vrc2; 1210 1203 } 1211 1204 … … 1223 1216 return VINF_SUCCESS; 1224 1217 1225 int rc = RTCritSectEnter(&mWaitEventCritSect);1226 if (RT_SUCCESS( rc))1218 int vrc = RTCritSectEnter(&mWaitEventCritSect); 1219 if (RT_SUCCESS(vrc)) 1227 1220 { 1228 1221 LogFlowThisFunc(("pWaitEvt=%p\n", pWaitEvt)); … … 1281 1274 { 1282 1275 RT_NOREF(ex); 1283 AssertFailedStmt( rc = VERR_NOT_FOUND);1284 } 1285 1286 int rc2 = RTCritSectLeave(&mWaitEventCritSect);1287 if (RT_SUCCESS( rc))1288 rc =rc2;1289 } 1290 1291 return rc;1276 AssertFailedStmt(vrc = VERR_NOT_FOUND); 1277 } 1278 1279 int vrc2 = RTCritSectLeave(&mWaitEventCritSect); 1280 if (RT_SUCCESS(vrc)) 1281 vrc = vrc2; 1282 } 1283 1284 return vrc; 1292 1285 } 1293 1286 … … 1318 1311 if (pType) 1319 1312 { 1320 HRESULT hr = pThisEvent->COMGETTER(Type)(pType);1321 if (FAILED(hr ))1313 HRESULT hrc = pThisEvent->COMGETTER(Type)(pType); 1314 if (FAILED(hrc)) 1322 1315 vrc = VERR_COM_UNEXPECTED; 1323 1316 } … … 1355 1348 /* static */ Utf8Str GuestBase::getErrorAsString(const GuestErrorInfo& guestErrorInfo) 1356 1349 { 1357 AssertMsg(RT_FAILURE(guestErrorInfo.get Rc()), ("Guestrc does not indicate a failure\n"));1350 AssertMsg(RT_FAILURE(guestErrorInfo.getVrc()), ("Guest vrc does not indicate a failure\n")); 1358 1351 1359 1352 Utf8Str strErr; … … 1369 1362 { 1370 1363 case GuestErrorInfo::Type_Session: 1371 strErr = GuestSession::i_guestErrorToString(guestErrorInfo.get Rc());1364 strErr = GuestSession::i_guestErrorToString(guestErrorInfo.getVrc()); 1372 1365 break; 1373 1366 1374 1367 case GuestErrorInfo::Type_Process: 1375 strErr = GuestProcess::i_guestErrorToString(guestErrorInfo.get Rc(), guestErrorInfo.getWhat().c_str());1368 strErr = GuestProcess::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str()); 1376 1369 break; 1377 1370 1378 1371 case GuestErrorInfo::Type_File: 1379 strErr = GuestFile::i_guestErrorToString(guestErrorInfo.get Rc(), guestErrorInfo.getWhat().c_str());1372 strErr = GuestFile::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str()); 1380 1373 break; 1381 1374 1382 1375 case GuestErrorInfo::Type_Directory: 1383 strErr = GuestDirectory::i_guestErrorToString(guestErrorInfo.get Rc(), guestErrorInfo.getWhat().c_str());1376 strErr = GuestDirectory::i_guestErrorToString(guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str()); 1384 1377 break; 1385 1378 … … 1392 1385 1393 1386 default: 1394 AssertMsgFailed(("Type not implemented (type=%RU32, rc=%Rrc)\n", guestErrorInfo.getType(), guestErrorInfo.getRc()));1395 strErr = Utf8StrFmt("Unknown / Not implemented -- Please file a bug report (type=%RU32, rc=%Rrc)\n",1396 guestErrorInfo.getType(), guestErrorInfo.get Rc());1387 AssertMsgFailed(("Type not implemented (type=%RU32, vrc=%Rrc)\n", guestErrorInfo.getType(), guestErrorInfo.getVrc())); 1388 strErr = Utf8StrFmt("Unknown / Not implemented -- Please file a bug report (type=%RU32, vrc=%Rrc)\n", 1389 guestErrorInfo.getType(), guestErrorInfo.getVrc()); 1397 1390 break; 1398 1391 } … … 1552 1545 mCID(0), 1553 1546 mEventSem(NIL_RTSEMEVENT), 1554 m Rc(VINF_SUCCESS),1547 mVrc(VINF_SUCCESS), 1555 1548 mGuestRc(VINF_SUCCESS) 1556 1549 { … … 1583 1576 * 1584 1577 * @returns VBox status code. 1585 * @param rc Return code (rc)to set as wait result.1586 * @param rcGuest Guest return code (rc) to set additionally, if rc is set to VERR_GSTCTL_GUEST_ERROR.1587 * @param pPayload Additional wait event payload data set set on return. Optional.1588 * /1589 int GuestWaitEventBase::SignalInternal(int rc, int rcGuest, 1590 1578 * @param vrc Return VBox status code to set as wait result. 1579 * @param vrcGuest Guest return VBox status code to set additionally, if 1580 * @a vrc is set to VERR_GSTCTL_GUEST_ERROR. 1581 * @param pPayload Additional wait event payload data set set on return. Optional. 1582 */ 1583 int GuestWaitEventBase::SignalInternal(int vrc, int vrcGuest, const GuestWaitEventPayload *pPayload) 1591 1584 { 1592 1585 if (mfAborted) … … 1594 1587 1595 1588 #ifdef VBOX_STRICT 1596 if ( rc == VERR_GSTCTL_GUEST_ERROR)1597 AssertMsg(RT_FAILURE( rcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n",rcGuest));1589 if (vrc == VERR_GSTCTL_GUEST_ERROR) 1590 AssertMsg(RT_FAILURE(vrcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", vrcGuest)); 1598 1591 else 1599 AssertMsg(RT_SUCCESS( rcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n",rcGuest));1592 AssertMsg(RT_SUCCESS(vrcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", vrcGuest)); 1600 1593 #endif 1601 1594 1602 int rc2;1595 int vrc2; 1603 1596 if (pPayload) 1604 rc2 = mPayload.CopyFromDeep(*pPayload);1597 vrc2 = mPayload.CopyFromDeep(*pPayload); 1605 1598 else 1606 rc2 = VINF_SUCCESS;1607 if (RT_SUCCESS( rc2))1608 { 1609 m Rc =rc;1610 mGuestRc = rcGuest;1611 1612 rc2 = RTSemEventSignal(mEventSem);1613 } 1614 1615 return rc2;1599 vrc2 = VINF_SUCCESS; 1600 if (RT_SUCCESS(vrc2)) 1601 { 1602 mVrc = vrc; 1603 mGuestRc = vrcGuest; 1604 1605 vrc2 = RTSemEventSignal(mEventSem); 1606 } 1607 1608 return vrc2; 1616 1609 } 1617 1610 … … 1629 1622 int GuestWaitEventBase::Wait(RTMSINTERVAL msTimeout) 1630 1623 { 1631 int rc = VINF_SUCCESS; 1632 1633 if (mfAborted) 1634 rc = VERR_CANCELLED; 1635 1636 if (RT_SUCCESS(rc)) 1624 int vrc; 1625 if (!mfAborted) 1637 1626 { 1638 1627 AssertReturn(mEventSem != NIL_RTSEMEVENT, VERR_CANCELLED); 1639 1628 1640 rc = RTSemEventWait(mEventSem, msTimeout ? msTimeout : RT_INDEFINITE_WAIT);1641 if ( RT_SUCCESS( rc)1629 vrc = RTSemEventWait(mEventSem, msTimeout ? msTimeout : RT_INDEFINITE_WAIT); 1630 if ( RT_SUCCESS(vrc) 1642 1631 && mfAborted) 1643 { 1644 rc = VERR_CANCELLED; 1645 } 1646 1647 if (RT_SUCCESS(rc)) 1632 vrc = VERR_CANCELLED; 1633 1634 if (RT_SUCCESS(vrc)) 1648 1635 { 1649 1636 /* If waiting succeeded, return the overall 1650 1637 * result code. */ 1651 rc = mRc; 1652 } 1653 } 1654 1655 return rc; 1638 vrc = mVrc; 1639 } 1640 } 1641 else 1642 vrc = VERR_CANCELLED; 1643 return vrc; 1656 1644 } 1657 1645 … … 1701 1689 int GuestWaitEvent::Init(uint32_t uCID, const GuestEventTypes &lstEvents) 1702 1690 { 1703 int rc = GuestWaitEventBase::Init(uCID); 1704 if (RT_SUCCESS(rc)) 1705 { 1691 int vrc = GuestWaitEventBase::Init(uCID); 1692 if (RT_SUCCESS(vrc)) 1706 1693 mEventTypes = lstEvents; 1707 } 1708 1709 return rc; 1694 1695 return vrc; 1710 1696 } 1711 1697 -
trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
r98262 r98272 113 113 * it later in subsequent read() calls. 114 114 */ 115 vrc = mData.mProcessTool.init(mSession, procInfo, false /* Async */, NULL /* Guest rc*/);115 vrc = mData.mProcessTool.init(mSession, procInfo, false /*fAsync*/, NULL /*pvrcGuest*/); 116 116 if (RT_SUCCESS(vrc)) 117 117 { … … 244 244 * 245 245 * @returns Error string. 246 * @param rcGuestGuest file error to return string for.246 * @param vrcGuest Guest file error to return string for. 247 247 * @param pcszWhat Hint of what was involved when the error occurred. 248 248 */ 249 249 /* static */ 250 Utf8Str GuestDirectory::i_guestErrorToString(int rcGuest, const char *pcszWhat)250 Utf8Str GuestDirectory::i_guestErrorToString(int vrcGuest, const char *pcszWhat) 251 251 { 252 252 AssertPtrReturn(pcszWhat, ""); 253 253 254 254 Utf8Str strErr; 255 switch ( rcGuest)255 switch (vrcGuest) 256 256 { 257 257 #define CASE_MSG(a_iRc, ...) \ … … 260 260 CASE_MSG(VERR_DIR_NOT_EMPTY, tr("Guest directory \"%s\" is not empty"), pcszWhat); 261 261 default: 262 strErr.printf(tr("Error %Rrc for guest directory \"%s\" occurred\n"), rcGuest, pcszWhat);262 strErr.printf(tr("Error %Rrc for guest directory \"%s\" occurred\n"), vrcGuest, pcszWhat); 263 263 break; 264 264 } -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r98262 r98272 223 223 AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED); 224 224 225 HRESULT hr ;225 HRESULT hrc; 226 226 227 227 int vrc = bindToSession(aConsole, aSession, aObjectID); 228 228 if (RT_SUCCESS(vrc)) 229 229 { 230 hr = unconst(mEventSource).createObject();231 if (FAILED(hr ))230 hrc = unconst(mEventSource).createObject(); 231 if (FAILED(hrc)) 232 232 vrc = VERR_NO_MEMORY; 233 233 else 234 234 { 235 hr = mEventSource->init();236 if (FAILED(hr ))235 hrc = mEventSource->init(); 236 if (FAILED(hrc)) 237 237 vrc = VERR_COM_UNEXPECTED; 238 238 } … … 245 245 GuestProcessListener *pListener = new GuestProcessListener(); 246 246 ComObjPtr<GuestProcessListenerImpl> thisListener; 247 hr = thisListener.createObject();248 if (SUCCEEDED(hr ))249 hr = thisListener->init(pListener, this);250 251 if (SUCCEEDED(hr ))247 hrc = thisListener.createObject(); 248 if (SUCCEEDED(hrc)) 249 hrc = thisListener->init(pListener, this); 250 251 if (SUCCEEDED(hrc)) 252 252 { 253 253 com::SafeArray <VBoxEventType_T> eventTypes; … … 255 255 eventTypes.push_back(VBoxEventType_OnGuestProcessInputNotify); 256 256 eventTypes.push_back(VBoxEventType_OnGuestProcessOutput); 257 hr = mEventSource->RegisterListener(thisListener,257 hrc = mEventSource->RegisterListener(thisListener, 258 258 ComSafeArrayAsInParam(eventTypes), 259 259 TRUE /* Active listener */); 260 if (SUCCEEDED(hr ))260 if (SUCCEEDED(hrc)) 261 261 { 262 262 vrc = baseInit(); … … 541 541 * 542 542 * @returns Error as a string. 543 * @param rcGuestGuest process error to return string for.544 * @param pcszWhat 543 * @param vrcGuest Guest process error to return string for. 544 * @param pcszWhat Hint of what was involved when the error occurred. 545 545 */ 546 546 /* static */ 547 Utf8Str GuestProcess::i_guestErrorToString(int rcGuest, const char *pcszWhat)547 Utf8Str GuestProcess::i_guestErrorToString(int vrcGuest, const char *pcszWhat) 548 548 { 549 549 AssertPtrReturn(pcszWhat, ""); 550 550 551 551 Utf8Str strErr; 552 switch ( rcGuest)552 switch (vrcGuest) 553 553 { 554 554 #define CASE_MSG(a_iRc, ...) \ … … 567 567 CASE_MSG(VERR_NOT_FOUND, tr("The guest execution service is not ready (yet)")); 568 568 default: 569 strErr.printf(tr("Error %Rrc for guest process \"%s\" occurred\n"), rcGuest, pcszWhat);569 strErr.printf(tr("Error %Rrc for guest process \"%s\" occurred\n"), vrcGuest, pcszWhat); 570 570 break; 571 571 #undef CASE_MSG … … 622 622 * @return bool @c true if the passed in error code indicates an error which came 623 623 * from the guest side, or @c false if not. 624 * @param rcError code to check.624 * @param vrc Error code to check. 625 625 */ 626 626 /* static */ 627 bool GuestProcess::i_isGuestError(int rc)628 { 629 return (rc == VERR_GSTCTL_GUEST_ERROR630 || rc == VERR_GSTCTL_PROCESS_EXIT_CODE);627 bool GuestProcess::i_isGuestError(int vrc) 628 { 629 return vrc == VERR_GSTCTL_GUEST_ERROR 630 || vrc == VERR_GSTCTL_PROCESS_EXIT_CODE; 631 631 } 632 632 … … 638 638 inline bool GuestProcess::i_isAlive(void) 639 639 { 640 return (mData.mStatus == ProcessStatus_Started641 642 || mData.mStatus == ProcessStatus_Terminating);640 return mData.mStatus == ProcessStatus_Started 641 || mData.mStatus == ProcessStatus_Paused 642 || mData.mStatus == ProcessStatus_Terminating; 643 643 } 644 644 … … 650 650 inline bool GuestProcess::i_hasEnded(void) 651 651 { 652 return (mData.mStatus == ProcessStatus_TerminatedNormally653 654 655 656 657 658 || mData.mStatus == ProcessStatus_Error);652 return mData.mStatus == ProcessStatus_TerminatedNormally 653 || mData.mStatus == ProcessStatus_TerminatedSignal 654 || mData.mStatus == ProcessStatus_TerminatedAbnormally 655 || mData.mStatus == ProcessStatus_TimedOutKilled 656 || mData.mStatus == ProcessStatus_TimedOutAbnormally 657 || mData.mStatus == ProcessStatus_Down 658 || mData.mStatus == ProcessStatus_Error; 659 659 } 660 660 … … 802 802 { 803 803 ProcessStatus_T procStatus = ProcessStatus_Undefined; 804 int procRc = VINF_SUCCESS;804 int vrcProc = VINF_SUCCESS; 805 805 806 806 switch (dataCb.uStatus) … … 859 859 case PROC_STS_ERROR: 860 860 { 861 procRc = dataCb.uFlags; /* mFlags contains the IPRT error sent from the guest. */861 vrcProc = dataCb.uFlags; /* mFlags contains the IPRT error sent from the guest. */ 862 862 procStatus = ProcessStatus_Error; 863 863 break; … … 873 873 } 874 874 875 LogFlowThisFunc(("Got rc=%Rrc, procSts=%RU32, procRc=%Rrc\n", 876 vrc, procStatus, procRc)); 875 LogFlowThisFunc(("Got vrc=%Rrc, procSts=%RU32, vrcProc=%Rrc\n", vrc, procStatus, vrcProc)); 877 876 878 877 /* Set the process status. */ 879 int vrc2 = i_setProcessStatus(procStatus, procRc);878 int vrc2 = i_setProcessStatus(procStatus, vrcProc); 880 879 if (RT_SUCCESS(vrc)) 881 880 vrc = vrc2; … … 972 971 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 973 972 974 vrc = i_setProcessStatus(ProcessStatus_Down, 0 /* rc, ignored */);973 vrc = i_setProcessStatus(ProcessStatus_Down, VINF_SUCCESS /* vrcProc, ignored */); 975 974 } 976 975 … … 991 990 * @param pcbRead Where to return to size (in bytes) read on success. 992 991 * Optional. 993 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR994 * was returned. Optional.992 * @param pvrcGuest Where to return the guest error when 993 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 995 994 * 996 995 * @note Takes the write lock. 997 996 */ 998 997 int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, 999 void *pvData, size_t cbData, uint32_t *pcbRead, int *p rcGuest)1000 { 1001 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, p rcGuest=%p\n",1002 mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, p rcGuest));998 void *pvData, size_t cbData, uint32_t *pcbRead, int *pvrcGuest) 999 { 1000 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, pvrcGuest=%p\n", 1001 mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, pvrcGuest)); 1003 1002 AssertReturn(uSize, VERR_INVALID_PARAMETER); 1004 1003 AssertPtrReturn(pvData, VERR_INVALID_POINTER); … … 1020 1019 if (pcbRead) 1021 1020 *pcbRead = 0; 1022 if (p rcGuest)1023 *p rcGuest = VINF_SUCCESS;1021 if (pvrcGuest) 1022 *pvrcGuest = VINF_SUCCESS; 1024 1023 return VINF_SUCCESS; /* Nothing to read anymore. */ 1025 1024 } … … 1081 1080 * @returns VBox status code. 1082 1081 * @param procStatus Guest process status to set. 1083 * @param procRcGuest process result code to set.1082 * @param vrcProc Guest process result code to set. 1084 1083 * 1085 1084 * @note Takes the write lock. 1086 1085 */ 1087 int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int procRc)1086 int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int vrcProc) 1088 1087 { 1089 1088 LogFlowThisFuncEnter(); … … 1091 1090 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1092 1091 1093 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, procRc=%Rrc\n", 1094 mData.mStatus, procStatus, procRc)); 1092 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, vrcProc=%Rrc\n", mData.mStatus, procStatus, vrcProc)); 1095 1093 1096 1094 if (procStatus == ProcessStatus_Error) 1097 1095 { 1098 AssertMsg(RT_FAILURE( procRc), ("Guest rc must be an error (%Rrc)\n", procRc));1096 AssertMsg(RT_FAILURE(vrcProc), ("Guest vrcProc must be an error (%Rrc)\n", vrcProc)); 1099 1097 /* Do not allow overwriting an already set error. If this happens 1100 1098 * this means we forgot some error checking/locking somewhere. */ 1101 AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest rc already set (to %Rrc)\n", mData.mLastError));1099 AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest vrcProc already set (to %Rrc)\n", mData.mLastError)); 1102 1100 } 1103 1101 else 1104 AssertMsg(RT_SUCCESS( procRc), ("Guest rc must not be an error (%Rrc)\n", procRc));1102 AssertMsg(RT_SUCCESS(vrcProc), ("Guest vrcProc must not be an error (%Rrc)\n", vrcProc)); 1105 1103 1106 1104 int vrc = VINF_SUCCESS; … … 1109 1107 { 1110 1108 mData.mStatus = procStatus; 1111 mData.mLastError = procRc;1109 mData.mLastError = vrcProc; 1112 1110 1113 1111 ComObjPtr<VirtualBoxErrorInfo> errorInfo; … … 1153 1151 * @returns VBox status code. 1154 1152 * @param cMsTimeout Timeout (in ms) to wait for starting the process. 1155 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1156 * was returned. Optional.1153 * @param pvrcGuest Where to return the guest error when 1154 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1157 1155 * 1158 1156 * @note Takes the write lock. 1159 1157 */ 1160 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *p rcGuest)1158 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *pvrcGuest) 1161 1159 { 1162 1160 LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n", … … 1186 1184 return vrc; 1187 1185 1188 vrc = i_startProcessInner(cMsTimeout, alock, pEvent, p rcGuest);1186 vrc = i_startProcessInner(cMsTimeout, alock, pEvent, pvrcGuest); 1189 1187 1190 1188 unregisterWaitEvent(pEvent); … … 1201 1199 * @param rLock Write lock to use for serialization. 1202 1200 * @param pEvent Event to use for notifying waiters. 1203 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1204 * was returned. Optional.1205 */ 1206 int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *p rcGuest)1201 * @param pvrcGuest Where to return the guest error when 1202 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1203 */ 1204 int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *pvrcGuest) 1207 1205 { 1208 1206 GuestSession *pSession = mSession; … … 1318 1316 1319 1317 if (RT_SUCCESS(vrc)) 1320 vrc = i_waitForStatusChange(pEvent, cMsTimeout, 1321 NULL /* Process status */, prcGuest); 1318 vrc = i_waitForStatusChange(pEvent, cMsTimeout, NULL /* Process status */, pvrcGuest); 1322 1319 return vrc; 1323 1320 } … … 1373 1370 return VERR_COM_UNEXPECTED; 1374 1371 1375 int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, NULL /* Guest rc, ignored */);1372 int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */, NULL /* pvrcGuest, ignored */); 1376 1373 /* Nothing to do here anymore. */ 1377 1374 … … 1387 1384 * @retval VERR_NOT_SUPPORTED if process termination is not supported on the guest. 1388 1385 * @param uTimeoutMS Timeout (in ms) to wait for process termination. 1389 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1390 * was returned. Optional.1386 * @param pvrcGuest Where to return the guest error when 1387 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1391 1388 * 1392 1389 * @note Takes the write lock. 1393 1390 */ 1394 int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *prcGuest) 1395 { 1396 /* prcGuest is optional. */ 1391 int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *pvrcGuest) 1392 { 1397 1393 LogFlowThisFunc(("uTimeoutMS=%RU32\n", uTimeoutMS)); 1398 1394 … … 1443 1439 if (RT_SUCCESS(vrc)) 1444 1440 vrc = i_waitForStatusChange(pEvent, uTimeoutMS, 1445 NULL /* ProcessStatus */, p rcGuest);1441 NULL /* ProcessStatus */, pvrcGuest); 1446 1442 unregisterWaitEvent(pEvent); 1447 1443 } … … 1591 1587 * @param uTimeoutMS Timeout (in ms) to wait. 1592 1588 * @param waitResult Where to return the process wait result on success. 1593 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1594 * was returned. Optional.1589 * @param pvrcGuest Where to return the guest error when 1590 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1595 1591 * @note Takes the read lock. 1596 1592 */ 1597 int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, 1598 ProcessWaitResult_T &waitResult, int *prcGuest) 1593 int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pvrcGuest) 1599 1594 { 1600 1595 AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER); … … 1602 1597 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1603 1598 1604 LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, prcGuest=%p\n",1605 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, p rcGuest));1599 LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, vrcProc=%Rrc, pvrcGuest=%p\n", 1600 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, pvrcGuest)); 1606 1601 1607 1602 /* Did some error occur before? Then skip waiting and return. */ … … 1611 1606 waitResult = ProcessWaitResult_Error; 1612 1607 AssertMsg(RT_FAILURE(mData.mLastError), 1613 ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError));1614 if (p rcGuest)1615 *p rcGuest = mData.mLastError; /* Return last set error. */1616 LogFlowThisFunc(("Process is in error state ( rcGuest=%Rrc)\n", mData.mLastError));1608 ("No error vrc (%Rrc) set when guest process indicated an error\n", mData.mLastError)); 1609 if (pvrcGuest) 1610 *pvrcGuest = mData.mLastError; /* Return last set error. */ 1611 LogFlowThisFunc(("Process is in error state (vrcGuest=%Rrc)\n", mData.mLastError)); 1617 1612 return VERR_GSTCTL_GUEST_ERROR; 1618 1613 } … … 1623 1618 if (waitResult != ProcessWaitResult_None) 1624 1619 { 1625 if (p rcGuest)1626 *p rcGuest = mData.mLastError; /* Return last set error (if any). */1627 LogFlowThisFunc(("Nothing to wait for ( rcGuest=%Rrc)\n", mData.mLastError));1620 if (pvrcGuest) 1621 *pvrcGuest = mData.mLastError; /* Return last set error (if any). */ 1622 LogFlowThisFunc(("Nothing to wait for (vrcGuest=%Rrc)\n", mData.mLastError)); 1628 1623 return RT_SUCCESS(mData.mLastError) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; 1629 1624 } … … 1669 1664 1670 1665 vrc = i_waitForStatusChange(pEvent, 1671 uTimeoutMS == RT_INDEFINITE_WAIT 1672 ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS, 1673 &newStatus, prcGuest); 1666 uTimeoutMS == RT_INDEFINITE_WAIT ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS, 1667 &newStatus, pvrcGuest); 1674 1668 if (RT_SUCCESS(vrc)) 1675 1669 { … … 1693 1687 unregisterWaitEvent(pEvent); 1694 1688 1695 LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, rc=%Rrc\n", 1696 waitResult, newStatus, vrc)); 1689 LogFlowThisFunc(("Returned waitResult=%RU32, newStatus=%RU32, vrc=%Rrc\n", waitResult, newStatus, vrc)); 1697 1690 return vrc; 1698 1691 } … … 1726 1719 if (pInputStatus) 1727 1720 { 1728 HRESULT hr 2 = pProcessEvent->COMGETTER(Status)(pInputStatus);1729 ComAssertComRC(hr 2);1721 HRESULT hrc2 = pProcessEvent->COMGETTER(Status)(pInputStatus); 1722 ComAssertComRC(hrc2); 1730 1723 } 1731 1724 if (pcbProcessed) 1732 1725 { 1733 HRESULT hr 2 = pProcessEvent->COMGETTER(Processed)((ULONG*)pcbProcessed);1734 ComAssertComRC(hr 2);1726 HRESULT hrc2 = pProcessEvent->COMGETTER(Processed)((ULONG*)pcbProcessed); 1727 ComAssertComRC(hrc2); 1735 1728 } 1736 1729 } … … 1739 1732 } 1740 1733 1741 LogFlowThisFunc(("Returning pEvent=%p, uHandle=%RU32, rc=%Rrc\n", 1742 pEvent, uHandle, vrc)); 1734 LogFlowThisFunc(("Returning pEvent=%p, uHandle=%RU32, vrc=%Rrc\n", pEvent, uHandle, vrc)); 1743 1735 return vrc; 1744 1736 } … … 1782 1774 1783 1775 ULONG uHandleEvent; 1784 HRESULT hr = pProcessEvent->COMGETTER(Handle)(&uHandleEvent);1785 if ( SUCCEEDED(hr )1776 HRESULT hrc = pProcessEvent->COMGETTER(Handle)(&uHandleEvent); 1777 if ( SUCCEEDED(hrc) 1786 1778 && uHandleEvent == uHandle) 1787 1779 { … … 1789 1781 { 1790 1782 com::SafeArray <BYTE> data; 1791 hr = pProcessEvent->COMGETTER(Data)(ComSafeArrayAsOutParam(data));1792 ComAssertComRC(hr );1783 hrc = pProcessEvent->COMGETTER(Data)(ComSafeArrayAsOutParam(data)); 1784 ComAssertComRC(hrc); 1793 1785 size_t cbRead = data.size(); 1794 1786 if (cbRead) … … 1802 1794 vrc = VERR_BUFFER_OVERFLOW; 1803 1795 1804 LogFlowThisFunc(("Read %zu bytes (uHandle=%RU32), rc=%Rrc\n", 1805 cbRead, uHandleEvent, vrc)); 1796 LogFlowThisFunc(("Read %zu bytes (uHandle=%RU32), vrc=%Rrc\n", cbRead, uHandleEvent, vrc)); 1806 1797 } 1807 1798 } … … 1811 1802 { 1812 1803 ULONG cbRead; 1813 hr = pProcessEvent->COMGETTER(Processed)(&cbRead);1814 ComAssertComRC(hr );1804 hrc = pProcessEvent->COMGETTER(Processed)(&cbRead); 1805 ComAssertComRC(hrc); 1815 1806 *pcbRead = (uint32_t)cbRead; 1816 1807 } … … 1818 1809 break; 1819 1810 } 1820 else if (FAILED(hr ))1811 else if (FAILED(hrc)) 1821 1812 vrc = VERR_COM_UNEXPECTED; 1822 1813 } … … 1845 1836 * @param uTimeoutMS Timeout (in ms) to wait. 1846 1837 * @param pProcessStatus Where to return the process status on success. 1847 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1848 * was returned.1838 * @param pvrcGuest Where to return the guest error when 1839 * VERR_GSTCTL_GUEST_ERROR was returned. 1849 1840 */ 1850 1841 int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, 1851 ProcessStatus_T *pProcessStatus, int *p rcGuest)1842 ProcessStatus_T *pProcessStatus, int *pvrcGuest) 1852 1843 { 1853 1844 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 1854 1845 /* pProcessStatus is optional. */ 1855 /* p rcGuest is optional. */1846 /* pvrcGuest is optional. */ 1856 1847 1857 1848 VBoxEventType_T evtType; … … 1866 1857 1867 1858 ProcessStatus_T procStatus; 1868 HRESULT hr = pProcessEvent->COMGETTER(Status)(&procStatus);1869 ComAssertComRC(hr );1859 HRESULT hrc = pProcessEvent->COMGETTER(Status)(&procStatus); 1860 ComAssertComRC(hrc); 1870 1861 if (pProcessStatus) 1871 1862 *pProcessStatus = procStatus; 1872 1863 1873 1864 ComPtr<IVirtualBoxErrorInfo> errorInfo; 1874 hr = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam());1875 ComAssertComRC(hr );1865 hrc = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam()); 1866 ComAssertComRC(hrc); 1876 1867 1877 1868 LONG lGuestRc; 1878 hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); 1879 ComAssertComRC(hr); 1880 1881 LogFlowThisFunc(("Got procStatus=%RU32, rcGuest=%RI32 (%Rrc)\n", 1882 procStatus, lGuestRc, lGuestRc)); 1869 hrc = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); 1870 ComAssertComRC(hrc); 1871 1872 LogFlowThisFunc(("Got procStatus=%RU32, vrcGuest=%RI32 (%Rrc)\n", procStatus, lGuestRc, lGuestRc)); 1883 1873 1884 1874 if (RT_FAILURE((int)lGuestRc)) 1885 1875 vrc = VERR_GSTCTL_GUEST_ERROR; 1886 1876 1887 if (p rcGuest)1888 *p rcGuest = (int)lGuestRc;1889 } 1890 /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make p rcGuest is set. */1891 else if (vrc == VERR_GSTCTL_GUEST_ERROR && p rcGuest)1892 *p rcGuest = pEvent->GuestResult();1893 Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !p rcGuest || *prcGuest != (int)0xcccccccc);1877 if (pvrcGuest) 1878 *pvrcGuest = (int)lGuestRc; 1879 } 1880 /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make pvrcGuest is set. */ 1881 else if (vrc == VERR_GSTCTL_GUEST_ERROR && pvrcGuest) 1882 *pvrcGuest = pEvent->GuestResult(); 1883 Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !pvrcGuest || *pvrcGuest != (int)0xcccccccc); 1894 1884 1895 1885 LogFlowFuncLeaveRC(vrc); … … 1941 1931 * @param uTimeoutMS Timeout (in ms) to wait. 1942 1932 * @param puWritten Where to return the size (in bytes) written. Optional. 1943 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1944 * was returned. Optional.1933 * @param pvrcGuest Where to return the guest error when 1934 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1945 1935 * 1946 1936 * @note Takes the write lock. 1947 1937 */ 1948 1938 int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags, 1949 void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *p rcGuest)1950 { 1951 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, p rcGuest=%p\n",1952 mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, p rcGuest));1939 void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pvrcGuest) 1940 { 1941 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, pvrcGuest=%p\n", 1942 mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, pvrcGuest)); 1953 1943 /* All is optional. There can be 0 byte writes. */ 1954 1944 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1958 1948 if (puWritten) 1959 1949 *puWritten = 0; 1960 if (p rcGuest)1961 *p rcGuest = VINF_SUCCESS;1950 if (pvrcGuest) 1951 *pvrcGuest = VINF_SUCCESS; 1962 1952 return VINF_SUCCESS; /* Not available for writing (anymore). */ 1963 1953 } … … 2009 1999 if (RT_SUCCESS(vrc)) 2010 2000 { 2011 /** @todo Set rcGuest. */2001 /** @todo Set vrcGuest. */ 2012 2002 2013 2003 if (puWritten) … … 2019 2009 unregisterWaitEvent(pEvent); 2020 2010 2021 LogFlowThisFunc(("Returning cbProcessed=%RU32, rc=%Rrc\n", 2022 cbProcessed, vrc)); 2011 LogFlowThisFunc(("Returning cbProcessed=%RU32, vrc=%Rrc\n", cbProcessed, vrc)); 2023 2012 return vrc; 2024 2013 } … … 2070 2059 } 2071 2060 2072 LogFlowThisFunc(("rc=%Rrc, cbRead=%RU32\n", vrc, cbRead)); 2073 2061 LogFlowThisFunc(("vrc=%Rrc, cbRead=%RU32\n", vrc, cbRead)); 2074 2062 LogFlowFuncLeaveRC(vrc); 2075 2063 return hrc; … … 2243 2231 } 2244 2232 2245 LogFlowThisFunc((" rc=%Rrc, aWritten=%RU32\n", vrc, cbWritten));2233 LogFlowThisFunc(("vrc=%Rrc, aWritten=%RU32\n", vrc, cbWritten)); 2246 2234 2247 2235 *aWritten = (ULONG)cbWritten; … … 2283 2271 * @param startupInfo Guest process startup info to use for starting. 2284 2272 * @param fAsync Whether to start asynchronously or not. 2285 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR2286 * was returned. Optional.2273 * @param pvrcGuest Where to return the guest error when 2274 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 2287 2275 */ 2288 2276 int GuestProcessTool::init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, 2289 bool fAsync, int *p rcGuest)2277 bool fAsync, int *pvrcGuest) 2290 2278 { 2291 2279 LogFlowThisFunc(("pGuestSession=%p, exe=%s, fAsync=%RTbool\n", … … 2317 2305 } 2318 2306 2319 if (p rcGuest)2320 *p rcGuest = vrcGuest;2307 if (pvrcGuest) 2308 *pvrcGuest = vrcGuest; 2321 2309 } 2322 2310 … … 2373 2361 } while (RT_SUCCESS(vrc)); 2374 2362 2375 LogFlowThisFunc(("rc=%Rrc, %RU64 pairs\n", 2376 vrc, strmBlock.GetCount())); 2363 LogFlowThisFunc(("vrc=%Rrc, %RU64 pairs\n", vrc, strmBlock.GetCount())); 2377 2364 return vrc; 2378 2365 } … … 2386 2373 { 2387 2374 LONG exitCode = -1; 2388 HRESULT hr = pProcess->COMGETTER(ExitCode(&exitCode));2389 AssertComRC(hr );2375 HRESULT hrc = pProcess->COMGETTER(ExitCode(&exitCode)); 2376 AssertComRC(hrc); 2390 2377 2391 2378 return GuestProcessTool::exitCodeToRc(mStartupInfo, exitCode); … … 2402 2389 2403 2390 ProcessStatus_T procStatus = ProcessStatus_Undefined; 2404 HRESULT hr = pProcess->COMGETTER(Status(&procStatus));2405 AssertComRC(hr );2391 HRESULT hrc = pProcess->COMGETTER(Status(&procStatus)); 2392 AssertComRC(hrc); 2406 2393 2407 2394 if ( procStatus == ProcessStatus_Started … … 2452 2439 { 2453 2440 /* Make sure to check the error information we got from the guest tool. */ 2454 if (GuestProcess::i_isGuestError(errorInfo. rcGuest))2455 { 2456 if (errorInfo. rcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */2441 if (GuestProcess::i_isGuestError(errorInfo.vrcGuest)) 2442 { 2443 if (errorInfo.vrcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */ 2457 2444 vrcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode); 2458 2445 else /* At least return something. */ 2459 vrcGuest = errorInfo. rcGuest;2446 vrcGuest = errorInfo.vrcGuest; 2460 2447 2461 2448 if (pvrcGuest) … … 2466 2453 } 2467 2454 2468 LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo. rcGuest, errorInfo.iExitCode));2455 LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode)); 2469 2456 return vrc; 2470 2457 } … … 2480 2467 */ 2481 2468 /* static */ 2482 int GuestProcessTool::runErrorInfo( GuestSession *pGuestSession, 2483 const GuestProcessStartupInfo &startupInfo, 2484 GuestProcessToolErrorInfo &errorInfo) 2485 { 2486 return runExErrorInfo(pGuestSession, startupInfo, 2487 NULL /* paStrmOutObjects */, 0 /* cStrmOutObjects */, errorInfo); 2469 int GuestProcessTool::runErrorInfo(GuestSession *pGuestSession, 2470 GuestProcessStartupInfo const &startupInfo, 2471 GuestProcessToolErrorInfo &errorInfo) 2472 { 2473 return runExErrorInfo(pGuestSession, startupInfo, NULL /* paStrmOutObjects */, 0 /* cStrmOutObjects */, errorInfo); 2488 2474 } 2489 2475 … … 2500 2486 */ 2501 2487 /* static */ 2502 int GuestProcessTool::runEx( GuestSession*pGuestSession,2503 const GuestProcessStartupInfo&startupInfo,2504 GuestCtrlStreamObjects*paStrmOutObjects,2505 uint32_tcStrmOutObjects,2506 int*pvrcGuest /* = NULL */)2488 int GuestProcessTool::runEx(GuestSession *pGuestSession, 2489 GuestProcessStartupInfo const &startupInfo, 2490 GuestCtrlStreamObjects *paStrmOutObjects, 2491 uint32_t cStrmOutObjects, 2492 int *pvrcGuest /* = NULL */) 2507 2493 { 2508 2494 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; … … 2513 2499 { 2514 2500 /* Make sure to check the error information we got from the guest tool. */ 2515 if (GuestProcess::i_isGuestError(errorInfo. rcGuest))2516 { 2517 if (errorInfo. rcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */2501 if (GuestProcess::i_isGuestError(errorInfo.vrcGuest)) 2502 { 2503 if (errorInfo.vrcGuest == VERR_GSTCTL_PROCESS_EXIT_CODE) /* Translate exit code to a meaningful error code. */ 2518 2504 vrcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode); 2519 2505 else /* At least return something. */ 2520 vrcGuest = errorInfo. rcGuest;2506 vrcGuest = errorInfo.vrcGuest; 2521 2507 2522 2508 if (pvrcGuest) … … 2527 2513 } 2528 2514 2529 LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo. rcGuest, errorInfo.iExitCode));2515 LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode)); 2530 2516 return vrc; 2531 2517 } … … 2547 2533 */ 2548 2534 /* static */ 2549 int GuestProcessTool::runExErrorInfo( GuestSession*pGuestSession,2550 const GuestProcessStartupInfo&startupInfo,2551 GuestCtrlStreamObjects*paStrmOutObjects,2552 uint32_tcStrmOutObjects,2553 GuestProcessToolErrorInfo&errorInfo)2535 int GuestProcessTool::runExErrorInfo(GuestSession *pGuestSession, 2536 GuestProcessStartupInfo const &startupInfo, 2537 GuestCtrlStreamObjects *paStrmOutObjects, 2538 uint32_t cStrmOutObjects, 2539 GuestProcessToolErrorInfo &errorInfo) 2554 2540 { 2555 2541 AssertPtrReturn(pGuestSession, VERR_INVALID_POINTER); … … 2559 2545 2560 2546 GuestProcessTool procTool; 2561 int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo. rcGuest);2547 int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.vrcGuest); 2562 2548 if (RT_SUCCESS(vrc)) 2563 2549 { … … 2569 2555 vrc = procTool.waitEx( paStrmOutObjects 2570 2556 ? GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK 2571 : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo. rcGuest);2557 : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.vrcGuest); 2572 2558 if (paStrmOutObjects) 2573 2559 paStrmOutObjects->push_back(strmBlk); … … 2586 2572 { 2587 2573 /* Make sure the process runs until completion. */ 2588 vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo. rcGuest);2574 vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.vrcGuest); 2589 2575 if (RT_SUCCESS(vrc)) 2590 errorInfo. rcGuest = procTool.getTerminationStatus(&errorInfo.iExitCode);2591 } 2592 2593 LogFlowFunc(("Returned rc=%Rrc, rcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode));2576 errorInfo.vrcGuest = procTool.getTerminationStatus(&errorInfo.iExitCode); 2577 } 2578 2579 LogFlowFunc(("Returned vrc=%Rrc, vrcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.vrcGuest, errorInfo.iExitCode)); 2594 2580 return vrc; 2595 2581 } … … 2613 2599 { 2614 2600 LONG iExitCode = -1; 2615 HRESULT hr = pProcess->COMGETTER(ExitCode(&iExitCode));2616 AssertComRC(hr );2601 HRESULT hrc = pProcess->COMGETTER(ExitCode(&iExitCode)); 2602 AssertComRC(hrc); 2617 2603 2618 2604 if (piExitCode) … … 2633 2619 * @returns VBox status code. 2634 2620 * @param fToolWaitFlags Guest process tool wait flags to use for waiting. 2635 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR2636 * was returned. Optional.2637 */ 2638 int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *p rcGuest)2639 { 2640 return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, p rcGuest);2621 * @param pvrcGuest Where to return the guest error when 2622 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 2623 */ 2624 int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *pvrcGuest) 2625 { 2626 return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, pvrcGuest); 2641 2627 } 2642 2628 … … 2647 2633 * @param fToolWaitFlags Guest process tool wait flags to use for waiting. 2648 2634 * @param pStrmBlkOut Where to store the guest process output. 2649 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR2650 * was returned. Optional.2651 */ 2652 int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *p rcGuest)2653 { 2654 LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, p rcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, prcGuest));2635 * @param pvrcGuest Where to return the guest error when 2636 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 2637 */ 2638 int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pvrcGuest) 2639 { 2640 LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, pvrcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, pvrcGuest)); 2655 2641 2656 2642 /* Can we parse the next block without waiting? */ … … 2736 2722 /* Since waiting for stdout / stderr is not supported by the guest, 2737 2723 * wait a bit to not hog the CPU too much when polling for data. */ 2738 RTThreadSleep(1); /* Optional, don't check rc. */2724 RTThreadSleep(1); /* Optional, don't check vrc. */ 2739 2725 break; 2740 2726 … … 2828 2814 vrc = VERR_GSTCTL_GUEST_ERROR; 2829 2815 2830 LogFlowThisFunc(("Loop ended with rc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n", 2831 vrc, vrcGuest, waitRes)); 2832 if (prcGuest) 2833 *prcGuest = vrcGuest; 2816 LogFlowThisFunc(("Loop ended with vrc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n", vrc, vrcGuest, waitRes)); 2817 if (pvrcGuest) 2818 *pvrcGuest = vrcGuest; 2834 2819 2835 2820 LogFlowFuncLeaveRC(vrc); … … 2842 2827 * @returns VBox status code. 2843 2828 * @param uTimeoutMS Timeout (in ms) to wait. 2844 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR2845 * was returned. Optional.2846 */ 2847 int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *p rcGuest)2829 * @param pvrcGuest Where to return the guest error when 2830 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 2831 */ 2832 int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *pvrcGuest) 2848 2833 { 2849 2834 LogFlowThisFuncEnter(); … … 2851 2836 int vrc; 2852 2837 if (!pProcess.isNull()) 2853 vrc = pProcess->i_terminateProcess(uTimeoutMS, p rcGuest);2838 vrc = pProcess->i_terminateProcess(uTimeoutMS, pvrcGuest); 2854 2839 else 2855 2840 vrc = VERR_NOT_FOUND; … … 2973 2958 2974 2959 /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ 2975 switch (guestErrorInfo.get Rc())2960 switch (guestErrorInfo.getVrc()) 2976 2961 { 2977 2962 case VERR_ACCESS_DENIED: … … 3023 3008 default: 3024 3009 strErr.printf(tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"), 3025 guestErrorInfo.get Rc(), guestErrorInfo.getWhat().c_str(), pszTool);3010 guestErrorInfo.getVrc(), guestErrorInfo.getWhat().c_str(), pszTool); 3026 3011 break; 3027 3012 } -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r98262 r98272 108 108 void handler() 109 109 { 110 /* Ignore rc */ GuestSession::i_startSessionThreadTask(this); 110 /* Ignore return code */ 111 GuestSession::i_startSessionThreadTask(this); 111 112 } 112 113 }; … … 147 148 { 148 149 AssertPtrReturn(mSession, E_POINTER); 149 int rc2 = mSession->signalWaitEvent(aType, aEvent);150 RT_NOREF( rc2);150 int vrc2 = mSession->signalWaitEvent(aType, aEvent); 151 RT_NOREF(vrc2); 151 152 #ifdef DEBUG_andy 152 LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in rc=%Rrc\n", 153 aType, mSession, rc2)); 153 LogFlowFunc(("Signalling events of type=%RU32, session=%p resulted in vrc2=%Rrc\n", aType, mSession, vrc2)); 154 154 #endif 155 155 break; … … 245 245 * objects (like files, directories, ...) which are bound to this session. 246 246 */ 247 int rc = i_objectRegister(NULL /* pObject */, SESSIONOBJECTTYPE_SESSION, &mData.mObjectID);248 if (RT_SUCCESS( rc))249 { 250 rc = mData.mEnvironmentChanges.initChangeRecord(pGuest->i_isGuestInWindowsNtFamily()251 ? RTENV_CREATE_F_ALLOW_EQUAL_FIRST_IN_VAR : 0);252 if (RT_SUCCESS( rc))253 { 254 rc = RTCritSectInit(&mWaitEventCritSect);255 AssertRC( rc);256 } 257 } 258 259 if (RT_SUCCESS( rc))260 rc = i_determineProtocolVersion();261 262 if (RT_SUCCESS( rc))247 int vrc = i_objectRegister(NULL /* pObject */, SESSIONOBJECTTYPE_SESSION, &mData.mObjectID); 248 if (RT_SUCCESS(vrc)) 249 { 250 vrc = mData.mEnvironmentChanges.initChangeRecord(pGuest->i_isGuestInWindowsNtFamily() 251 ? RTENV_CREATE_F_ALLOW_EQUAL_FIRST_IN_VAR : 0); 252 if (RT_SUCCESS(vrc)) 253 { 254 vrc = RTCritSectInit(&mWaitEventCritSect); 255 AssertRC(vrc); 256 } 257 } 258 259 if (RT_SUCCESS(vrc)) 260 vrc = i_determineProtocolVersion(); 261 262 if (RT_SUCCESS(vrc)) 263 263 { 264 264 /* 265 265 * <Replace this if you figure out what the code is doing.> 266 266 */ 267 HRESULT hr = unconst(mEventSource).createObject();268 if (SUCCEEDED(hr ))269 hr = mEventSource->init();270 if (SUCCEEDED(hr ))267 HRESULT hrc = unconst(mEventSource).createObject(); 268 if (SUCCEEDED(hrc)) 269 hrc = mEventSource->init(); 270 if (SUCCEEDED(hrc)) 271 271 { 272 272 try … … 274 274 GuestSessionListener *pListener = new GuestSessionListener(); 275 275 ComObjPtr<GuestSessionListenerImpl> thisListener; 276 hr = thisListener.createObject();277 if (SUCCEEDED(hr ))278 hr = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */279 if (SUCCEEDED(hr ))276 hrc = thisListener.createObject(); 277 if (SUCCEEDED(hrc)) 278 hrc = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */ 279 if (SUCCEEDED(hrc)) 280 280 { 281 281 com::SafeArray <VBoxEventType_T> eventTypes; 282 282 eventTypes.push_back(VBoxEventType_OnGuestSessionStateChanged); 283 hr = mEventSource->RegisterListener(thisListener,284 ComSafeArrayAsInParam(eventTypes),285 TRUE /* Active listener */);286 if (SUCCEEDED(hr ))283 hrc = mEventSource->RegisterListener(thisListener, 284 ComSafeArrayAsInParam(eventTypes), 285 TRUE /* Active listener */); 286 if (SUCCEEDED(hrc)) 287 287 { 288 288 mLocalListener = thisListener; … … 292 292 */ 293 293 autoInitSpan.setSucceeded(); 294 LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool rc=VINF_SUCCESS\n",294 LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool vrc=VINF_SUCCESS\n", 295 295 mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal)); 296 296 return VINF_SUCCESS; … … 300 300 catch (std::bad_alloc &) 301 301 { 302 hr = E_OUTOFMEMORY;302 hrc = E_OUTOFMEMORY; 303 303 } 304 304 } 305 rc = Global::vboxStatusCodeFromCOM(hr);305 vrc = Global::vboxStatusCodeFromCOM(hrc); 306 306 } 307 307 308 308 autoInitSpan.setFailed(); 309 LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => rc=%Rrc\n",310 mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, rc));311 return rc;309 LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => vrc=%Rrc\n", 310 mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, vrc)); 311 return vrc; 312 312 } 313 313 … … 546 546 HRESULT GuestSession::getUserHome(com::Utf8Str &aUserHome) 547 547 { 548 HRESULT hr = i_isStartedExternal();549 if (FAILED(hr ))550 return hr ;551 552 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;553 int vrc = i_pathUserHome(aUserHome, & rcGuest);548 HRESULT hrc = i_isStartedExternal(); 549 if (FAILED(hrc)) 550 return hrc; 551 552 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 553 int vrc = i_pathUserHome(aUserHome, &vrcGuest); 554 554 if (RT_FAILURE(vrc)) 555 555 { … … 558 558 case VERR_GSTCTL_GUEST_ERROR: 559 559 { 560 switch ( rcGuest)560 switch (vrcGuest) 561 561 { 562 562 case VERR_NOT_SUPPORTED: 563 hr = setErrorBoth(VBOX_E_IPRT_ERROR,rcGuest,563 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, 564 564 tr("Getting the user's home path is not supported by installed Guest Additions")); 565 565 break; 566 566 567 567 default: 568 hr = setErrorBoth(VBOX_E_IPRT_ERROR,rcGuest,569 tr("Getting the user's home path failed on the guest: %Rrc"), rcGuest);568 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, 569 tr("Getting the user's home path failed on the guest: %Rrc"), vrcGuest); 570 570 break; 571 571 } … … 574 574 575 575 default: 576 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc);576 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc); 577 577 break; 578 578 } 579 579 } 580 580 581 return hr ;581 return hrc; 582 582 } 583 583 584 584 HRESULT GuestSession::getUserDocuments(com::Utf8Str &aUserDocuments) 585 585 { 586 HRESULT hr = i_isStartedExternal();587 if (FAILED(hr ))588 return hr ;589 590 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;591 int vrc = i_pathUserDocuments(aUserDocuments, & rcGuest);586 HRESULT hrc = i_isStartedExternal(); 587 if (FAILED(hrc)) 588 return hrc; 589 590 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 591 int vrc = i_pathUserDocuments(aUserDocuments, &vrcGuest); 592 592 if (RT_FAILURE(vrc)) 593 593 { … … 596 596 case VERR_GSTCTL_GUEST_ERROR: 597 597 { 598 switch ( rcGuest)598 switch (vrcGuest) 599 599 { 600 600 case VERR_NOT_SUPPORTED: 601 hr = setErrorBoth(VBOX_E_IPRT_ERROR,rcGuest,601 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, 602 602 tr("Getting the user's documents path is not supported by installed Guest Additions")); 603 603 break; 604 604 605 605 default: 606 hr = setErrorBoth(VBOX_E_IPRT_ERROR,rcGuest,607 tr("Getting the user's documents path failed on the guest: %Rrc"), rcGuest);606 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, 607 tr("Getting the user's documents path failed on the guest: %Rrc"), vrcGuest); 608 608 break; 609 609 } … … 612 612 613 613 default: 614 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc);614 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc); 615 615 break; 616 616 } 617 617 } 618 618 619 return hr ;619 return hrc; 620 620 } 621 621 … … 673 673 * @param uFlags Guest session close flags. 674 674 * @param uTimeoutMS Timeout (in ms) to wait. 675 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR676 * was returned. Optional.675 * @param pvrcGuest Where to return the guest error when 676 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 677 677 * 678 678 * @note Takes the read lock. 679 679 */ 680 int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *p rcGuest)681 { 682 AssertPtrReturn(p rcGuest, VERR_INVALID_POINTER);680 int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest) 681 { 682 AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); 683 683 684 684 LogFlowThisFunc(("uFlags=%x, uTimeoutMS=%RU32\n", uFlags, uTimeoutMS)); … … 734 734 if (RT_SUCCESS(vrc)) 735 735 vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS, 736 NULL /* Session status */, p rcGuest);736 NULL /* Session status */, pvrcGuest); 737 737 738 738 unregisterWaitEvent(pEvent); … … 941 941 * @param uMode Creation mode to use (octal, 0777 max). 942 942 * @param uFlags Directory creation flags to use. 943 * @param prcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR 944 * was returned. Optional. 945 */ 946 int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, 947 uint32_t uFlags, int *prcGuest) 948 { 949 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 943 * @param pvrcGuest Where to return the guest error when 944 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 945 */ 946 int GuestSession::i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest) 947 { 948 AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); 950 949 951 950 LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n", strPath.c_str(), uMode, uFlags)); … … 993 992 994 993 if (RT_SUCCESS(vrc)) 995 vrc = GuestProcessTool::run(this, procInfo, p rcGuest);994 vrc = GuestProcessTool::run(this, procInfo, pvrcGuest); 996 995 997 996 LogFlowFuncLeaveRC(vrc); … … 1008 1007 { 1009 1008 GuestFsObjData objDataIgnored; 1010 int rcGuestIgnored; 1011 int rc = i_directoryQueryInfo(strPath, true /* fFollowSymlinks */, objDataIgnored, &rcGuestIgnored); 1012 1013 return RT_SUCCESS(rc); 1009 int vrcGuestIgnored; 1010 int const vrc = i_directoryQueryInfo(strPath, true /* fFollowSymlinks */, objDataIgnored, &vrcGuestIgnored); 1011 return RT_SUCCESS(vrc); 1014 1012 } 1015 1013 … … 1040 1038 * @param fFollowSymlinks Whether to follow symlinks or not. 1041 1039 * @param objData Where to store the information returned on success. 1042 * @param p rcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.1043 * /1044 int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, 1045 GuestFsObjData &objData, int *prcGuest)1046 { 1047 AssertPtrReturn(p rcGuest, VERR_INVALID_POINTER);1040 * @param pvrcGuest Guest VBox status code, when returning 1041 * VERR_GSTCTL_GUEST_ERROR. 1042 */ 1043 int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) 1044 { 1045 AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); 1048 1046 1049 1047 LogFlowThisFunc(("strPath=%s, fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); 1050 1048 1051 int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, p rcGuest);1049 int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest); 1052 1050 if (RT_SUCCESS(vrc)) 1053 1051 { … … 1080 1078 LogFlowFunc(("Removing directory (objectID=%RU32) ...\n", idObject)); 1081 1079 1082 int rc = i_objectUnregister(idObject);1083 if (RT_FAILURE( rc))1084 return rc;1080 int vrc = i_objectUnregister(idObject); 1081 if (RT_FAILURE(vrc)) 1082 return vrc; 1085 1083 1086 1084 SessionDirectories::iterator itDirs = mData.mDirectories.find(idObject); … … 1093 1091 idObject, mData.mSession.mID, mData.mDirectories.size())); 1094 1092 1095 rc = pDirConsumed->i_onUnregister();1096 AssertRCReturn( rc,rc);1093 vrc = pDirConsumed->i_onUnregister(); 1094 AssertRCReturn(vrc, vrc); 1097 1095 1098 1096 mData.mDirectories.erase(itDirs); … … 1104 1102 pDirConsumed.setNull(); 1105 1103 1106 LogFlowFuncLeaveRC( rc);1107 return rc;1104 LogFlowFuncLeaveRC(vrc); 1105 return vrc; 1108 1106 } 1109 1107 … … 1114 1112 * @param strPath Path of directory on guest to remove. 1115 1113 * @param fFlags Directory remove flags to use. 1116 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1117 * was returned. Optional.1114 * @param pvrcGuest Where to return the guest error when 1115 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1118 1116 * 1119 1117 * @note Takes the read lock. 1120 1118 */ 1121 int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *p rcGuest)1119 int GuestSession::i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest) 1122 1120 { 1123 1121 AssertReturn(!(fFlags & ~DIRREMOVEREC_FLAG_VALID_MASK), VERR_INVALID_PARAMETER); 1124 AssertPtrReturn(p rcGuest, VERR_INVALID_POINTER);1122 AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); 1125 1123 1126 1124 LogFlowThisFunc(("strPath=%s, uFlags=0x%x\n", strPath.c_str(), fFlags)); … … 1148 1146 vrc = pEvent->Wait(30 * 1000); 1149 1147 if ( vrc == VERR_GSTCTL_GUEST_ERROR 1150 && p rcGuest)1151 *p rcGuest = pEvent->GuestResult();1148 && pvrcGuest) 1149 *pvrcGuest = pEvent->GuestResult(); 1152 1150 } 1153 1151 … … 1171 1169 * Ignored when \a fSecure is specified. 1172 1170 * @param fSecure Whether to perform a secure creation or not. 1173 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 1171 * @param pvrcGuest Guest VBox status code, when returning 1172 * VERR_GSTCTL_GUEST_ERROR. 1174 1173 */ 1175 1174 int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName, 1176 uint32_t fMode, bool fSecure, int *p rcGuest)1177 { 1178 AssertPtrReturn(p rcGuest, VERR_INVALID_POINTER);1175 uint32_t fMode, bool fSecure, int *pvrcGuest) 1176 { 1177 AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); 1179 1178 AssertReturn(fSecure || !(fMode & ~07777), VERR_INVALID_PARAMETER); 1180 1179 … … 1234 1233 { 1235 1234 vrcGuest = vrc; 1236 if (p rcGuest)1237 *p rcGuest = vrcGuest;1235 if (pvrcGuest) 1236 *pvrcGuest = vrcGuest; 1238 1237 vrc = VERR_GSTCTL_GUEST_ERROR; 1239 1238 } … … 1245 1244 strName = objData.mName; 1246 1245 } 1247 else if (p rcGuest)1248 *p rcGuest = vrcGuest;1246 else if (pvrcGuest) 1247 *pvrcGuest = vrcGuest; 1249 1248 1250 1249 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); … … 1259 1258 * @param openInfo Open information to use. 1260 1259 * @param pDirectory Where to return the guest directory object on success. 1261 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1262 * was returned. Optional.1260 * @param pvrcGuest Where to return the guest error when 1261 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1263 1262 * 1264 1263 * @note Takes the write lock. 1265 1264 */ 1266 int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, 1267 ComObjPtr<GuestDirectory> &pDirectory, int *prcGuest) 1268 { 1269 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 1270 1271 LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n", 1272 openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags)); 1265 int GuestSession::i_directoryOpen(const GuestDirectoryOpenInfo &openInfo, ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest) 1266 { 1267 AssertPtrReturn(pvrcGuest, VERR_INVALID_POINTER); 1268 1269 LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n", openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags)); 1273 1270 1274 1271 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1275 1272 1276 1273 /* Create the directory object. */ 1277 HRESULT hr = pDirectory.createObject();1278 if (FAILED(hr ))1279 return Global::vboxStatusCodeFromCOM(hr );1274 HRESULT hrc = pDirectory.createObject(); 1275 if (FAILED(hrc)) 1276 return Global::vboxStatusCodeFromCOM(hrc); 1280 1277 1281 1278 /* Register a new object ID. */ … … 1333 1330 { 1334 1331 /* Nothing further to do here yet. */ 1335 if (p rcGuest)1336 *p rcGuest = VINF_SUCCESS;1332 if (pvrcGuest) 1333 *pvrcGuest = VINF_SUCCESS; 1337 1334 } 1338 1335 … … 1362 1359 * Find the object. 1363 1360 */ 1364 int rc = VERR_NOT_FOUND;1361 int vrc = VERR_NOT_FOUND; 1365 1362 const uint32_t idObject = VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCtxCb->uContextID); 1366 1363 SessionObjects::const_iterator itObj = mData.mObjects.find(idObject); … … 1378 1375 alock.release(); 1379 1376 1380 rc = i_dispatchToThis(pCtxCb, pSvcCb);1377 vrc = i_dispatchToThis(pCtxCb, pSvcCb); 1381 1378 break; 1382 1379 } … … 1388 1385 alock.release(); 1389 1386 1390 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);1387 vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); 1391 1388 break; 1392 1389 } … … 1398 1395 alock.release(); 1399 1396 1400 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);1397 vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); 1401 1398 break; 1402 1399 } … … 1408 1405 alock.release(); 1409 1406 1410 rc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb);1407 vrc = pObj->i_callbackDispatcher(pCtxCb, pSvcCb); 1411 1408 break; 1412 1409 } 1413 1410 default: 1414 1411 AssertMsgFailed(("%d\n", itObj->second.enmType)); 1415 rc = VERR_INTERNAL_ERROR_4;1412 vrc = VERR_INTERNAL_ERROR_4; 1416 1413 break; 1417 1414 } 1418 1415 } 1419 1416 1420 LogFlowFuncLeaveRC( rc);1421 return rc;1417 LogFlowFuncLeaveRC(vrc); 1418 return vrc; 1422 1419 } 1423 1420 … … 1438 1435 LogFlowThisFunc(("sessionID=%RU32, CID=%RU32, uMessage=%RU32, pSvcCb=%p\n", 1439 1436 mData.mSession.mID, pCbCtx->uContextID, pCbCtx->uMessage, pSvcCbData)); 1440 int rc;1437 int vrc; 1441 1438 switch (pCbCtx->uMessage) 1442 1439 { 1443 1440 case GUEST_MSG_DISCONNECTED: 1444 1441 /** @todo Handle closing all guest objects. */ 1445 rc = VERR_INTERNAL_ERROR;1442 vrc = VERR_INTERNAL_ERROR; 1446 1443 break; 1447 1444 1448 1445 case GUEST_MSG_SESSION_NOTIFY: /* Guest Additions >= 4.3.0. */ 1449 { 1450 rc = i_onSessionStatusChange(pCbCtx, pSvcCbData); 1446 vrc = i_onSessionStatusChange(pCbCtx, pSvcCbData); 1451 1447 break; 1452 }1453 1448 1454 1449 default: 1455 rc = dispatchGeneric(pCbCtx, pSvcCbData);1450 vrc = dispatchGeneric(pCbCtx, pSvcCbData); 1456 1451 break; 1457 1452 } 1458 1453 1459 LogFlowFuncLeaveRC( rc);1460 return rc;1454 LogFlowFuncLeaveRC(vrc); 1455 return vrc; 1461 1456 } 1462 1457 … … 1552 1547 LogFlowFunc(("Removing file (objectID=%RU32) ...\n", idObject)); 1553 1548 1554 int rc = i_objectUnregister(idObject);1555 if (RT_FAILURE( rc))1556 return rc;1549 int vrc = i_objectUnregister(idObject); 1550 if (RT_FAILURE(vrc)) 1551 return vrc; 1557 1552 1558 1553 SessionFiles::iterator itFiles = mData.mFiles.find(idObject); … … 1565 1560 pFileConsumed->getObjectID(), mData.mSession.mID, mData.mFiles.size())); 1566 1561 1567 rc = pFileConsumed->i_onUnregister();1568 AssertRCReturn( rc,rc);1562 vrc = pFileConsumed->i_onUnregister(); 1563 AssertRCReturn(vrc, vrc); 1569 1564 1570 1565 mData.mFiles.erase(itFiles); … … 1576 1571 pFileConsumed.setNull(); 1577 1572 1578 LogFlowFuncLeaveRC( rc);1579 return rc;1573 LogFlowFuncLeaveRC(vrc); 1574 return vrc; 1580 1575 } 1581 1576 … … 1586 1581 * @returns VERR_GSTCTL_GUEST_ERROR on received guest error. 1587 1582 * @param strPath Path of file on guest to remove. 1588 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1589 * was returned. Optional.1590 */ 1591 int GuestSession::i_fileRemove(const Utf8Str &strPath, int *p rcGuest)1583 * @param pvrcGuest Where to return the guest error when 1584 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1585 */ 1586 int GuestSession::i_fileRemove(const Utf8Str &strPath, int *pvrcGuest) 1592 1587 { 1593 1588 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); … … 1623 1618 { 1624 1619 vrcGuest = vrc; 1625 if (p rcGuest)1626 *p rcGuest = vrcGuest;1620 if (pvrcGuest) 1621 *pvrcGuest = vrcGuest; 1627 1622 vrc = VERR_GSTCTL_GUEST_ERROR; 1628 1623 } … … 1631 1626 vrc = VERR_BROKEN_PIPE; 1632 1627 } 1633 else if (p rcGuest)1634 *p rcGuest = vrcGuest;1628 else if (pvrcGuest) 1629 *pvrcGuest = vrcGuest; 1635 1630 1636 1631 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); … … 1650 1645 * @param aFlags Open flags to use. 1651 1646 * @param pFile Where to return the file object on success. 1652 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1653 * was returned. Optional.1647 * @param pvrcGuest Where to return the guest error when 1648 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1654 1649 * 1655 1650 * @note Takes the write lock. … … 1657 1652 int GuestSession::i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, 1658 1653 FileSharingMode_T aSharingMode, ULONG aCreationMode, const std::vector<FileOpenExFlag_T> &aFlags, 1659 ComObjPtr<GuestFile> &pFile, int *p rcGuest)1654 ComObjPtr<GuestFile> &pFile, int *pvrcGuest) 1660 1655 { 1661 1656 GuestFileOpenInfo openInfo; … … 1671 1666 /* Validation is done in i_fileOpen(). */ 1672 1667 1673 return i_fileOpen(openInfo, pFile, p rcGuest);1668 return i_fileOpen(openInfo, pFile, pvrcGuest); 1674 1669 } 1675 1670 … … 1681 1676 * @param openInfo Open information to use for opening the file. 1682 1677 * @param pFile Where to return the file object on success. 1683 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1684 * was returned. Optional.1678 * @param pvrcGuest Where to return the guest error when 1679 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1685 1680 * 1686 1681 * @note Takes the write lock. 1687 1682 */ 1688 int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *p rcGuest)1683 int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest) 1689 1684 { 1690 1685 LogFlowThisFunc(("strFile=%s, enmAccessMode=0x%x, enmOpenAction=0x%x, uCreationMode=%RU32, mfOpenEx=%RU32\n", … … 1697 1692 if (mData.mProtocolVersion < 2) 1698 1693 { 1699 if (p rcGuest)1700 *p rcGuest = VERR_NOT_SUPPORTED;1694 if (pvrcGuest) 1695 *pvrcGuest = VERR_NOT_SUPPORTED; 1701 1696 return VERR_GSTCTL_GUEST_ERROR; 1702 1697 } … … 1706 1701 1707 1702 /* Create the directory object. */ 1708 HRESULT hr = pFile.createObject();1709 if (FAILED(hr ))1703 HRESULT hrc = pFile.createObject(); 1704 if (FAILED(hrc)) 1710 1705 return VERR_COM_UNEXPECTED; 1711 1706 1712 1707 /* Register a new object ID. */ 1713 1708 uint32_t idObject; 1714 int rc = i_objectRegister(pFile, SESSIONOBJECTTYPE_FILE, &idObject);1715 if (RT_FAILURE( rc))1709 int vrc = i_objectRegister(pFile, SESSIONOBJECTTYPE_FILE, &idObject); 1710 if (RT_FAILURE(vrc)) 1716 1711 { 1717 1712 pFile.setNull(); 1718 return rc;1713 return vrc; 1719 1714 } 1720 1715 … … 1722 1717 AssertPtr(pConsole); 1723 1718 1724 rc = pFile->init(pConsole, this /* GuestSession */, idObject, openInfo);1725 if (RT_FAILURE( rc))1726 return rc;1719 vrc = pFile->init(pConsole, this /* GuestSession */, idObject, openInfo); 1720 if (RT_FAILURE(vrc)) 1721 return vrc; 1727 1722 1728 1723 /* … … 1747 1742 catch (std::bad_alloc &) 1748 1743 { 1749 rc = VERR_NO_MEMORY; 1750 } 1751 1752 if (RT_SUCCESS(rc)) 1753 { 1754 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 1755 rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &rcGuest); 1756 if ( rc == VERR_GSTCTL_GUEST_ERROR 1757 && prcGuest) 1758 { 1759 *prcGuest = rcGuest; 1760 } 1761 } 1762 1763 LogFlowFuncLeaveRC(rc); 1764 return rc; 1744 vrc = VERR_NO_MEMORY; 1745 } 1746 1747 if (RT_SUCCESS(vrc)) 1748 { 1749 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 1750 vrc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &vrcGuest); 1751 if ( vrc == VERR_GSTCTL_GUEST_ERROR 1752 && pvrcGuest) 1753 *pvrcGuest = vrcGuest; 1754 } 1755 1756 LogFlowFuncLeaveRC(vrc); 1757 return vrc; 1765 1758 } 1766 1759 … … 1769 1762 * 1770 1763 * @returns IPRT status code. VERR_NOT_A_FILE if the queried file system object on the guest is not a file, 1771 * or VERR_GSTCTL_GUEST_ERROR if prcGuest contains more error information from the guest. 1764 * or VERR_GSTCTL_GUEST_ERROR if pvrcGuest contains 1765 * more error information from the guest. 1772 1766 * @param strPath Absolute path of file to query information for. 1773 1767 * @param fFollowSymlinks Whether or not to follow symbolic links on the guest. 1774 1768 * @param objData Where to store the acquired information. 1775 * @param prcGuest Where to store the guest rc. Optional. 1776 */ 1777 int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest) 1769 * @param pvrcGuest Where to store the guest VBox status code. 1770 * Optional. 1771 */ 1772 int GuestSession::i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) 1778 1773 { 1779 1774 LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); 1780 1775 1781 int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, p rcGuest);1776 int vrc = i_fsQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest); 1782 1777 if (RT_SUCCESS(vrc)) 1783 { 1784 vrc = objData.mType == FsObjType_File 1785 ? VINF_SUCCESS : VERR_NOT_A_FILE; 1786 } 1778 vrc = objData.mType == FsObjType_File ? VINF_SUCCESS : VERR_NOT_A_FILE; 1787 1779 1788 1780 LogFlowFuncLeaveRC(vrc); … … 1799 1791 * @param fFollowSymlinks \c true when wanting to follow symbolic links, \c false if not. 1800 1792 * @param pllSize Where to return the queried file size on success. 1801 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR1802 * was returned. Optional.1803 */ 1804 int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *p rcGuest)1793 * @param pvrcGuest Where to return the guest error when 1794 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 1795 */ 1796 int GuestSession::i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest) 1805 1797 { 1806 1798 AssertPtrReturn(pllSize, VERR_INVALID_POINTER); 1807 1799 1808 1800 GuestFsObjData objData; 1809 int vrc = i_fileQueryInfo(strPath, fFollowSymlinks, objData, p rcGuest);1801 int vrc = i_fileQueryInfo(strPath, fFollowSymlinks, objData, pvrcGuest); 1810 1802 if (RT_SUCCESS(vrc)) 1811 1803 *pllSize = objData.mObjectSize; … … 1821 1813 * @param fFollowSymlinks Whether to follow symbolic links or not. 1822 1814 * @param objData Where to return the file system object data, if found. 1823 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 1824 * Any other return code indicates some host side error. 1825 */ 1826 int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest) 1815 * @param pvrcGuest Guest VBox status code, when returning 1816 * VERR_GSTCTL_GUEST_ERROR. Any other return code 1817 * indicates some host side error. 1818 */ 1819 int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) 1827 1820 { 1828 1821 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); … … 1860 1853 { 1861 1854 vrcGuest = vrc; 1862 if (p rcGuest)1863 *p rcGuest = vrcGuest;1855 if (pvrcGuest) 1856 *pvrcGuest = vrcGuest; 1864 1857 vrc = VERR_GSTCTL_GUEST_ERROR; 1865 1858 } … … 1868 1861 vrc = VERR_BROKEN_PIPE; 1869 1862 } 1870 else if (p rcGuest)1871 *p rcGuest = vrcGuest;1863 else if (pvrcGuest) 1864 *pvrcGuest = vrcGuest; 1872 1865 1873 1866 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); … … 1901 1894 */ 1902 1895 /* static */ 1903 Utf8Str GuestSession::i_guestErrorToString(int rcGuest)1896 Utf8Str GuestSession::i_guestErrorToString(int vrcGuest) 1904 1897 { 1905 1898 Utf8Str strError; 1906 1899 1907 1900 /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ 1908 switch ( rcGuest)1901 switch (vrcGuest) 1909 1902 { 1910 1903 case VERR_INVALID_VM_HANDLE: … … 1941 1934 1942 1935 default: 1943 strError.printf("%Rrc", rcGuest);1936 strError.printf("%Rrc", vrcGuest); 1944 1937 break; 1945 1938 } … … 2070 2063 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2071 2064 2072 LogFlowThisFunc(("ID=%RU32, uType=%RU32, rcGuest=%Rrc\n", 2073 mData.mSession.mID, dataCb.uType, dataCb.uResult)); 2065 LogFlowThisFunc(("ID=%RU32, uType=%RU32, vrcGuest=%Rrc\n", mData.mSession.mID, dataCb.uType, dataCb.uResult)); 2074 2066 2075 2067 GuestSessionStatus_T sessionStatus = GuestSessionStatus_Undefined; 2076 2068 2077 int rcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */2069 int vrcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */ 2078 2070 switch (dataCb.uType) 2079 2071 { 2080 2072 case GUEST_SESSION_NOTIFYTYPE_ERROR: 2081 2073 sessionStatus = GuestSessionStatus_Error; 2082 LogRel(("Guest Control: Error starting Session '%s' (%Rrc) \n", mData.mSession.mName.c_str(), rcGuest));2074 LogRel(("Guest Control: Error starting Session '%s' (%Rrc) \n", mData.mSession.mName.c_str(), vrcGuest)); 2083 2075 break; 2084 2076 … … 2151 2143 if (RT_SUCCESS(vrc)) 2152 2144 { 2153 if (RT_FAILURE( rcGuest))2145 if (RT_FAILURE(vrcGuest)) 2154 2146 sessionStatus = GuestSessionStatus_Error; 2155 2147 } … … 2157 2149 /* Set the session status. */ 2158 2150 if (RT_SUCCESS(vrc)) 2159 vrc = i_setSessionStatus(sessionStatus, rcGuest);2160 2161 LogFlowThisFunc(("ID=%RU32, rcGuest=%Rrc\n", mData.mSession.mID,rcGuest));2151 vrc = i_setSessionStatus(sessionStatus, vrcGuest); 2152 2153 LogFlowThisFunc(("ID=%RU32, vrcGuest=%Rrc\n", mData.mSession.mID, vrcGuest)); 2162 2154 2163 2155 LogFlowFuncLeaveRC(vrc); … … 2213 2205 * 2214 2206 * @returns VBox status code. 2215 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR2216 * was returned. Optional.2207 * @param pvrcGuest Where to return the guest error when 2208 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 2217 2209 * 2218 2210 * @note Takes the read and write locks. 2219 2211 */ 2220 int GuestSession::i_startSession(int *p rcGuest)2212 int GuestSession::i_startSession(int *pvrcGuest) 2221 2213 { 2222 2214 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2232 2224 alock.release(); /* Release lock before changing status. */ 2233 2225 2234 /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS);2226 i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS); /* ignore return code*/ 2235 2227 LogFlowThisFunc(("Installed Guest Additions don't support opening dedicated sessions, skipping\n")); 2236 2228 return VINF_SUCCESS; … … 2287 2279 vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start, 2288 2280 30 * 1000 /* 30s timeout */, 2289 NULL /* Session status */, p rcGuest);2281 NULL /* Session status */, pvrcGuest); 2290 2282 } 2291 2283 else … … 2297 2289 * same function again will work though. 2298 2290 */ 2299 /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Error, vrc);2291 i_setSessionStatus(GuestSessionStatus_Error, vrc); /* ignore return code */ 2300 2292 } 2301 2293 … … 2362 2354 return VERR_COM_INVALID_OBJECT_STATE; 2363 2355 2364 int vrc = pSession->i_startSession(NULL /* Guest rc, ignored*/);2356 int vrc = pSession->i_startSession(NULL /*pvrcGuest*/); 2365 2357 /* Nothing to do here anymore. */ 2366 2358 … … 2442 2434 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2443 2435 2444 int rc = VINF_SUCCESS;2445 AssertMsgStmt(ASMBitTestAndClear(&mData.bmObjectIds, idObject), ("idObject=%#x\n", idObject), rc = VERR_NOT_FOUND);2436 int vrc = VINF_SUCCESS; 2437 AssertMsgStmt(ASMBitTestAndClear(&mData.bmObjectIds, idObject), ("idObject=%#x\n", idObject), vrc = VERR_NOT_FOUND); 2446 2438 2447 2439 SessionObjects::iterator ItObj = mData.mObjects.find(idObject); … … 2449 2441 mData.mObjects.erase(ItObj); 2450 2442 2451 return rc;2443 return vrc; 2452 2444 } 2453 2445 … … 2548 2540 * @param strDest Destination path on guest to rename \a strSource to. 2549 2541 * @param uFlags Renaming flags. 2550 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR2551 * was returned. Optional.2542 * @param pvrcGuest Where to return the guest error when 2543 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 2552 2544 * @note Takes the read lock. 2553 2545 */ 2554 int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *p rcGuest)2546 int GuestSession::i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest) 2555 2547 { 2556 2548 AssertReturn(!(uFlags & ~PATHRENAME_FLAG_VALID_MASK), VERR_INVALID_PARAMETER); … … 2583 2575 vrc = pEvent->Wait(30 * 1000); 2584 2576 if ( vrc == VERR_GSTCTL_GUEST_ERROR 2585 && p rcGuest)2586 *p rcGuest = pEvent->GuestResult();2577 && pvrcGuest) 2578 *pvrcGuest = pEvent->GuestResult(); 2587 2579 } 2588 2580 … … 2597 2589 * 2598 2590 * @returns VBox status code. 2599 * @param strPath Where to store the user's document path. 2600 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 2601 * Any other return code indicates some host side error. 2591 * @param strPath Where to store the user's document path. 2592 * @param pvrcGuest Guest VBox status code, when returning 2593 * VERR_GSTCTL_GUEST_ERROR. Any other return code indicates 2594 * some host side error. 2602 2595 * 2603 2596 * @note Takes the read lock. 2604 2597 */ 2605 int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *p rcGuest)2598 int GuestSession::i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest) 2606 2599 { 2607 2600 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2633 2626 if (vrc == VERR_GSTCTL_GUEST_ERROR) 2634 2627 { 2635 if (p rcGuest)2636 *p rcGuest = pEvent->GuestResult();2628 if (pvrcGuest) 2629 *pvrcGuest = pEvent->GuestResult(); 2637 2630 } 2638 2631 } … … 2649 2642 * 2650 2643 * @returns VBox status code. 2651 * @param strPath Where to store the user's home path. 2652 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 2653 * Any other return code indicates some host side error. 2644 * @param strPath Where to store the user's home path. 2645 * @param pvrcGuest Guest VBox status code, when returning 2646 * VERR_GSTCTL_GUEST_ERROR. Any other return code indicates 2647 * some host side error. 2654 2648 * 2655 2649 * @note Takes the read lock. 2656 2650 */ 2657 int GuestSession::i_pathUserHome(Utf8Str &strPath, int *p rcGuest)2651 int GuestSession::i_pathUserHome(Utf8Str &strPath, int *pvrcGuest) 2658 2652 { 2659 2653 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2685 2679 if (vrc == VERR_GSTCTL_GUEST_ERROR) 2686 2680 { 2687 if (p rcGuest)2688 *p rcGuest = pEvent->GuestResult();2681 if (pvrcGuest) 2682 *pvrcGuest = pEvent->GuestResult(); 2689 2683 } 2690 2684 } … … 2717 2711 LogFlowFunc(("Removing process (objectID=%RU32) ...\n", idObject)); 2718 2712 2719 int rc = i_objectUnregister(idObject);2720 if (RT_FAILURE( rc))2721 return rc;2713 int vrc = i_objectUnregister(idObject); 2714 if (RT_FAILURE(vrc)) 2715 return vrc; 2722 2716 2723 2717 SessionProcesses::iterator itProcs = mData.mProcesses.find(idObject); … … 2728 2722 2729 2723 ULONG uPID; 2730 HRESULT hr = pProc->COMGETTER(PID)(&uPID);2731 ComAssertComRC(hr );2724 HRESULT hrc = pProc->COMGETTER(PID)(&uPID); 2725 ComAssertComRC(hrc); 2732 2726 2733 2727 LogFlowFunc(("Removing process ID=%RU32 (session %RU32, guest PID %RU32, now total %zu processes)\n", 2734 2728 idObject, mData.mSession.mID, uPID, mData.mProcesses.size())); 2735 2729 2736 rc = pProcess->i_onUnregister();2737 AssertRCReturn( rc,rc);2730 vrc = pProcess->i_onUnregister(); 2731 AssertRCReturn(vrc, vrc); 2738 2732 2739 2733 mData.mProcesses.erase(itProcs); … … 2745 2739 pProc.setNull(); 2746 2740 2747 LogFlowFuncLeaveRC( rc);2748 return rc;2741 LogFlowFuncLeaveRC(vrc); 2742 return vrc; 2749 2743 } 2750 2744 … … 2818 2812 2819 2813 /* Create the process object. */ 2820 HRESULT hr = pProcess.createObject();2821 if (FAILED(hr ))2814 HRESULT hrc = pProcess.createObject(); 2815 if (FAILED(hrc)) 2822 2816 return VERR_COM_UNEXPECTED; 2823 2817 2824 2818 /* Register a new object ID. */ 2825 2819 uint32_t idObject; 2826 int rc = i_objectRegister(pProcess, SESSIONOBJECTTYPE_PROCESS, &idObject);2827 if (RT_FAILURE( rc))2820 int vrc = i_objectRegister(pProcess, SESSIONOBJECTTYPE_PROCESS, &idObject); 2821 if (RT_FAILURE(vrc)) 2828 2822 { 2829 2823 pProcess.setNull(); 2830 return rc; 2831 } 2832 2833 rc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */, idObject, 2834 procInfo, mData.mpBaseEnvironment); 2835 if (RT_FAILURE(rc)) 2836 return rc; 2824 return vrc; 2825 } 2826 2827 vrc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */, idObject, procInfo, mData.mpBaseEnvironment); 2828 if (RT_FAILURE(vrc)) 2829 return vrc; 2837 2830 2838 2831 /* Add the created process to our map. */ … … 2850 2843 catch (std::bad_alloc &) 2851 2844 { 2852 rc = VERR_NO_MEMORY;2853 } 2854 2855 return rc;2845 vrc = VERR_NO_MEMORY; 2846 } 2847 2848 return vrc; 2856 2849 } 2857 2850 … … 2900 2893 2901 2894 ULONG uCurPID; 2902 HRESULT hr = pCurProc->COMGETTER(PID)(&uCurPID);2903 ComAssertComRC(hr );2895 HRESULT hrc = pCurProc->COMGETTER(PID)(&uCurPID); 2896 ComAssertComRC(hrc); 2904 2897 2905 2898 if (uCurPID == uPID) … … 2964 2957 * @returns VBox status code. 2965 2958 * @param sessionStatus Session status to set. 2966 * @param sessionRcSession result to set (for error handling).2959 * @param vrcSession Session result to set (for error handling). 2967 2960 * 2968 2961 * @note Takes the write lock. 2969 2962 */ 2970 int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc) 2971 { 2972 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, sessionRc=%Rrc\n", 2973 mData.mStatus, sessionStatus, sessionRc)); 2963 int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession) 2964 { 2965 LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, vrcSession=%Rrc\n", mData.mStatus, sessionStatus, vrcSession)); 2974 2966 2975 2967 if (sessionStatus == GuestSessionStatus_Error) 2976 2968 { 2977 AssertMsg(RT_FAILURE( sessionRc), ("Guest rc must be an error (%Rrc)\n", sessionRc));2969 AssertMsg(RT_FAILURE(vrcSession), ("Guest vrcSession must be an error (%Rrc)\n", vrcSession)); 2978 2970 /* Do not allow overwriting an already set error. If this happens 2979 2971 * this means we forgot some error checking/locking somewhere. */ 2980 AssertMsg(RT_SUCCESS(mData.mVrc), ("Guest rc already set (to %Rrc)\n", mData.mVrc));2972 AssertMsg(RT_SUCCESS(mData.mVrc), ("Guest mVrc already set (to %Rrc)\n", mData.mVrc)); 2981 2973 } 2982 2974 else 2983 AssertMsg(RT_SUCCESS( sessionRc), ("Guest rc must not be an error (%Rrc)\n", sessionRc));2975 AssertMsg(RT_SUCCESS(vrcSession), ("Guest vrcSession must not be an error (%Rrc)\n", vrcSession)); 2984 2976 2985 2977 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2990 2982 { 2991 2983 mData.mStatus = sessionStatus; 2992 mData.mVrc = sessionRc;2984 mData.mVrc = vrcSession; 2993 2985 2994 2986 /* Make sure to notify all underlying objects first. */ … … 2996 2988 2997 2989 ComObjPtr<VirtualBoxErrorInfo> errorInfo; 2998 HRESULT hr = errorInfo.createObject(); 2999 ComAssertComRC(hr); 3000 int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, sessionRc, 3001 COM_IIDOF(IGuestSession), getComponentName(), 3002 i_guestErrorToString(sessionRc)); 3003 AssertRC(rc2); 2990 HRESULT hrc = errorInfo.createObject(); 2991 ComAssertComRC(hrc); 2992 int vrc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, vrcSession, COM_IIDOF(IGuestSession), getComponentName(), 2993 i_guestErrorToString(vrcSession)); 2994 AssertRC(vrc2); 3004 2995 3005 2996 alock.release(); /* Release lock before firing off event. */ … … 3013 3004 3014 3005 /** @todo Unused --remove? */ 3015 int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */)3016 { 3017 RT_NOREF(enmWaitResult, rc);3018 3019 /*LogFlowThisFunc(("enmWaitResult=%d, rc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n",3020 enmWaitResult, rc, mData.mWaitCount, mData.mWaitEvent));*/3006 int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */) 3007 { 3008 RT_NOREF(enmWaitResult, vrc); 3009 3010 /*LogFlowThisFunc(("enmWaitResult=%d, vrc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n", 3011 enmWaitResult, vrc, mData.mWaitCount, mData.mWaitEvent));*/ 3021 3012 3022 3013 /* Note: No write locking here -- already done in the caller. */ 3023 3014 3024 int vrc = VINF_SUCCESS;3015 int vrc2 = VINF_SUCCESS; 3025 3016 /*if (mData.mWaitEvent) 3026 vrc = mData.mWaitEvent->Signal(enmWaitResult,rc);*/3027 LogFlowFuncLeaveRC(vrc );3028 return vrc ;3017 vrc2 = mData.mWaitEvent->Signal(enmWaitResult, vrc);*/ 3018 LogFlowFuncLeaveRC(vrc2); 3019 return vrc2; 3029 3020 } 3030 3021 … … 3034 3025 * 3035 3026 * @returns VBox status code. VERR_NOT_SUPPORTED if not supported by Guest Additions. 3036 * @param fFlags Guest shutdown flags. 3037 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 3038 * Any other return code indicates some host side error. 3027 * @param fFlags Guest shutdown flags. 3028 * @param pvrcGuest Guest VBox status code, when returning 3029 * VERR_GSTCTL_GUEST_ERROR. Any other return code indicates 3030 * some host side error. 3039 3031 * 3040 3032 * @note Takes the read lock. 3041 3033 */ 3042 int GuestSession::i_shutdown(uint32_t fFlags, int *p rcGuest)3034 int GuestSession::i_shutdown(uint32_t fFlags, int *pvrcGuest) 3043 3035 { 3044 3036 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 3063 3055 alock.release(); /* Drop lock before sending. */ 3064 3056 3065 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;3057 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3066 3058 3067 3059 vrc = i_sendMessage(HOST_MSG_SHUTDOWN, i, paParms); … … 3072 3064 { 3073 3065 if (vrc == VERR_GSTCTL_GUEST_ERROR) 3074 rcGuest = pEvent->GuestResult();3066 vrcGuest = pEvent->GuestResult(); 3075 3067 } 3076 3068 } … … 3078 3070 if (RT_FAILURE(vrc)) 3079 3071 { 3080 LogRel(("Guest Control: Shutting down guest failed, rc=%Rrc\n", 3081 vrc == VERR_GSTCTL_GUEST_ERROR ? rcGuest : vrc)); 3082 3072 LogRel(("Guest Control: Shutting down guest failed, vrc=%Rrc\n", vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc)); 3083 3073 if ( vrc == VERR_GSTCTL_GUEST_ERROR 3084 && p rcGuest)3085 *p rcGuest =rcGuest;3074 && pvrcGuest) 3075 *pvrcGuest = vrcGuest; 3086 3076 } 3087 3077 … … 3142 3132 * @param uTimeoutMS Timeout (in ms) to wait. 3143 3133 * @param waitResult Where to return the wait result on success. 3144 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR3145 * was returned. Optional.3134 * @param pvrcGuest Where to return the guest error when 3135 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 3146 3136 * 3147 3137 * @note Takes the read lock. 3148 3138 */ 3149 int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *p rcGuest)3139 int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest) 3150 3140 { 3151 3141 LogFlowThisFuncEnter(); … … 3153 3143 AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER); 3154 3144 3155 /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, p rcGuest=%p\n",3156 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, p rcGuest));*/3145 /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, pvrcGuest=%p\n", 3146 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, pvrcGuest));*/ 3157 3147 3158 3148 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 3162 3152 { 3163 3153 waitResult = GuestSessionWaitResult_Error; 3164 AssertMsg(RT_FAILURE(mData.mVrc), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mVrc));3165 if (p rcGuest)3166 *p rcGuest = mData.mVrc; /* Return last set error. */3154 AssertMsg(RT_FAILURE(mData.mVrc), ("No error mVrc (%Rrc) set when guest session indicated an error\n", mData.mVrc)); 3155 if (pvrcGuest) 3156 *pvrcGuest = mData.mVrc; /* Return last set error. */ 3167 3157 return VERR_GSTCTL_GUEST_ERROR; 3168 3158 } … … 3241 3231 } 3242 3232 3243 LogFlowThisFunc(("sessionStatus=%RU32, sessionRc=%Rrc, waitResult=%RU32\n", mData.mStatus, mData.mVrc, waitResult));3233 LogFlowThisFunc(("sessionStatus=%RU32, vrcSession=%Rrc, waitResult=%RU32\n", mData.mStatus, mData.mVrc, waitResult)); 3244 3234 3245 3235 /* No waiting needed? Return immediately using the last set error. */ 3246 3236 if (waitResult != GuestSessionWaitResult_None) 3247 3237 { 3248 if (p rcGuest)3249 *p rcGuest = mData.mVrc; /* Return last set error (if any). */3238 if (pvrcGuest) 3239 *pvrcGuest = mData.mVrc; /* Return last set error (if any). */ 3250 3240 return RT_SUCCESS(mData.mVrc) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; 3251 3241 } … … 3278 3268 GuestSessionStatus_T sessionStatus; 3279 3269 vrc = i_waitForStatusChange(pEvent, fWaitFlags, 3280 uTimeoutMS - (tsNow - tsStart), &sessionStatus, p rcGuest);3270 uTimeoutMS - (tsNow - tsStart), &sessionStatus, pvrcGuest); 3281 3271 if (RT_SUCCESS(vrc)) 3282 3272 { … … 3351 3341 * @param uTimeoutMS Timeout (in ms) to wait. 3352 3342 * @param pSessionStatus Where to return the guest session status. 3353 * @param p rcGuest Where to return the guest error when VERR_GSTCTL_GUEST_ERROR3354 * was returned. Optional.3343 * @param pvrcGuest Where to return the guest error when 3344 * VERR_GSTCTL_GUEST_ERROR was returned. Optional. 3355 3345 */ 3356 3346 int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, 3357 GuestSessionStatus_T *pSessionStatus, int *p rcGuest)3347 GuestSessionStatus_T *pSessionStatus, int *pvrcGuest) 3358 3348 { 3359 3349 RT_NOREF(fWaitFlags); … … 3376 3366 3377 3367 ComPtr<IVirtualBoxErrorInfo> errorInfo; 3378 HRESULT hr = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam());3379 ComAssertComRC(hr );3368 HRESULT hrc = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam()); 3369 ComAssertComRC(hrc); 3380 3370 3381 3371 LONG lGuestRc; 3382 hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);3383 ComAssertComRC(hr );3372 hrc = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); 3373 ComAssertComRC(hrc); 3384 3374 if (RT_FAILURE((int)lGuestRc)) 3385 3375 vrc = VERR_GSTCTL_GUEST_ERROR; 3386 if (p rcGuest)3387 *p rcGuest = (int)lGuestRc;3376 if (pvrcGuest) 3377 *pvrcGuest = (int)lGuestRc; 3388 3378 3389 3379 LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: %RU32 (%Rrc)\n", … … 3394 3384 AssertMsgFailedReturn(("Got unexpected event type %#x\n", evtType), VERR_WRONG_ORDER); 3395 3385 } 3396 /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make p rcGuest is set. */3397 else if (vrc == VERR_GSTCTL_GUEST_ERROR && p rcGuest)3398 *p rcGuest = pEvent->GuestResult();3399 Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !p rcGuest || *prcGuest != (int)0xcccccccc);3386 /* waitForEvent may also return VERR_GSTCTL_GUEST_ERROR like we do above, so make pvrcGuest is set. */ 3387 else if (vrc == VERR_GSTCTL_GUEST_ERROR && pvrcGuest) 3388 *pvrcGuest = pEvent->GuestResult(); 3389 Assert(vrc != VERR_GSTCTL_GUEST_ERROR || !pvrcGuest || *pvrcGuest != (int)0xcccccccc); 3400 3390 3401 3391 LogFlowFuncLeaveRC(vrc); … … 3413 3403 * the session (already) could be in a stopped / aborted state. */ 3414 3404 3415 int vrc = VINF_SUCCESS; /* Shut up MSVC. */3416 int rcGuest = VINF_SUCCESS;3405 int vrc = VINF_SUCCESS; /* Shut up MSVC. */ 3406 int vrcGuest = VINF_SUCCESS; 3417 3407 3418 3408 uint32_t msTimeout = RT_MS_10SEC; /* 10s timeout by default */ … … 3427 3417 3428 3418 /* Close session on guest. */ 3429 vrc = i_closeSession(0 /* Flags */, msTimeout, & rcGuest);3419 vrc = i_closeSession(0 /* Flags */, msTimeout, &vrcGuest); 3430 3420 if ( RT_SUCCESS(vrc) 3431 3421 || vrc != VERR_TIMEOUT) /* If something else happened there is no point in retrying further. */ … … 3445 3435 vrc = vrc2; 3446 3436 3447 LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", vrc,rcGuest));3437 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); 3448 3438 3449 3439 if (RT_FAILURE(vrc)) … … 3451 3441 if (vrc == VERR_GSTCTL_GUEST_ERROR) 3452 3442 { 3453 GuestErrorInfo ge(GuestErrorInfo::Type_Session, rcGuest, mData.mSession.mName.c_str());3454 return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Closing guest session failed: %s"),3443 GuestErrorInfo ge(GuestErrorInfo::Type_Session, vrcGuest, mData.mSession.mName.c_str()); 3444 return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Closing guest session failed: %s"), 3455 3445 GuestBase::getErrorAsString(ge).c_str()); 3456 3446 } … … 3551 3541 { 3552 3542 GuestFsObjData objData; 3553 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;3554 int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, & rcGuest);3543 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3544 int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, &vrcGuest); 3555 3545 if ( RT_FAILURE(vrc) 3556 3546 && !fContinueOnErrors) … … 3558 3548 if (GuestProcess::i_isGuestError(vrc)) 3559 3549 { 3560 GuestErrorInfo ge(GuestErrorInfo::Type_Process, rcGuest, (*itSource).c_str());3561 return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying type for guest source failed: %s"),3550 GuestErrorInfo ge(GuestErrorInfo::Type_Process, vrcGuest, (*itSource).c_str()); 3551 return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying type for guest source failed: %s"), 3562 3552 GuestBase::getErrorAsString(ge).c_str()); 3563 3553 } … … 3757 3747 LogFlowThisFuncEnter(); 3758 3748 3759 ComObjPtr <GuestDirectory> pDirectory; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3760 int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &rcGuest); 3749 ComObjPtr <GuestDirectory> pDirectory; 3750 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3751 int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &vrcGuest); 3761 3752 if (RT_FAILURE(vrc)) 3762 3753 { 3763 3754 if (GuestProcess::i_isGuestError(vrc)) 3764 3755 { 3765 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());3766 return setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Guest directory creation failed: %s"),3756 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); 3757 return setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Guest directory creation failed: %s"), 3767 3758 GuestBase::getErrorAsString(ge).c_str()); 3768 3759 } … … 3803 3794 LogFlowThisFuncEnter(); 3804 3795 3805 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;3806 int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), & rcGuest);3796 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3797 int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), &vrcGuest); 3807 3798 if (!RT_SUCCESS(vrc)) 3808 3799 { … … 3811 3802 case VERR_GSTCTL_GUEST_ERROR: 3812 3803 { 3813 GuestErrorInfo ge(GuestErrorInfo::Type_ToolMkTemp, rcGuest, aPath.c_str());3814 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Temporary guest directory creation failed: %s"),3804 GuestErrorInfo ge(GuestErrorInfo::Type_ToolMkTemp, vrcGuest, aPath.c_str()); 3805 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Temporary guest directory creation failed: %s"), 3815 3806 GuestBase::getErrorAsString(ge).c_str()); 3816 3807 break; … … 3838 3829 3839 3830 GuestFsObjData objData; 3840 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;3841 3842 int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, & rcGuest);3831 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3832 3833 int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &vrcGuest); 3843 3834 if (RT_SUCCESS(vrc)) 3844 3835 *aExists = TRUE; … … 3849 3840 case VERR_GSTCTL_GUEST_ERROR: 3850 3841 { 3851 switch ( rcGuest)3842 switch (vrcGuest) 3852 3843 { 3853 3844 case VERR_PATH_NOT_FOUND: … … 3856 3847 default: 3857 3848 { 3858 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());3859 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying directory existence failed: %s"),3849 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); 3850 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying directory existence failed: %s"), 3860 3851 GuestBase::getErrorAsString(ge).c_str()); 3861 3852 break; … … 3910 3901 openInfo.mFlags = fFlags; 3911 3902 3912 ComObjPtr<GuestDirectory> pDirectory; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3913 int vrc = i_directoryOpen(openInfo, pDirectory, &rcGuest); 3903 ComObjPtr<GuestDirectory> pDirectory; 3904 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3905 int vrc = i_directoryOpen(openInfo, pDirectory, &vrcGuest); 3914 3906 if (RT_SUCCESS(vrc)) 3915 3907 { … … 3928 3920 case VERR_GSTCTL_GUEST_ERROR: 3929 3921 { 3930 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());3931 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Opening guest directory failed: %s"),3922 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); 3923 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Opening guest directory failed: %s"), 3932 3924 GuestBase::getErrorAsString(ge).c_str()); 3933 3925 break; … … 3956 3948 uint32_t fFlags = DIRREMOVEREC_FLAG_NONE; 3957 3949 3958 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;3959 int vrc = i_directoryRemove(aPath, fFlags, & rcGuest);3950 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3951 int vrc = i_directoryRemove(aPath, fFlags, &vrcGuest); 3960 3952 if (RT_FAILURE(vrc)) 3961 3953 { … … 3969 3961 case VERR_GSTCTL_GUEST_ERROR: 3970 3962 { 3971 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());3972 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Removing guest directory failed: %s"),3963 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); 3964 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Removing guest directory failed: %s"), 3973 3965 GuestBase::getErrorAsString(ge).c_str()); 3974 3966 break; … … 4037 4029 return hrc; 4038 4030 4039 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;4040 int vrc = i_directoryRemove(aPath, fFlags, & rcGuest);4031 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4032 int vrc = i_directoryRemove(aPath, fFlags, &vrcGuest); 4041 4033 if (RT_FAILURE(vrc)) 4042 4034 { … … 4050 4042 case VERR_GSTCTL_GUEST_ERROR: 4051 4043 { 4052 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, rcGuest, aPath.c_str());4053 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Recursively removing guest directory failed: %s"),4044 GuestErrorInfo ge(GuestErrorInfo::Type_Directory, vrcGuest, aPath.c_str()); 4045 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Recursively removing guest directory failed: %s"), 4054 4046 GuestBase::getErrorAsString(ge).c_str()); 4055 4047 break; … … 4176 4168 LogFlowThisFuncEnter(); 4177 4169 4178 GuestFsObjData objData; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4179 int vrc = i_fileQueryInfo(aPath, RT_BOOL(aFollowSymlinks), objData, &rcGuest); 4170 GuestFsObjData objData; 4171 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4172 int vrc = i_fileQueryInfo(aPath, RT_BOOL(aFollowSymlinks), objData, &vrcGuest); 4180 4173 if (RT_SUCCESS(vrc)) 4181 4174 { … … 4188 4181 case VERR_GSTCTL_GUEST_ERROR: 4189 4182 { 4190 switch ( rcGuest)4183 switch (vrcGuest) 4191 4184 { 4192 4185 case VERR_PATH_NOT_FOUND: … … 4197 4190 default: 4198 4191 { 4199 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());4200 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file existence failed: %s"),4192 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); 4193 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file existence failed: %s"), 4201 4194 GuestBase::getErrorAsString(ge).c_str()); 4202 4195 break; … … 4302 4295 4303 4296 ComObjPtr <GuestFile> pFile; 4304 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;4305 int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, & rcGuest);4297 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4298 int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, &vrcGuest); 4306 4299 if (RT_SUCCESS(vrc)) 4307 4300 /* Return directory object to the caller. */ … … 4318 4311 case VERR_GSTCTL_GUEST_ERROR: 4319 4312 { 4320 GuestErrorInfo ge(GuestErrorInfo::Type_File, rcGuest, aPath.c_str());4321 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Opening guest file failed: %s"),4313 GuestErrorInfo ge(GuestErrorInfo::Type_File, vrcGuest, aPath.c_str()); 4314 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Opening guest file failed: %s"), 4322 4315 GuestBase::getErrorAsString(ge).c_str()); 4323 4316 break; … … 4341 4334 return hrc; 4342 4335 4343 int64_t llSize; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4344 int vrc = i_fileQuerySize(aPath, aFollowSymlinks != FALSE, &llSize, &rcGuest); 4336 int64_t llSize; 4337 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4338 int vrc = i_fileQuerySize(aPath, aFollowSymlinks != FALSE, &llSize, &vrcGuest); 4345 4339 if (RT_SUCCESS(vrc)) 4346 {4347 4340 *aSize = llSize; 4348 }4349 4341 else 4350 4342 { 4351 4343 if (GuestProcess::i_isGuestError(vrc)) 4352 4344 { 4353 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());4354 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file size failed: %s"),4345 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); 4346 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file size failed: %s"), 4355 4347 GuestBase::getErrorAsString(ge).c_str()); 4356 4348 } … … 4391 4383 4392 4384 GuestFsObjData objData; 4393 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;4394 int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, objData, & rcGuest);4385 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4386 int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &vrcGuest); 4395 4387 if (RT_SUCCESS(vrc)) 4396 {4397 4388 *aExists = TRUE; 4398 }4399 4389 else 4400 4390 { 4401 4391 if (GuestProcess::i_isGuestError(vrc)) 4402 4392 { 4403 if ( rcGuest == VERR_NOT_A_FILE 4404 || rcGuest == VERR_PATH_NOT_FOUND 4405 || rcGuest == VERR_FILE_NOT_FOUND 4406 || rcGuest == VERR_INVALID_NAME) 4407 { 4393 if ( vrcGuest == VERR_NOT_A_FILE 4394 || vrcGuest == VERR_PATH_NOT_FOUND 4395 || vrcGuest == VERR_FILE_NOT_FOUND 4396 || vrcGuest == VERR_INVALID_NAME) 4408 4397 hrc = S_OK; /* Ignore these vrc values. */ 4409 }4410 4398 else 4411 4399 { 4412 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());4413 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file existence information failed: %s"),4400 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); 4401 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file existence information failed: %s"), 4414 4402 GuestBase::getErrorAsString(ge).c_str()); 4415 4403 } … … 4433 4421 LogFlowThisFunc(("aPath=%s, aFollowSymlinks=%RTbool\n", aPath.c_str(), RT_BOOL(aFollowSymlinks))); 4434 4422 4435 GuestFsObjData Info; int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4436 int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, Info, &rcGuest); 4423 GuestFsObjData Info; 4424 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4425 int vrc = i_fsQueryInfo(aPath, aFollowSymlinks != FALSE, Info, &vrcGuest); 4437 4426 if (RT_SUCCESS(vrc)) 4438 4427 { … … 4452 4441 if (GuestProcess::i_isGuestError(vrc)) 4453 4442 { 4454 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, rcGuest, aPath.c_str());4455 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying guest file information failed: %s"),4443 GuestErrorInfo ge(GuestErrorInfo::Type_ToolStat, vrcGuest, aPath.c_str()); 4444 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file information failed: %s"), 4456 4445 GuestBase::getErrorAsString(ge).c_str()); 4457 4446 } … … 4474 4463 LogFlowThisFunc(("aPath=%s\n", aPath.c_str())); 4475 4464 4476 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;4477 int vrc = i_fileRemove(aPath, & rcGuest);4465 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4466 int vrc = i_fileRemove(aPath, &vrcGuest); 4478 4467 if (RT_FAILURE(vrc)) 4479 4468 { 4480 4469 if (GuestProcess::i_isGuestError(vrc)) 4481 4470 { 4482 GuestErrorInfo ge(GuestErrorInfo::Type_ToolRm, rcGuest, aPath.c_str());4483 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Removing guest file failed: %s"),4471 GuestErrorInfo ge(GuestErrorInfo::Type_ToolRm, vrcGuest, aPath.c_str()); 4472 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Removing guest file failed: %s"), 4484 4473 GuestBase::getErrorAsString(ge).c_str()); 4485 4474 } … … 4529 4518 4530 4519 /* Call worker to do the job. */ 4531 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;4532 int vrc = i_pathRename(aSource, aDestination, fBackend, & rcGuest);4520 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4521 int vrc = i_pathRename(aSource, aDestination, fBackend, &vrcGuest); 4533 4522 if (RT_FAILURE(vrc)) 4534 4523 { … … 4542 4531 case VERR_GSTCTL_GUEST_ERROR: 4543 4532 { 4544 GuestErrorInfo ge(GuestErrorInfo::Type_Process, rcGuest, aSource.c_str());4545 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Renaming guest path failed: %s"),4533 GuestErrorInfo ge(GuestErrorInfo::Type_Process, vrcGuest, aSource.c_str()); 4534 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Renaming guest path failed: %s"), 4546 4535 GuestBase::getErrorAsString(ge).c_str()); 4547 4536 break; … … 4607 4596 ComPtr<IGuestProcess> &aGuestProcess) 4608 4597 { 4609 HRESULT hr = i_isStartedExternal();4610 if (FAILED(hr ))4611 return hr ;4598 HRESULT hrc = i_isStartedExternal(); 4599 if (FAILED(hrc)) 4600 return hrc; 4612 4601 4613 4602 /* … … 4676 4665 { 4677 4666 ComPtr<IGuestProcess> pIProcess; 4678 hr = pProcess.queryInterfaceTo(pIProcess.asOutParam());4679 if (SUCCEEDED(hr ))4667 hrc = pProcess.queryInterfaceTo(pIProcess.asOutParam()); 4668 if (SUCCEEDED(hrc)) 4680 4669 { 4681 4670 /* … … 4691 4680 } 4692 4681 4693 hr = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc);4682 hrc = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc); 4694 4683 } 4695 4684 } 4696 4685 else if (vrc == VERR_GSTCTL_MAX_CID_OBJECTS_REACHED) 4697 hr = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"),4686 hrc = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"), 4698 4687 VBOX_GUESTCTRL_MAX_OBJECTS); 4699 4688 else 4700 hr = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc);4689 hrc = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc); 4701 4690 } 4702 4691 else 4703 hr = setErrorBoth(vrc == VERR_ENV_INVALID_VAR_NAME ? E_INVALIDARG : Global::vboxStatusCodeToCOM(vrc), vrc,4692 hrc = setErrorBoth(vrc == VERR_ENV_INVALID_VAR_NAME ? E_INVALIDARG : Global::vboxStatusCodeToCOM(vrc), vrc, 4704 4693 tr("Failed to apply environment variable '%s', index %u (%Rrc)'"), 4705 4694 aEnvironment[idxError].c_str(), idxError, vrc); 4706 4695 } 4707 4696 else 4708 hr = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc);4697 hrc = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc); 4709 4698 4710 4699 LogFlowFuncLeaveRC(vrc); 4711 return hr ;4700 return hrc; 4712 4701 } 4713 4702 … … 4722 4711 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4723 4712 4724 HRESULT hr = S_OK;4713 HRESULT hrc = S_OK; 4725 4714 4726 4715 ComObjPtr<GuestProcess> pProcess; 4727 int rc = i_processGetByPID(aPid, &pProcess);4728 if (RT_FAILURE( rc))4729 hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid);4716 int vrc = i_processGetByPID(aPid, &pProcess); 4717 if (RT_FAILURE(vrc)) 4718 hrc = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid); 4730 4719 4731 4720 /* This will set (*aProcess) to NULL if pProgress is NULL. */ 4732 HRESULT hr 2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam());4733 if (SUCCEEDED(hr ))4734 hr = hr2;4735 4736 LogFlowThisFunc(("aProcess=%p, hr =%Rhrc\n", (IGuestProcess*)aGuestProcess, hr));4737 return hr ;4721 HRESULT hrc2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam()); 4722 if (SUCCEEDED(hrc)) 4723 hrc = hrc2; 4724 4725 LogFlowThisFunc(("aProcess=%p, hrc=%Rhrc\n", (IGuestProcess*)aGuestProcess, hrc)); 4726 return hrc; 4738 4727 } 4739 4728 … … 4769 4758 * Note: Do not hold any locks here while waiting! 4770 4759 */ 4771 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; GuestSessionWaitResult_T waitResult;4772 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, & rcGuest);4760 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; GuestSessionWaitResult_T waitResult; 4761 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &vrcGuest); 4773 4762 if (RT_SUCCESS(vrc)) 4774 4763 *aReason = waitResult; … … 4779 4768 case VERR_GSTCTL_GUEST_ERROR: 4780 4769 { 4781 GuestErrorInfo ge(GuestErrorInfo::Type_Session, rcGuest, mData.mSession.mName.c_str());4782 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Waiting for guest process failed: %s"),4770 GuestErrorInfo ge(GuestErrorInfo::Type_Session, vrcGuest, mData.mSession.mName.c_str()); 4771 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Waiting for guest process failed: %s"), 4783 4772 GuestBase::getErrorAsString(ge).c_str()); 4784 4773 break; -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r98262 r98272 111 111 /* Create the progress object. */ 112 112 ComObjPtr<Progress> pProgress; 113 HRESULT hr = pProgress.createObject();114 if (FAILED(hr ))113 HRESULT hrc = pProgress.createObject(); 114 if (FAILED(hrc)) 115 115 return VERR_COM_UNEXPECTED; 116 116 117 hr = pProgress->init(static_cast<IGuestSession*>(mSession),118 Bstr(mDesc).raw(),119 TRUE /* aCancelable */, cOperations, Bstr(mDesc).raw());120 if (FAILED(hr ))117 hrc = pProgress->init(static_cast<IGuestSession*>(mSession), 118 Bstr(mDesc).raw(), 119 TRUE /* aCancelable */, cOperations, Bstr(mDesc).raw()); 120 if (FAILED(hrc)) 121 121 return VERR_COM_UNEXPECTED; 122 122 … … 159 159 Bstr strTemp, strFlags; 160 160 LONG64 i64Timestamp; 161 HRESULT hr = pMachine->GetGuestProperty(Bstr(strPath).raw(), 162 strTemp.asOutParam(), 163 &i64Timestamp, strFlags.asOutParam()); 164 if (SUCCEEDED(hr)) 161 HRESULT hrc = pMachine->GetGuestProperty(Bstr(strPath).raw(), strTemp.asOutParam(), &i64Timestamp, strFlags.asOutParam()); 162 if (SUCCEEDED(hrc)) 165 163 { 166 164 strValue = strTemp; … … 192 190 return VINF_SUCCESS; 193 191 } 194 HRESULT hr = mProgress->SetCurrentOperationProgress(uPercent);195 if (FAILED(hr ))192 HRESULT hrc = mProgress->SetCurrentOperationProgress(uPercent); 193 if (FAILED(hrc)) 196 194 return VERR_COM_UNEXPECTED; 197 195 … … 218 216 AssertMsg(uCurOp + 1 /* Zero-based */ == cOps, ("Not all operations done yet (%u/%u)\n", uCurOp + 1, cOps)); 219 217 #endif 220 HRESULT hr = mProgress->i_notifyComplete(S_OK);221 if (FAILED(hr ))222 return VERR_COM_UNEXPECTED; /** @todo Find a better rc. */218 HRESULT hrc = mProgress->i_notifyComplete(S_OK); 219 if (FAILED(hrc)) 220 return VERR_COM_UNEXPECTED; /** @todo Find a better vrc. */ 223 221 } 224 222 … … 229 227 * Sets the task's progress object to an error using a string message. 230 228 * 231 * @returns Returns \a hr for convenience.232 * @param hr 229 * @returns Returns \a hrc for convenience. 230 * @param hrc Progress operation result to set. 233 231 * @param strMsg Message to set. 234 232 */ 235 HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr , const Utf8Str &strMsg)236 { 237 LogFlowFunc(("hr =%Rhrc, strMsg=%s\n", hr, strMsg.c_str()));233 HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg) 234 { 235 LogFlowFunc(("hrc=%Rhrc, strMsg=%s\n", hrc, strMsg.c_str())); 238 236 239 237 if (mProgress.isNull()) /* Progress is optional. */ 240 return hr ; /* Return original rc. */238 return hrc; /* Return original status. */ 241 239 242 240 BOOL fCanceled; … … 247 245 && !fCompleted) 248 246 { 249 HRESULT hr 2 = mProgress->i_notifyComplete(hr,250 COM_IIDOF(IGuestSession),251 GuestSession::getStaticComponentName(),252 /* Make sure to hand-in the message via format string to avoid problems253 * with (file) paths which e.g. contain "%s" and friends. Can happen with254 * randomly generated Validation Kit stuff. */255 "%s", strMsg.c_str());256 if (FAILED(hr 2))257 return hr 2;258 } 259 return hr ; /* Return original rc. */247 HRESULT hrc2 = mProgress->i_notifyComplete(hrc, 248 COM_IIDOF(IGuestSession), 249 GuestSession::getStaticComponentName(), 250 /* Make sure to hand-in the message via format string to avoid problems 251 * with (file) paths which e.g. contain "%s" and friends. Can happen with 252 * randomly generated Validation Kit stuff. */ 253 "%s", strMsg.c_str()); 254 if (FAILED(hrc2)) 255 return hrc2; 256 } 257 return hrc; /* Return original status. */ 260 258 } 261 259 … … 263 261 * Sets the task's progress object to an error using a string message and a guest error info object. 264 262 * 265 * @returns Returns \a hr for convenience.266 * @param hr 263 * @returns Returns \a hrc for convenience. 264 * @param hrc Progress operation result to set. 267 265 * @param strMsg Message to set. 268 266 * @param guestErrorInfo Guest error info to use. 269 267 */ 270 HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr , const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo)271 { 272 return setProgressErrorMsg(hr , strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo));268 HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hrc, const Utf8Str &strMsg, const GuestErrorInfo &guestErrorInfo) 269 { 270 return setProgressErrorMsg(hrc, strMsg + Utf8Str(": ") + GuestBase::getErrorAsString(guestErrorInfo)); 273 271 } 274 272 … … 1371 1369 1372 1370 if (RT_FAILURE(vrc)) 1373 LogRel2(("Guest Control: Unable to query symbolic link info for \"%s\", rc=%Rrc\n",1371 LogRel2(("Guest Control: Unable to query symbolic link info for \"%s\", vrc=%Rrc\n", 1374 1372 pszPathReal, vrc)); 1375 1373 } 1376 1374 else 1377 1375 { 1378 LogRel2(("Guest Control: Unable to resolve symlink for \"%s\", rc=%Rrc\n", strPathAbs.c_str(), vrc)); 1376 LogRel2(("Guest Control: Unable to resolve symlink for \"%s\", vrc=%Rrc\n", 1377 strPathAbs.c_str(), vrc)); 1379 1378 if (vrc == VERR_FILE_NOT_FOUND) /* Broken symlink, skip. */ 1380 1379 vrc = VINF_SUCCESS; … … 1401 1400 } 1402 1401 else 1403 LogFlowFunc(("Unable to query \"%s\", rc=%Rrc\n", strPathAbs.c_str(), vrc));1402 LogFlowFunc(("Unable to query \"%s\", vrc=%Rrc\n", strPathAbs.c_str(), vrc)); 1404 1403 1405 1404 LogFlowFuncLeaveRC(vrc); … … 2657 2656 break; 2658 2657 2659 case VERR_INVALID_STATE: /** @todo Special guest control rc needed! */2658 case VERR_INVALID_STATE: /** @todo Special guest control vrc needed! */ 2660 2659 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2661 2660 Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"), … … 2684 2683 { 2685 2684 int vrc = VERR_GSTCTL_GUEST_ERROR; 2686 int rc= VERR_TIMEOUT;2685 int vrcRet = VERR_TIMEOUT; 2687 2686 2688 2687 uint64_t tsStart = RTTimeSystemMilliTS(); 2689 const uint64_t timeoutMs = 600 * 1000;2688 const uint64_t cMsTimeout = 10 * RT_MS_1MIN; 2690 2689 2691 2690 AssertReturn(!pGuest.isNull(), VERR_TIMEOUT); … … 2703 2702 if (RT_SUCCESS(vrc)) 2704 2703 { 2704 Assert(!pSession.isNull()); 2705 2705 2706 int vrcGuest = VERR_GSTCTL_GUEST_ERROR; /* unused. */ 2706 2707 Assert(!pSession.isNull());2708 2709 2707 vrc = pSession->i_startSession(&vrcGuest); 2710 2708 if (RT_SUCCESS(vrc)) 2711 2709 { 2710 /* Wait for VBoxService to start. */ 2712 2711 GuestSessionWaitResult_T enmWaitResult = GuestSessionWaitResult_None; 2713 int rcGuest = 0; /* unused. */ 2714 2715 /* Wait for VBoxService to start. */ 2716 vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &rcGuest); 2712 int vrcGuest2 = VINF_SUCCESS; /* unused. */ 2713 vrc = pSession->i_waitFor(GuestSessionWaitForFlag_Start, 100 /* timeout, ms */, enmWaitResult, &vrcGuest2); 2717 2714 if (RT_SUCCESS(vrc)) 2718 2715 { 2719 2716 vrc = pSession->Close(); 2720 rc = 0;2717 vrcRet = VINF_SUCCESS; 2721 2718 break; 2722 2719 } … … 2728 2725 RTThreadSleep(100); 2729 2726 2730 } while ((RTTimeSystemMilliTS() - tsStart) < timeoutMs);2731 2732 return rc;2727 } while ((RTTimeSystemMilliTS() - tsStart) < cMsTimeout); 2728 2729 return vrcRet; 2733 2730 } 2734 2731
Note:
See TracChangeset
for help on using the changeset viewer.