- Timestamp:
- Mar 12, 2018 11:30:08 AM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestProcessImpl.h
r71281 r71299 188 188 { 189 189 /** Return code from the guest side for executing the process tool. */ 190 int guestRc;190 int rcGuest; 191 191 /** The process tool's returned exit code. */ 192 192 int32_t iExitCode; -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r69500 r71299 546 546 { 547 547 Assert(!pSession.isNull()); 548 int guestRc;549 rc = pSession->i_startSessionInternal(& guestRc);548 int rcGuest; 549 rc = pSession->i_startSessionInternal(&rcGuest); 550 550 if (RT_FAILURE(rc)) 551 551 { 552 /** @todo Handle guestRc! */552 /** @todo Handle rcGuest! */ 553 553 554 554 hr = setError(VBOX_E_IPRT_ERROR, tr("Could not open guest session: %Rrc"), rc); -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r71267 r71299 935 935 936 936 int GuestBase::signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, 937 int guestRc, const GuestWaitEventPayload *pPayload)938 { 939 if (RT_SUCCESS( guestRc))937 int rcGuest, const GuestWaitEventPayload *pPayload) 938 { 939 if (RT_SUCCESS(rcGuest)) 940 940 return signalWaitEventInternalEx(pCbCtx, VINF_SUCCESS, 941 941 0 /* Guest rc */, pPayload); 942 942 943 943 return signalWaitEventInternalEx(pCbCtx, VERR_GSTCTL_GUEST_ERROR, 944 guestRc, pPayload);944 rcGuest, pPayload); 945 945 } 946 946 947 947 int GuestBase::signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, 948 int rc, int guestRc,948 int rc, int rcGuest, 949 949 const GuestWaitEventPayload *pPayload) 950 950 { … … 958 958 if (itEvent != mWaitEvents.end()) 959 959 { 960 LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc, guestRc=%Rrc, pPayload=%p) ...\n",961 itEvent->second, itEvent->first, rc, guestRc, pPayload));960 LogFlowThisFunc(("Signalling event=%p (CID %RU32, rc=%Rrc, rcGuest=%Rrc, pPayload=%p) ...\n", 961 itEvent->second, itEvent->first, rc, rcGuest, pPayload)); 962 962 GuestWaitEvent *pEvent = itEvent->second; 963 963 AssertPtr(pEvent); 964 rc2 = pEvent->SignalInternal(rc, guestRc, pPayload);964 rc2 = pEvent->SignalInternal(rc, rcGuest, pPayload); 965 965 } 966 966 else … … 1164 1164 } 1165 1165 1166 int GuestWaitEventBase::SignalInternal(int rc, int guestRc,1166 int GuestWaitEventBase::SignalInternal(int rc, int rcGuest, 1167 1167 const GuestWaitEventPayload *pPayload) 1168 1168 { … … 1172 1172 #ifdef VBOX_STRICT 1173 1173 if (rc == VERR_GSTCTL_GUEST_ERROR) 1174 AssertMsg(RT_FAILURE( guestRc), ("Guest error indicated but no actual guest error set (%Rrc)\n", guestRc));1174 AssertMsg(RT_FAILURE(rcGuest), ("Guest error indicated but no actual guest error set (%Rrc)\n", rcGuest)); 1175 1175 else 1176 AssertMsg(RT_SUCCESS( guestRc), ("No guest error indicated but actual guest error set (%Rrc)\n", guestRc));1176 AssertMsg(RT_SUCCESS(rcGuest), ("No guest error indicated but actual guest error set (%Rrc)\n", rcGuest)); 1177 1177 #endif 1178 1178 … … 1185 1185 { 1186 1186 mRc = rc; 1187 mGuestRc = guestRc;1187 mGuestRc = rcGuest; 1188 1188 1189 1189 rc2 = RTSemEventSignal(mEventSem); -
trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
r71272 r71299 209 209 210 210 /* static */ 211 Utf8Str GuestDirectory::i_guestErrorToString(int guestRc)211 Utf8Str GuestDirectory::i_guestErrorToString(int rcGuest) 212 212 { 213 213 Utf8Str strError; 214 214 215 215 /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ 216 switch ( guestRc)216 switch (rcGuest) 217 217 { 218 218 case VERR_DIR_NOT_EMPTY: … … 221 221 222 222 default: 223 strError += Utf8StrFmt("%Rrc", guestRc);223 strError += Utf8StrFmt("%Rrc", rcGuest); 224 224 break; 225 225 } … … 247 247 * 248 248 * @return VBox status code. 249 * @param p GuestRcWhere to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned.250 */ 251 int GuestDirectory::i_closeInternal(int *p GuestRc)252 { 253 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);254 255 int rc = mData.mProcessTool.terminate(30 * 1000 /* 30s timeout */, p GuestRc);249 * @param prcGuest Where to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned. 250 */ 251 int GuestDirectory::i_closeInternal(int *prcGuest) 252 { 253 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 254 255 int rc = mData.mProcessTool.terminate(30 * 1000 /* 30s timeout */, prcGuest); 256 256 if (RT_FAILURE(rc)) 257 257 return rc; … … 271 271 * @return VBox status code. Will return VERR_NO_MORE_FILES if no more entries are available. 272 272 * @param fsObjInfo Where to store the read directory entry. 273 * @param p GuestRcWhere to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned.274 */ 275 int GuestDirectory::i_readInternal(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *p GuestRc)276 { 277 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);273 * @param prcGuest Where to store the guest result code in case VERR_GSTCTL_GUEST_ERROR is returned. 274 */ 275 int GuestDirectory::i_readInternal(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *prcGuest) 276 { 277 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 278 278 279 279 /* Create the FS info object. */ … … 284 284 GuestProcessStreamBlock curBlock; 285 285 int rc = mData.mProcessTool.waitEx(GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK, 286 &curBlock, p GuestRc);286 &curBlock, prcGuest); 287 287 if (RT_SUCCESS(rc)) 288 288 { … … 320 320 321 321 /* static */ 322 HRESULT GuestDirectory::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)322 HRESULT GuestDirectory::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest) 323 323 { 324 324 AssertPtr(pInterface); 325 AssertMsg(RT_FAILURE( guestRc), ("Guest rc does not indicate a failure when setting error\n"));326 327 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestDirectory::i_guestErrorToString( guestRc).c_str());325 AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n")); 326 327 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestDirectory::i_guestErrorToString(rcGuest).c_str()); 328 328 } 329 329 -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r71173 r71299 355 355 } 356 356 357 int GuestFile::i_closeFile(int *p GuestRc)357 int GuestFile::i_closeFile(int *prcGuest) 358 358 { 359 359 LogFlowThisFunc(("strFile=%s\n", mData.mOpenInfo.mFileName.c_str())); … … 386 386 if (RT_SUCCESS(vrc)) 387 387 vrc = i_waitForStatusChange(pEvent, 30 * 1000 /* Timeout in ms */, 388 NULL /* FileStatus */, p GuestRc);388 NULL /* FileStatus */, prcGuest); 389 389 unregisterWaitEvent(pEvent); 390 390 … … 394 394 395 395 /* static */ 396 Utf8Str GuestFile::i_guestErrorToString(int guestRc)396 Utf8Str GuestFile::i_guestErrorToString(int rcGuest) 397 397 { 398 398 Utf8Str strError; 399 399 400 400 /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ 401 switch ( guestRc)401 switch (rcGuest) 402 402 { 403 403 case VERR_ALREADY_EXISTS: … … 418 418 419 419 default: 420 strError += Utf8StrFmt("%Rrc", guestRc);420 strError += Utf8StrFmt("%Rrc", rcGuest); 421 421 break; 422 422 } … … 443 443 pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.rc); 444 444 445 int guestRc= (int)dataCb.rc; /* uint32_t vs. int. */446 447 LogFlowFunc(("uType=%RU32, guestRc=%Rrc\n",448 dataCb.uType, guestRc));449 450 if (RT_FAILURE( guestRc))451 { 452 int rc2 = i_setFileStatus(FileStatus_Error, guestRc);445 int rcGuest = (int)dataCb.rc; /* uint32_t vs. int. */ 446 447 LogFlowFunc(("uType=%RU32, rcGuest=%Rrc\n", 448 dataCb.uType, rcGuest)); 449 450 if (RT_FAILURE(rcGuest)) 451 { 452 int rc2 = i_setFileStatus(FileStatus_Error, rcGuest); 453 453 AssertRC(rc2); 454 454 455 455 rc2 = signalWaitEventInternal(pCbCtx, 456 guestRc, NULL /* pPayload */);456 rcGuest, NULL /* pPayload */); 457 457 AssertRC(rc2); 458 458 … … 464 464 case GUEST_FILE_NOTIFYTYPE_ERROR: 465 465 { 466 int rc2 = i_setFileStatus(FileStatus_Error, guestRc);466 int rc2 = i_setFileStatus(FileStatus_Error, rcGuest); 467 467 AssertRC(rc2); 468 468 … … 481 481 482 482 /* Set the process status. */ 483 int rc2 = i_setFileStatus(FileStatus_Open, guestRc);483 int rc2 = i_setFileStatus(FileStatus_Open, rcGuest); 484 484 AssertRC(rc2); 485 485 } … … 492 492 case GUEST_FILE_NOTIFYTYPE_CLOSE: 493 493 { 494 int rc2 = i_setFileStatus(FileStatus_Closed, guestRc);494 int rc2 = i_setFileStatus(FileStatus_Closed, rcGuest); 495 495 AssertRC(rc2); 496 496 … … 592 592 { 593 593 GuestWaitEventPayload payload(dataCb.uType, &dataCb, sizeof(dataCb)); 594 int rc2 = signalWaitEventInternal(pCbCtx, guestRc, &payload);594 int rc2 = signalWaitEventInternal(pCbCtx, rcGuest, &payload); 595 595 AssertRC(rc2); 596 596 } 597 597 598 LogFlowThisFunc(("uType=%RU32, guestRc=%Rrc\n",598 LogFlowThisFunc(("uType=%RU32, rcGuest=%Rrc\n", 599 599 dataCb.uType, dataCb.rc)); 600 600 … … 642 642 } 643 643 644 int GuestFile::i_openFile(uint32_t uTimeoutMS, int *p GuestRc)644 int GuestFile::i_openFile(uint32_t uTimeoutMS, int *prcGuest) 645 645 { 646 646 LogFlowThisFuncEnter(); … … 688 688 if (RT_SUCCESS(vrc)) 689 689 vrc = i_waitForStatusChange(pEvent, uTimeoutMS, 690 NULL /* FileStatus */, p GuestRc);690 NULL /* FileStatus */, prcGuest); 691 691 692 692 unregisterWaitEvent(pEvent); … … 860 860 861 861 /* static */ 862 HRESULT GuestFile::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)862 HRESULT GuestFile::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest) 863 863 { 864 864 AssertPtr(pInterface); 865 AssertMsg(RT_FAILURE( guestRc), ("Guest rc does not indicate a failure when setting error\n"));866 867 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestFile::i_guestErrorToString( guestRc).c_str());865 AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n")); 866 867 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestFile::i_guestErrorToString(rcGuest).c_str()); 868 868 } 869 869 … … 985 985 986 986 int GuestFile::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, 987 FileStatus_T *pFileStatus, int *p GuestRc)987 FileStatus_T *pFileStatus, int *prcGuest) 988 988 { 989 989 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); … … 1021 1021 vrc = VERR_GSTCTL_GUEST_ERROR; 1022 1022 1023 if (p GuestRc)1024 *p GuestRc= (int)lGuestRc;1023 if (prcGuest) 1024 *prcGuest = (int)lGuestRc; 1025 1025 } 1026 1026 … … 1183 1183 1184 1184 /* Close file on guest. */ 1185 int guestRc;1186 int rc = i_closeFile(& guestRc);1185 int rcGuest; 1186 int rc = i_closeFile(&rcGuest); 1187 1187 /* On failure don't return here, instead do all the cleanup 1188 1188 * work first and then return an error. */ … … 1196 1196 { 1197 1197 if (rc == VERR_GSTCTL_GUEST_ERROR) 1198 return GuestFile::i_setErrorExternal(this, guestRc);1198 return GuestFile::i_setErrorExternal(this, rcGuest); 1199 1199 1200 1200 return setError(VBOX_E_IPRT_ERROR, -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r71272 r71299 282 282 283 283 /* Terminate process if not already done yet. */ 284 int guestRc= VINF_SUCCESS;285 int vrc = i_terminateProcess(30 * 1000, & guestRc); /** @todo Make timeouts configurable. */284 int rcGuest = VINF_SUCCESS; 285 int vrc = i_terminateProcess(30 * 1000, &rcGuest); /** @todo Make timeouts configurable. */ 286 286 /* Note: Don't return here yet; first uninit all other stuff in 287 287 * case of failure. */ … … 295 295 baseUninit(); 296 296 297 LogFlowThisFunc(("Returning rc=%Rrc, guestRc=%Rrc\n",298 vrc, guestRc));297 LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", 298 vrc, rcGuest)); 299 299 RT_NOREF_PV(vrc); 300 300 } … … 495 495 496 496 /* static */ 497 Utf8Str GuestProcess::i_guestErrorToString(int guestRc)497 Utf8Str GuestProcess::i_guestErrorToString(int rcGuest) 498 498 { 499 499 Utf8Str strError; 500 500 501 501 /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ 502 switch ( guestRc)502 switch (rcGuest) 503 503 { 504 504 case VERR_FILE_NOT_FOUND: /* This is the most likely error. */ … … 549 549 550 550 default: 551 strError += Utf8StrFmt("%Rrc", guestRc);551 strError += Utf8StrFmt("%Rrc", rcGuest); 552 552 break; 553 553 } … … 851 851 852 852 int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, 853 void *pvData, size_t cbData, uint32_t *pcbRead, int *p GuestRc)854 { 855 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, p GuestRc=%p\n",856 mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, p GuestRc));853 void *pvData, size_t cbData, uint32_t *pcbRead, int *prcGuest) 854 { 855 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, prcGuest=%p\n", 856 mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, prcGuest)); 857 857 AssertReturn(uSize, VERR_INVALID_PARAMETER); 858 858 AssertPtrReturn(pvData, VERR_INVALID_POINTER); … … 874 874 if (pcbRead) 875 875 *pcbRead = 0; 876 if (p GuestRc)877 *p GuestRc= VINF_SUCCESS;876 if (prcGuest) 877 *prcGuest = VINF_SUCCESS; 878 878 return VINF_SUCCESS; /* Nothing to read anymore. */ 879 879 } … … 996 996 997 997 /* static */ 998 HRESULT GuestProcess::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)998 HRESULT GuestProcess::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest) 999 999 { 1000 1000 AssertPtr(pInterface); 1001 AssertMsg(RT_FAILURE( guestRc), ("Guest rc does not indicate a failure when setting error\n"));1002 1003 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString( guestRc).c_str());1004 } 1005 1006 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *p GuestRc)1001 AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n")); 1002 1003 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest).c_str()); 1004 } 1005 1006 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *prcGuest) 1007 1007 { 1008 1008 LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n", … … 1032 1032 return vrc; 1033 1033 1034 vrc = i_startProcessInner(cMsTimeout, alock, pEvent, p GuestRc);1034 vrc = i_startProcessInner(cMsTimeout, alock, pEvent, prcGuest); 1035 1035 1036 1036 unregisterWaitEvent(pEvent); … … 1040 1040 } 1041 1041 1042 int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *p GuestRc)1042 int GuestProcess::i_startProcessInner(uint32_t cMsTimeout, AutoWriteLock &rLock, GuestWaitEvent *pEvent, int *prcGuest) 1043 1043 { 1044 1044 GuestSession *pSession = mSession; … … 1147 1147 if (RT_SUCCESS(vrc)) 1148 1148 vrc = i_waitForStatusChange(pEvent, cMsTimeout, 1149 NULL /* Process status */, p GuestRc);1149 NULL /* Process status */, prcGuest); 1150 1150 return vrc; 1151 1151 } … … 1205 1205 } 1206 1206 1207 int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *p GuestRc)1208 { 1209 /* p GuestRcis optional. */1207 int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *prcGuest) 1208 { 1209 /* prcGuest is optional. */ 1210 1210 LogFlowThisFunc(("uTimeoutMS=%RU32\n", uTimeoutMS)); 1211 1211 … … 1255 1255 if (RT_SUCCESS(vrc)) 1256 1256 vrc = i_waitForStatusChange(pEvent, uTimeoutMS, 1257 NULL /* ProcessStatus */, p GuestRc);1257 NULL /* ProcessStatus */, prcGuest); 1258 1258 unregisterWaitEvent(pEvent); 1259 1259 } … … 1376 1376 1377 1377 int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, 1378 ProcessWaitResult_T &waitResult, int *p GuestRc)1378 ProcessWaitResult_T &waitResult, int *prcGuest) 1379 1379 { 1380 1380 AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER); … … 1382 1382 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1383 1383 1384 LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, p GuestRc=%p\n",1385 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, p GuestRc));1384 LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, prcGuest=%p\n", 1385 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, prcGuest)); 1386 1386 1387 1387 /* Did some error occur before? Then skip waiting and return. */ … … 1392 1392 AssertMsg(RT_FAILURE(mData.mLastError), 1393 1393 ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError)); 1394 if (p GuestRc)1395 *p GuestRc= mData.mLastError; /* Return last set error. */1396 LogFlowThisFunc(("Process is in error state ( guestRc=%Rrc)\n", mData.mLastError));1394 if (prcGuest) 1395 *prcGuest = mData.mLastError; /* Return last set error. */ 1396 LogFlowThisFunc(("Process is in error state (rcGuest=%Rrc)\n", mData.mLastError)); 1397 1397 return VERR_GSTCTL_GUEST_ERROR; 1398 1398 } … … 1403 1403 if (waitResult != ProcessWaitResult_None) 1404 1404 { 1405 if (p GuestRc)1406 *p GuestRc= mData.mLastError; /* Return last set error (if any). */1407 LogFlowThisFunc(("Nothing to wait for ( guestRc=%Rrc)\n", mData.mLastError));1405 if (prcGuest) 1406 *prcGuest = mData.mLastError; /* Return last set error (if any). */ 1407 LogFlowThisFunc(("Nothing to wait for (rcGuest=%Rrc)\n", mData.mLastError)); 1408 1408 return RT_SUCCESS(mData.mLastError) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; 1409 1409 } … … 1451 1451 uTimeoutMS == RT_INDEFINITE_WAIT 1452 1452 ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS, 1453 &newStatus, p GuestRc);1453 &newStatus, prcGuest); 1454 1454 if (RT_SUCCESS(vrc)) 1455 1455 { … … 1598 1598 1599 1599 int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, 1600 ProcessStatus_T *pProcessStatus, int *p GuestRc)1600 ProcessStatus_T *pProcessStatus, int *prcGuest) 1601 1601 { 1602 1602 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 1603 1603 /* pProcessStatus is optional. */ 1604 /* p GuestRcis optional. */1604 /* prcGuest is optional. */ 1605 1605 1606 1606 VBoxEventType_T evtType; … … 1628 1628 ComAssertComRC(hr); 1629 1629 1630 LogFlowThisFunc(("Got procStatus=%RU32, guestRc=%RI32 (%Rrc)\n",1630 LogFlowThisFunc(("Got procStatus=%RU32, rcGuest=%RI32 (%Rrc)\n", 1631 1631 procStatus, lGuestRc, lGuestRc)); 1632 1632 … … 1634 1634 vrc = VERR_GSTCTL_GUEST_ERROR; 1635 1635 1636 if (p GuestRc)1637 *p GuestRc= (int)lGuestRc;1636 if (prcGuest) 1637 *prcGuest = (int)lGuestRc; 1638 1638 } 1639 1639 … … 1677 1677 1678 1678 int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags, 1679 void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *p GuestRc)1680 { 1681 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, p GuestRc=%p\n",1682 mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, p GuestRc));1679 void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *prcGuest) 1680 { 1681 LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, prcGuest=%p\n", 1682 mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, prcGuest)); 1683 1683 /* All is optional. There can be 0 byte writes. */ 1684 1684 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1688 1688 if (puWritten) 1689 1689 *puWritten = 0; 1690 if (p GuestRc)1691 *p GuestRc= VINF_SUCCESS;1690 if (prcGuest) 1691 *prcGuest = VINF_SUCCESS; 1692 1692 return VINF_SUCCESS; /* Not available for writing (anymore). */ 1693 1693 } … … 1739 1739 if (RT_SUCCESS(vrc)) 1740 1740 { 1741 /** @todo Set guestRc. */1741 /** @todo Set rcGuest. */ 1742 1742 1743 1743 if (puWritten) … … 1768 1768 HRESULT hr = S_OK; 1769 1769 1770 uint32_t cbRead; int guestRc;1771 int vrc = i_readData(aHandle, aToRead, aTimeoutMS, &aData.front(), aToRead, &cbRead, & guestRc);1770 uint32_t cbRead; int rcGuest; 1771 int vrc = i_readData(aHandle, aToRead, aTimeoutMS, &aData.front(), aToRead, &cbRead, &rcGuest); 1772 1772 if (RT_SUCCESS(vrc)) 1773 1773 { … … 1782 1782 { 1783 1783 case VERR_GSTCTL_GUEST_ERROR: 1784 hr = GuestProcess::i_setErrorExternal(this, guestRc);1784 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 1785 1785 break; 1786 1786 … … 1803 1803 HRESULT hr = S_OK; 1804 1804 1805 int guestRc;1805 int rcGuest; 1806 1806 int vrc = i_terminateProcess(30 * 1000 /* Timeout in ms */, 1807 & guestRc);1807 &rcGuest); 1808 1808 if (RT_FAILURE(vrc)) 1809 1809 { … … 1811 1811 { 1812 1812 case VERR_GSTCTL_GUEST_ERROR: 1813 hr = GuestProcess::i_setErrorExternal(this, guestRc);1813 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 1814 1814 break; 1815 1815 … … 1848 1848 HRESULT hr = S_OK; 1849 1849 1850 int guestRc;1850 int rcGuest; 1851 1851 ProcessWaitResult_T waitResult; 1852 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, & guestRc);1852 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest); 1853 1853 if (RT_SUCCESS(vrc)) 1854 1854 { … … 1860 1860 { 1861 1861 case VERR_GSTCTL_GUEST_ERROR: 1862 hr = GuestProcess::i_setErrorExternal(this, guestRc);1862 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 1863 1863 break; 1864 1864 … … 1899 1899 HRESULT hr = S_OK; 1900 1900 1901 uint32_t cbWritten; int guestRc;1901 uint32_t cbWritten; int rcGuest; 1902 1902 uint32_t cbData = (uint32_t)aData.size(); 1903 1903 void *pvData = cbData > 0? (void *)&aData.front(): NULL; 1904 int vrc = i_writeData(aHandle, aFlags, pvData, cbData, aTimeoutMS, &cbWritten, & guestRc);1904 int vrc = i_writeData(aHandle, aFlags, pvData, cbData, aTimeoutMS, &cbWritten, &rcGuest); 1905 1905 if (RT_FAILURE(vrc)) 1906 1906 { … … 1908 1908 { 1909 1909 case VERR_GSTCTL_GUEST_ERROR: 1910 hr = GuestProcess::i_setErrorExternal(this, guestRc);1910 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 1911 1911 break; 1912 1912 … … 1952 1952 GuestProcessTool::~GuestProcessTool(void) 1953 1953 { 1954 terminate(30 * 1000, NULL /* p GuestRc*/);1954 terminate(30 * 1000, NULL /* prcGuest */); 1955 1955 } 1956 1956 1957 1957 int GuestProcessTool::init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, 1958 bool fAsync, int *p GuestRc)1958 bool fAsync, int *prcGuest) 1959 1959 { 1960 1960 LogFlowThisFunc(("pGuestSession=%p, exe=%s, fAsync=%RTbool\n", … … 1983 1983 ) 1984 1984 { 1985 if (p GuestRc)1986 *p GuestRc= vrcGuest;1985 if (prcGuest) 1986 *prcGuest = vrcGuest; 1987 1987 vrc = VERR_GSTCTL_GUEST_ERROR; 1988 1988 } … … 2047 2047 /* static */ 2048 2048 int GuestProcessTool::run( GuestSession *pGuestSession, 2049 2050 int *pGuestRc/* = NULL */)2051 { 2052 int guestRc;2049 const GuestProcessStartupInfo &startupInfo, 2050 int *prcGuest /* = NULL */) 2051 { 2052 int rcGuest; 2053 2053 2054 2054 GuestProcessToolErrorInfo errorInfo; … … 2056 2056 if (RT_SUCCESS(vrc)) 2057 2057 { 2058 if (errorInfo. guestRc== VWRN_GSTCTL_PROCESS_EXIT_CODE)2059 guestRc= GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);2058 if (errorInfo.rcGuest == VWRN_GSTCTL_PROCESS_EXIT_CODE) 2059 rcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode); 2060 2060 else 2061 guestRc = errorInfo.guestRc;2062 2063 if (p GuestRc)2064 *p GuestRc = guestRc;2061 rcGuest = errorInfo.rcGuest; 2062 2063 if (prcGuest) 2064 *prcGuest = rcGuest; 2065 2065 } 2066 2066 … … 2078 2078 /* static */ 2079 2079 int GuestProcessTool::runErrorInfo( GuestSession *pGuestSession, 2080 2081 2080 const GuestProcessStartupInfo &startupInfo, 2081 GuestProcessToolErrorInfo &errorInfo) 2082 2082 { 2083 2083 return runExErrorInfo(pGuestSession, startupInfo, … … 2095 2095 * Optional. 2096 2096 * @param cStrmOutObjects Number of stream objects passed in. Optional. 2097 * @param p GuestRcError code returned from the guest side if VERR_GSTCTL_GUEST_ERROR is returned. Optional.2097 * @param prcGuest Error code returned from the guest side if VERR_GSTCTL_GUEST_ERROR is returned. Optional. 2098 2098 */ 2099 2099 /* static */ 2100 2100 int GuestProcessTool::runEx( GuestSession *pGuestSession, 2101 2102 2103 2104 int *pGuestRc/* = NULL */)2105 { 2106 int guestRc;2101 const GuestProcessStartupInfo &startupInfo, 2102 GuestCtrlStreamObjects *paStrmOutObjects, 2103 uint32_t cStrmOutObjects, 2104 int *prcGuest /* = NULL */) 2105 { 2106 int rcGuest; 2107 2107 2108 2108 GuestProcessToolErrorInfo errorInfo; … … 2110 2110 if (RT_SUCCESS(vrc)) 2111 2111 { 2112 if (errorInfo. guestRc== VWRN_GSTCTL_PROCESS_EXIT_CODE)2113 guestRc= GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode);2112 if (errorInfo.rcGuest == VWRN_GSTCTL_PROCESS_EXIT_CODE) 2113 rcGuest = GuestProcessTool::exitCodeToRc(startupInfo, errorInfo.iExitCode); 2114 2114 else 2115 guestRc = errorInfo.guestRc;2115 rcGuest = errorInfo.rcGuest; 2116 2116 2117 2117 /* Return VERR_GSTCTL_GUEST_ERROR if we retrieved a guest return code. */ 2118 if (RT_FAILURE( guestRc))2118 if (RT_FAILURE(rcGuest)) 2119 2119 vrc = VERR_GSTCTL_GUEST_ERROR; 2120 2120 2121 if (p GuestRc)2122 *p GuestRc = guestRc;2121 if (prcGuest) 2122 *prcGuest = rcGuest; 2123 2123 } 2124 2124 … … 2154 2154 2155 2155 GuestProcessTool procTool; 2156 int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo. guestRc);2156 int vrc = procTool.init(pGuestSession, startupInfo, false /* Async */, &errorInfo.rcGuest); 2157 2157 if (RT_SUCCESS(vrc)) 2158 2158 { … … 2164 2164 vrc = procTool.waitEx( paStrmOutObjects 2165 2165 ? GUESTPROCESSTOOL_WAIT_FLAG_STDOUT_BLOCK 2166 : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo. guestRc);2166 : GUESTPROCESSTOOL_WAIT_FLAG_NONE, &strmBlk, &errorInfo.rcGuest); 2167 2167 if (paStrmOutObjects) 2168 2168 paStrmOutObjects->push_back(strmBlk); … … 2178 2178 { 2179 2179 /* Make sure the process runs until completion. */ 2180 vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo. guestRc);2180 vrc = procTool.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE, &errorInfo.rcGuest); 2181 2181 if (RT_SUCCESS(vrc)) 2182 errorInfo. guestRc= procTool.terminatedOk(&errorInfo.iExitCode);2183 } 2184 2185 LogFlowFunc(("Returned rc=%Rrc, guestRc=%Rrc, iExitCode=%d\n", vrc, errorInfo.guestRc, errorInfo.iExitCode));2182 errorInfo.rcGuest = procTool.terminatedOk(&errorInfo.iExitCode); 2183 } 2184 2185 LogFlowFunc(("Returned rc=%Rrc, rcGuest=%Rrc, iExitCode=%d\n", vrc, errorInfo.rcGuest, errorInfo.iExitCode)); 2186 2186 return vrc; 2187 2187 } … … 2220 2220 } 2221 2221 2222 int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *p GuestRc)2223 { 2224 return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, p GuestRc);2225 } 2226 2227 int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *p GuestRc)2228 { 2229 LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, p GuestRc=%p\n", fToolWaitFlags, pStrmBlkOut, pGuestRc));2222 int GuestProcessTool::wait(uint32_t fToolWaitFlags, int *prcGuest) 2223 { 2224 return waitEx(fToolWaitFlags, NULL /* pStrmBlkOut */, prcGuest); 2225 } 2226 2227 int GuestProcessTool::waitEx(uint32_t fToolWaitFlags, GuestProcessStreamBlock *pStrmBlkOut, int *prcGuest) 2228 { 2229 LogFlowThisFunc(("fToolWaitFlags=0x%x, pStreamBlock=%p, prcGuest=%p\n", fToolWaitFlags, pStrmBlkOut, prcGuest)); 2230 2230 2231 2231 /* Can we parse the next block without waiting? */ … … 2405 2405 LogFlowThisFunc(("Loop ended with rc=%Rrc, vrcGuest=%Rrc, waitRes=%RU32\n", 2406 2406 vrc, vrcGuest, waitRes)); 2407 if (p GuestRc)2408 *p GuestRc= vrcGuest;2407 if (prcGuest) 2408 *prcGuest = vrcGuest; 2409 2409 2410 2410 LogFlowFuncLeaveRC(vrc); … … 2412 2412 } 2413 2413 2414 int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *p GuestRc)2414 int GuestProcessTool::terminate(uint32_t uTimeoutMS, int *prcGuest) 2415 2415 { 2416 2416 LogFlowThisFuncEnter(); … … 2419 2419 if (!pProcess.isNull()) 2420 2420 { 2421 rc = pProcess->i_terminateProcess(uTimeoutMS, p GuestRc);2421 rc = pProcess->i_terminateProcess(uTimeoutMS, prcGuest); 2422 2422 pProcess.setNull(); 2423 2423 } -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r71272 r71299 242 242 hr = thisListener.createObject(); 243 243 if (SUCCEEDED(hr)) 244 hr = thisListener->init(pListener, this); 244 hr = thisListener->init(pListener, this); /* thisListener takes ownership of pListener. */ 245 245 if (SUCCEEDED(hr)) 246 246 { … … 340 340 ("mNumObjects=%RU32 when it should be 0\n", mData.mNumObjects)); 341 341 342 /* Unitialize our local listener. */ 343 mLocalListener.setNull(); 344 342 345 baseUninit(); 343 346 … … 590 593 /////////////////////////////////////////////////////////////////////////////// 591 594 592 int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *p GuestRc)593 { 594 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);595 int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *prcGuest) 596 { 597 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 595 598 596 599 LogFlowThisFunc(("uFlags=%x, uTimeoutMS=%RU32\n", uFlags, uTimeoutMS)); … … 647 650 if (RT_SUCCESS(vrc)) 648 651 vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS, 649 NULL /* Session status */, p GuestRc);652 NULL /* Session status */, prcGuest); 650 653 651 654 unregisterWaitEvent(pEvent); … … 656 659 657 660 int GuestSession::i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, 658 uint32_t uFlags, int *p GuestRc)659 { 660 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);661 uint32_t uFlags, int *prcGuest) 662 { 663 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 661 664 662 665 LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n", strPath.c_str(), uMode, uFlags)); … … 702 705 703 706 if (RT_SUCCESS(vrc)) 704 vrc = GuestProcessTool::run(this, procInfo, p GuestRc);707 vrc = GuestProcessTool::run(this, procInfo, prcGuest); 705 708 706 709 LogFlowFuncLeaveRC(vrc); … … 721 724 722 725 int GuestSession::i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, 723 GuestFsObjData &objData, int *p GuestRc)724 { 725 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);726 GuestFsObjData &objData, int *prcGuest) 727 { 728 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 726 729 727 730 LogFlowThisFunc(("strPath=%s, fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); 728 731 729 int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, p GuestRc);732 int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, prcGuest); 730 733 if (RT_SUCCESS(vrc)) 731 734 { … … 780 783 781 784 int GuestSession::i_directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, 782 int *p GuestRc)785 int *prcGuest) 783 786 { 784 787 AssertReturn(!(uFlags & ~DIRREMOVE_FLAG_VALID_MASK), VERR_INVALID_PARAMETER); 785 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);788 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 786 789 787 790 LogFlowThisFunc(("strPath=%s, uFlags=0x%x\n", strPath.c_str(), uFlags)); … … 810 813 vrc = pEvent->Wait(30 * 1000); 811 814 if ( vrc == VERR_GSTCTL_GUEST_ERROR 812 && p GuestRc)813 *p GuestRc= pEvent->GuestResult();815 && prcGuest) 816 *prcGuest = pEvent->GuestResult(); 814 817 } 815 818 … … 821 824 822 825 int GuestSession::i_objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, 823 bool fDirectory, Utf8Str &strName, int *p GuestRc)824 { 825 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);826 bool fDirectory, Utf8Str &strName, int *prcGuest) 827 { 828 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 826 829 827 830 LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool\n", … … 867 870 { 868 871 vrcGuest = vrc; 869 if (p GuestRc)870 *p GuestRc= vrc;872 if (prcGuest) 873 *prcGuest = vrc; 871 874 vrc = VERR_GSTCTL_GUEST_ERROR; 872 875 } … … 878 881 strName = objData.mName; 879 882 } 880 else if (p GuestRc)881 *p GuestRc= vrcGuest;883 else if (prcGuest) 884 *prcGuest = vrcGuest; 882 885 883 886 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); … … 886 889 887 890 int GuestSession::i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo, 888 ComObjPtr<GuestDirectory> &pDirectory, int *p GuestRc)889 { 890 AssertPtrReturn(p GuestRc, VERR_INVALID_POINTER);891 ComObjPtr<GuestDirectory> &pDirectory, int *prcGuest) 892 { 893 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 891 894 892 895 LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n", … … 967 970 { 968 971 /* Nothing further to do here yet. */ 969 if (p GuestRc)970 *p GuestRc= VINF_SUCCESS;972 if (prcGuest) 973 *prcGuest = VINF_SUCCESS; 971 974 } 972 975 … … 1225 1228 } 1226 1229 1227 int GuestSession::i_fileRemoveInternal(const Utf8Str &strPath, int *p GuestRc)1230 int GuestSession::i_fileRemoveInternal(const Utf8Str &strPath, int *prcGuest) 1228 1231 { 1229 1232 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); … … 1250 1253 1251 1254 if (RT_SUCCESS(vrc)) 1252 vrc = GuestProcessTool::run(this, procInfo, p GuestRc);1255 vrc = GuestProcessTool::run(this, procInfo, prcGuest); 1253 1256 1254 1257 LogFlowFuncLeaveRC(vrc); … … 1257 1260 1258 1261 int GuestSession::i_fileOpenInternal(const GuestFileOpenInfo &openInfo, 1259 ComObjPtr<GuestFile> &pFile, int *p GuestRc)1262 ComObjPtr<GuestFile> &pFile, int *prcGuest) 1260 1263 { 1261 1264 LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32 mfOpenEx=%RU32\n", … … 1345 1348 if (RT_SUCCESS(rc)) 1346 1349 { 1347 int guestRc;1348 rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, & guestRc);1350 int rcGuest; 1351 rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &rcGuest); 1349 1352 if ( rc == VERR_GSTCTL_GUEST_ERROR 1350 && p GuestRc)1351 { 1352 *p GuestRc = guestRc;1353 && prcGuest) 1354 { 1355 *prcGuest = rcGuest; 1353 1356 } 1354 1357 } … … 1358 1361 } 1359 1362 1360 int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *p GuestRc)1363 int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest) 1361 1364 { 1362 1365 LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); 1363 1366 1364 int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, p GuestRc);1367 int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, prcGuest); 1365 1368 if (RT_SUCCESS(vrc)) 1366 1369 { … … 1373 1376 } 1374 1377 1375 int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *p GuestRc)1378 int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *prcGuest) 1376 1379 { 1377 1380 AssertPtrReturn(pllSize, VERR_INVALID_POINTER); 1378 1381 1379 1382 GuestFsObjData objData; 1380 int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, p GuestRc);1383 int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, prcGuest); 1381 1384 if (RT_SUCCESS(vrc)) 1382 1385 *pllSize = objData.mObjectSize; … … 1392 1395 * @param fFollowSymlinks Whether to follow symbolic links or not. 1393 1396 * @param objData Where to return the file system object data, if found. 1394 * @param p GuestRcGuest rc, when returning VERR_GSTCTL_GUEST_ERROR.1397 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 1395 1398 * Any other return code indicates some host side error. 1396 1399 */ 1397 int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *p GuestRc)1400 int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *prcGuest) 1398 1401 { 1399 1402 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); … … 1431 1434 { 1432 1435 vrcGuest = vrc; 1433 if (p GuestRc)1434 *p GuestRc= vrc;1436 if (prcGuest) 1437 *prcGuest = vrc; 1435 1438 vrc = VERR_GSTCTL_GUEST_ERROR; 1436 1439 } … … 1439 1442 vrc = VERR_BROKEN_PIPE; 1440 1443 } 1441 else if (p GuestRc)1442 *p GuestRc= vrcGuest;1444 else if (prcGuest) 1445 *prcGuest = vrcGuest; 1443 1446 1444 1447 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest)); … … 1457 1460 1458 1461 /* static */ 1459 Utf8Str GuestSession::i_guestErrorToString(int guestRc)1462 Utf8Str GuestSession::i_guestErrorToString(int rcGuest) 1460 1463 { 1461 1464 Utf8Str strError; 1462 1465 1463 1466 /** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */ 1464 switch ( guestRc)1467 switch (rcGuest) 1465 1468 { 1466 1469 case VERR_INVALID_VM_HANDLE: … … 1501 1504 1502 1505 default: 1503 strError += Utf8StrFmt("%Rrc", guestRc);1506 strError += Utf8StrFmt("%Rrc", rcGuest); 1504 1507 break; 1505 1508 } … … 1570 1573 AssertRCReturn(vrc, vrc); 1571 1574 1572 LogFlowThisFunc(("ID=%RU32, uType=%RU32, guestRc=%Rrc\n",1575 LogFlowThisFunc(("ID=%RU32, uType=%RU32, rcGuest=%Rrc\n", 1573 1576 mData.mSession.mID, dataCb.uType, dataCb.uResult)); 1574 1577 1575 1578 GuestSessionStatus_T sessionStatus = GuestSessionStatus_Undefined; 1576 1579 1577 int guestRc= dataCb.uResult; /** @todo uint32_t vs. int. */1580 int rcGuest = dataCb.uResult; /** @todo uint32_t vs. int. */ 1578 1581 switch (dataCb.uType) 1579 1582 { … … 1631 1634 if (RT_SUCCESS(vrc)) 1632 1635 { 1633 if (RT_FAILURE( guestRc))1636 if (RT_FAILURE(rcGuest)) 1634 1637 sessionStatus = GuestSessionStatus_Error; 1635 1638 } … … 1637 1640 /* Set the session status. */ 1638 1641 if (RT_SUCCESS(vrc)) 1639 vrc = i_setSessionStatus(sessionStatus, guestRc);1640 1641 LogFlowThisFunc(("ID=%RU32, guestRc=%Rrc\n", mData.mSession.mID, guestRc));1642 vrc = i_setSessionStatus(sessionStatus, rcGuest); 1643 1644 LogFlowThisFunc(("ID=%RU32, rcGuest=%Rrc\n", mData.mSession.mID, rcGuest)); 1642 1645 1643 1646 LogFlowFuncLeaveRC(vrc); … … 1645 1648 } 1646 1649 1647 int GuestSession::i_startSessionInternal(int *p GuestRc)1650 int GuestSession::i_startSessionInternal(int *prcGuest) 1648 1651 { 1649 1652 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1711 1714 vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start, 1712 1715 30 * 1000 /* 30s timeout */, 1713 NULL /* Session status */, p GuestRc);1716 NULL /* Session status */, prcGuest); 1714 1717 } 1715 1718 else … … 1794 1797 1795 1798 int GuestSession::i_pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest, 1796 uint32_t uFlags, int *p GuestRc)1799 uint32_t uFlags, int *prcGuest) 1797 1800 { 1798 1801 AssertReturn(!(uFlags & ~PATHRENAME_FLAG_VALID_MASK), VERR_INVALID_PARAMETER); … … 1826 1829 vrc = pEvent->Wait(30 * 1000); 1827 1830 if ( vrc == VERR_GSTCTL_GUEST_ERROR 1828 && p GuestRc)1829 *p GuestRc= pEvent->GuestResult();1831 && prcGuest) 1832 *prcGuest = pEvent->GuestResult(); 1830 1833 } 1831 1834 … … 2085 2088 2086 2089 /* static */ 2087 HRESULT GuestSession::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)2090 HRESULT GuestSession::i_setErrorExternal(VirtualBoxBase *pInterface, int rcGuest) 2088 2091 { 2089 2092 AssertPtr(pInterface); 2090 AssertMsg(RT_FAILURE( guestRc), ("Guest rc does not indicate a failure when setting error\n"));2091 2092 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestSession::i_guestErrorToString( guestRc).c_str());2093 AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n")); 2094 2095 return pInterface->setError(VBOX_E_IPRT_ERROR, GuestSession::i_guestErrorToString(rcGuest).c_str()); 2093 2096 } 2094 2097 … … 2186 2189 } 2187 2190 2188 int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *p GuestRc)2191 int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *prcGuest) 2189 2192 { 2190 2193 LogFlowThisFuncEnter(); … … 2192 2195 AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER); 2193 2196 2194 /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, p GuestRc=%p\n",2195 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, p GuestRc));*/2197 /*LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, prcGuest=%p\n", 2198 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mWaitCount, mData.mWaitEvent, prcGuest));*/ 2196 2199 2197 2200 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2202 2205 waitResult = GuestSessionWaitResult_Error; 2203 2206 AssertMsg(RT_FAILURE(mData.mRC), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mRC)); 2204 if (p GuestRc)2205 *p GuestRc= mData.mRC; /* Return last set error. */2207 if (prcGuest) 2208 *prcGuest = mData.mRC; /* Return last set error. */ 2206 2209 return VERR_GSTCTL_GUEST_ERROR; 2207 2210 } … … 2286 2289 if (waitResult != GuestSessionWaitResult_None) 2287 2290 { 2288 if (p GuestRc)2289 *p GuestRc= mData.mRC; /* Return last set error (if any). */2291 if (prcGuest) 2292 *prcGuest = mData.mRC; /* Return last set error (if any). */ 2290 2293 return RT_SUCCESS(mData.mRC) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; 2291 2294 } … … 2314 2317 GuestSessionStatus_T sessionStatus; 2315 2318 vrc = i_waitForStatusChange(pEvent, fWaitFlags, 2316 uTimeoutMS, &sessionStatus, p GuestRc);2319 uTimeoutMS, &sessionStatus, prcGuest); 2317 2320 if (RT_SUCCESS(vrc)) 2318 2321 { … … 2353 2356 2354 2357 int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, 2355 GuestSessionStatus_T *pSessionStatus, int *p GuestRc)2358 GuestSessionStatus_T *pSessionStatus, int *prcGuest) 2356 2359 { 2357 2360 RT_NOREF(fWaitFlags); … … 2383 2386 if (RT_FAILURE((int)lGuestRc)) 2384 2387 vrc = VERR_GSTCTL_GUEST_ERROR; 2385 if (p GuestRc)2386 *p GuestRc= (int)lGuestRc;2388 if (prcGuest) 2389 *prcGuest = (int)lGuestRc; 2387 2390 2388 2391 LogFlowThisFunc(("Status changed event for session ID=%RU32, new status is: %RU32 (%Rrc)\n", … … 2406 2409 2407 2410 /* Close session on guest. */ 2408 int guestRc= VINF_SUCCESS;2411 int rcGuest = VINF_SUCCESS; 2409 2412 int rc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */, 2410 & guestRc);2413 &rcGuest); 2411 2414 /* On failure don't return here, instead do all the cleanup 2412 2415 * work first and then return an error. */ … … 2420 2423 rc = rc2; 2421 2424 2422 LogFlowThisFunc(("Returning rc=%Rrc, guestRc=%Rrc\n",2423 rc, guestRc));2425 LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", 2426 rc, rcGuest)); 2424 2427 if (RT_FAILURE(rc)) 2425 2428 { 2426 2429 if (rc == VERR_GSTCTL_GUEST_ERROR) 2427 return GuestSession::i_setErrorExternal(this, guestRc);2430 return GuestSession::i_setErrorExternal(this, rcGuest); 2428 2431 2429 2432 return setError(VBOX_E_IPRT_ERROR, … … 2769 2772 HRESULT hr = S_OK; 2770 2773 2771 ComObjPtr <GuestDirectory> pDirectory; int guestRc;2772 int rc = i_directoryCreateInternal(aPath, (uint32_t)aMode, fFlags, & guestRc);2774 ComObjPtr <GuestDirectory> pDirectory; int rcGuest; 2775 int rc = i_directoryCreateInternal(aPath, (uint32_t)aMode, fFlags, &rcGuest); 2773 2776 if (RT_FAILURE(rc)) 2774 2777 { … … 2777 2780 case VERR_GSTCTL_GUEST_ERROR: 2778 2781 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %s", 2779 GuestDirectory::i_guestErrorToString( guestRc).c_str()));2782 GuestDirectory::i_guestErrorToString(rcGuest).c_str())); 2780 2783 break; 2781 2784 … … 2810 2813 HRESULT hr = S_OK; 2811 2814 2812 int guestRc;2815 int rcGuest; 2813 2816 int rc = i_objectCreateTempInternal(aTemplateName, 2814 2817 aPath, 2815 true /* Directory */, aDirectory, & guestRc);2818 true /* Directory */, aDirectory, &rcGuest); 2816 2819 if (!RT_SUCCESS(rc)) 2817 2820 { … … 2819 2822 { 2820 2823 case VERR_GSTCTL_GUEST_ERROR: 2821 hr = GuestProcess::i_setErrorExternal(this, guestRc);2824 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 2822 2825 break; 2823 2826 … … 2841 2844 HRESULT hr = S_OK; 2842 2845 2843 GuestFsObjData objData; int guestRc;2844 int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, & guestRc);2846 GuestFsObjData objData; int rcGuest; 2847 int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); 2845 2848 if (RT_SUCCESS(rc)) 2846 2849 *aExists = objData.mType == FsObjType_Directory; … … 2851 2854 case VERR_GSTCTL_GUEST_ERROR: 2852 2855 { 2853 switch ( guestRc)2856 switch (rcGuest) 2854 2857 { 2855 2858 case VERR_PATH_NOT_FOUND: … … 2858 2861 default: 2859 2862 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %s"), 2860 aPath.c_str(), GuestProcess::i_guestErrorToString( guestRc).c_str());2863 aPath.c_str(), GuestProcess::i_guestErrorToString(rcGuest).c_str()); 2861 2864 break; 2862 2865 } … … 2901 2904 openInfo.mFlags = fFlags; 2902 2905 2903 ComObjPtr <GuestDirectory> pDirectory; int guestRc;2904 int rc = i_directoryOpenInternal(openInfo, pDirectory, & guestRc);2906 ComObjPtr <GuestDirectory> pDirectory; int rcGuest; 2907 int rc = i_directoryOpenInternal(openInfo, pDirectory, &rcGuest); 2905 2908 if (RT_SUCCESS(rc)) 2906 2909 { … … 2918 2921 2919 2922 case VERR_GSTCTL_GUEST_ERROR: 2920 hr = GuestDirectory::i_setErrorExternal(this, guestRc);2923 hr = GuestDirectory::i_setErrorExternal(this, rcGuest); 2921 2924 break; 2922 2925 … … 2945 2948 uint32_t uFlags = 0; 2946 2949 2947 int guestRc;2948 int vrc = i_directoryRemoveInternal(aPath, uFlags, & guestRc);2950 int rcGuest; 2951 int vrc = i_directoryRemoveInternal(aPath, uFlags, &rcGuest); 2949 2952 if (RT_FAILURE(vrc)) 2950 2953 { … … 2957 2960 2958 2961 case VERR_GSTCTL_GUEST_ERROR: 2959 hr = GuestDirectory::i_setErrorExternal(this, guestRc);2962 hr = GuestDirectory::i_setErrorExternal(this, rcGuest); 2960 2963 break; 2961 2964 … … 3006 3009 uint32_t uFlags = DIRREMOVE_FLAG_RECURSIVE 3007 3010 | DIRREMOVE_FLAG_CONTENT_AND_DIR; 3008 int guestRc;3009 int vrc = i_directoryRemoveInternal(aPath, uFlags, & guestRc);3011 int rcGuest; 3012 int vrc = i_directoryRemoveInternal(aPath, uFlags, &rcGuest); 3010 3013 if (RT_FAILURE(vrc)) 3011 3014 { … … 3018 3021 3019 3022 case VERR_GSTCTL_GUEST_ERROR: 3020 hr = GuestFile::i_setErrorExternal(this, guestRc);3023 hr = GuestFile::i_setErrorExternal(this, rcGuest); 3021 3024 break; 3022 3025 … … 3163 3166 return setError(E_INVALIDARG, tr("No file to check existence for specified")); 3164 3167 3165 GuestFsObjData objData; int guestRc;3166 int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, & guestRc);3168 GuestFsObjData objData; int rcGuest; 3169 int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); 3167 3170 if (RT_SUCCESS(vrc)) 3168 3171 { … … 3176 3179 { 3177 3180 case VERR_GSTCTL_GUEST_ERROR: 3178 hr = GuestProcess::i_setErrorExternal(this, guestRc);3181 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 3179 3182 break; 3180 3183 … … 3276 3279 3277 3280 ComObjPtr <GuestFile> pFile; 3278 int guestRc;3279 int vrc = i_fileOpenInternal(openInfo, pFile, & guestRc);3281 int rcGuest; 3282 int vrc = i_fileOpenInternal(openInfo, pFile, &rcGuest); 3280 3283 if (RT_SUCCESS(vrc)) 3281 3284 /* Return directory object to the caller. */ … … 3291 3294 3292 3295 case VERR_GSTCTL_GUEST_ERROR: 3293 hr = GuestFile::i_setErrorExternal(this, guestRc);3296 hr = GuestFile::i_setErrorExternal(this, rcGuest); 3294 3297 break; 3295 3298 … … 3311 3314 HRESULT hr = S_OK; 3312 3315 3313 int64_t llSize; int guestRc;3314 int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE, &llSize, & guestRc);3316 int64_t llSize; int rcGuest; 3317 int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE, &llSize, &rcGuest); 3315 3318 if (RT_SUCCESS(vrc)) 3316 3319 { … … 3321 3324 if (GuestProcess::i_isGuestError(vrc)) 3322 3325 { 3323 hr = GuestProcess::i_setErrorExternal(this, guestRc);3326 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 3324 3327 } 3325 3328 else … … 3378 3381 HRESULT hrc = S_OK; 3379 3382 3380 GuestFsObjData Info; int guestRc;3381 int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, Info, & guestRc);3383 GuestFsObjData Info; int rcGuest; 3384 int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, Info, &rcGuest); 3382 3385 if (RT_SUCCESS(vrc)) 3383 3386 { … … 3397 3400 if (GuestProcess::i_isGuestError(vrc)) 3398 3401 { 3399 hrc = GuestProcess::i_setErrorExternal(this, guestRc);3402 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3400 3403 } 3401 3404 else … … 3415 3418 HRESULT hrc = S_OK; 3416 3419 3417 int guestRc;3418 int vrc = i_fileRemoveInternal(aPath, & guestRc);3420 int rcGuest; 3421 int vrc = i_fileRemoveInternal(aPath, &rcGuest); 3419 3422 if (RT_FAILURE(vrc)) 3420 3423 { 3421 3424 if (GuestProcess::i_isGuestError(vrc)) 3422 3425 { 3423 hrc = GuestProcess::i_setErrorExternal(this, guestRc);3426 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3424 3427 } 3425 3428 else … … 3462 3465 3463 3466 /* Call worker to do the job. */ 3464 int guestRc;3465 int vrc = i_pathRenameInternal(aSource, aDestination, fBackend, & guestRc);3467 int rcGuest; 3468 int vrc = i_pathRenameInternal(aSource, aDestination, fBackend, &rcGuest); 3466 3469 if (RT_FAILURE(vrc)) 3467 3470 { … … 3475 3478 case VERR_GSTCTL_GUEST_ERROR: 3476 3479 hr = setError(VBOX_E_IPRT_ERROR, 3477 tr("Renaming guest directory failed: %Rrc"), guestRc);3480 tr("Renaming guest directory failed: %Rrc"), rcGuest); 3478 3481 break; 3479 3482 … … 3676 3679 HRESULT hr = S_OK; 3677 3680 3678 int guestRc; GuestSessionWaitResult_T waitResult;3679 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, & guestRc);3681 int rcGuest; GuestSessionWaitResult_T waitResult; 3682 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest); 3680 3683 if (RT_SUCCESS(vrc)) 3681 3684 *aReason = waitResult; … … 3685 3688 { 3686 3689 case VERR_GSTCTL_GUEST_ERROR: 3687 hr = GuestSession::i_setErrorExternal(this, guestRc);3690 hr = GuestSession::i_setErrorExternal(this, rcGuest); 3688 3691 break; 3689 3692 -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r71273 r71299 215 215 strPath.c_str(), enmDirecotryCreateFlags, uMode, fFollowSymlinks)); 216 216 217 GuestFsObjData objData; int guestRc;218 219 int rc = mSession->i_directoryQueryInfoInternal(strPath, fFollowSymlinks, objData, & guestRc);217 GuestFsObjData objData; int rcGuest; 218 219 int rc = mSession->i_directoryQueryInfoInternal(strPath, fFollowSymlinks, objData, &rcGuest); 220 220 if (RT_SUCCESS(rc)) 221 221 { … … 228 228 case VERR_GSTCTL_GUEST_ERROR: 229 229 { 230 switch ( guestRc)230 switch (rcGuest) 231 231 { 232 232 case VERR_FILE_NOT_FOUND: 233 233 case VERR_PATH_NOT_FOUND: 234 rc = mSession->i_directoryCreateInternal(strPath.c_str(), uMode, enmDirecotryCreateFlags, & guestRc);234 rc = mSession->i_directoryCreateInternal(strPath.c_str(), uMode, enmDirecotryCreateFlags, &rcGuest); 235 235 break; 236 236 default: … … 249 249 if (rc == VERR_GSTCTL_GUEST_ERROR) 250 250 { 251 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString( guestRc));251 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 252 252 } 253 253 else … … 996 996 ComObjPtr <GuestDirectory> pDir; int rcGuest; 997 997 rc = mSession->i_directoryOpenInternal(dirOpenInfo, pDir, &rcGuest); 998 998 999 if (RT_FAILURE(rc)) 999 1000 {
Note:
See TracChangeset
for help on using the changeset viewer.