- Timestamp:
- Aug 9, 2012 3:49:46 PM (12 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestProcessImpl.h
r42673 r42716 76 76 inline int checkPID(uint32_t uPID); 77 77 void close(void); 78 Utf8Str errorMsg(void) { return mData.mErrorMsg; } 78 79 bool isReady(void); 79 80 ULONG getPID(void) { return mData.mPID; } 80 81 ULONG getProcessID(void) { return mData.mProcessID; } 82 int rc(void) { mData.mRC; } 81 83 int readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, size_t *pcbRead); 82 84 int startProcess(void); … … 102 104 int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms); 103 105 int setErrorInternal(int rc, const Utf8Str &strMessage); 104 intsetErrorExternal(void);106 HRESULT setErrorExternal(void); 105 107 int signalWaiters(ProcessWaitResult_T enmWaitResult); 106 108 static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser); 107 HRESULT waitResultToErrorEx(const GuestProcessWaitResult &waitResult, bool fLog);108 109 /** @} */ 109 110 -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r42702 r42716 2675 2675 } 2676 2676 2677 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);2678 2679 2677 HRESULT hr = S_OK; 2680 2678 #if 1 -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r42674 r42716 629 629 strmBlk.DumpToLog(); 630 630 #endif 631 /* Node ID . */632 rc = strmBlk.GetInt64Ex("node_id", &mNodeID);633 if (RT_FAILURE(rc)) throw rc;631 /* Node ID, optional because we don't include this 632 * in older VBoxService (< 4.2) versions. */ 633 mNodeID = strmBlk.GetInt64("node_id"); 634 634 /* Object name. */ 635 635 mName = strmBlk.GetString("name"); -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r42674 r42716 886 886 887 887 if (mData.mStatus != ProcessStatus_Started) 888 return V ERR_NOT_AVAILABLE;888 return VINF_SUCCESS; /* Nothing to read anymore. */ 889 889 890 890 uint32_t uContextID = 0; … … 1016 1016 } 1017 1017 1018 intGuestProcess::setErrorExternal(void)1018 HRESULT GuestProcess::setErrorExternal(void) 1019 1019 { 1020 1020 return RT_SUCCESS(mData.mRC) … … 1207 1207 LogFlowThisFuncEnter(); 1208 1208 1209 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1210 1209 1211 if (mData.mParent->getProtocolVersion() < 2) 1210 1212 return VERR_NOT_SUPPORTED; … … 1387 1389 } 1388 1390 1389 HRESULT GuestProcess::waitResultToErrorEx(const GuestProcessWaitResult &waitResult, bool fLog)1390 {1391 int rc = waitResult.mRC;1392 1393 Utf8Str strMsg;1394 ProcessStatus_T procStatus = mData.mStatus;1395 1396 switch (procStatus)1397 {1398 case ProcessStatus_Started:1399 strMsg = Utf8StrFmt(tr("Guest process \"%s\" was started (PID %RU32)"),1400 mData.mProcess.mCommand.c_str(), mData.mPID);1401 break;1402 1403 case ProcessStatus_TerminatedNormally:1404 strMsg = Utf8StrFmt(tr("Guest process \"%s\" (PID %RU32) terminated normally (exit code: %ld)"),1405 mData.mProcess.mCommand.c_str(), mData.mPID, mData.mExitCode);1406 break;1407 1408 case ProcessStatus_TerminatedSignal:1409 {1410 strMsg = Utf8StrFmt(tr("Guest process \"%s\" (PID %RU32) terminated through signal (signal: %ld)"),1411 mData.mProcess.mCommand.c_str(), mData.mPID, mData.mExitCode);1412 break;1413 }1414 1415 case ProcessStatus_TerminatedAbnormally:1416 {1417 strMsg = Utf8StrFmt(tr("Guest process \"%s\" (PID %RU32) terminated abnormally (exit code: %ld)"),1418 mData.mProcess.mCommand.c_str(), mData.mPID, mData.mExitCode);1419 break;1420 }1421 1422 case ProcessStatus_TimedOutKilled:1423 {1424 strMsg = Utf8StrFmt(tr("Guest process \"%s\" (PID %RU32) timed out and was killed"),1425 mData.mProcess.mCommand.c_str(), mData.mPID);1426 break;1427 }1428 1429 case ProcessStatus_TimedOutAbnormally:1430 {1431 strMsg = Utf8StrFmt(tr("Guest process \"%s\" (PID %RU32) timed out and could not be killed\n"),1432 mData.mProcess.mCommand.c_str(), mData.mPID);1433 break;1434 }1435 1436 case ProcessStatus_Down:1437 {1438 strMsg = Utf8StrFmt(tr("Guest process \"%s\" (PID %RU32) was killed because guest OS is shutting down\n"),1439 mData.mProcess.mCommand.c_str(), mData.mPID);1440 break;1441 }1442 1443 case ProcessStatus_Error:1444 {1445 strMsg = Utf8StrFmt(tr("Guest process \"%s\" could not be started: ", mData.mProcess.mCommand.c_str()));1446 1447 /* Note: It's not required that the process has been started before. */1448 if (mData.mPID)1449 {1450 strMsg += Utf8StrFmt(tr("Error rc=%Rrc occured (PID %RU32)"), rc, mData.mPID);1451 }1452 else1453 {1454 switch (rc) /* rc contains the IPRT error code from guest side. */1455 {1456 case VERR_FILE_NOT_FOUND: /* This is the most likely error. */1457 strMsg += Utf8StrFmt(tr("The specified file was not found on guest"));1458 break;1459 1460 case VERR_PATH_NOT_FOUND:1461 strMsg += Utf8StrFmt(tr("Could not resolve path to specified file was not found on guest"));1462 break;1463 1464 case VERR_BAD_EXE_FORMAT:1465 strMsg += Utf8StrFmt(tr("The specified file is not an executable format on guest"));1466 break;1467 1468 case VERR_AUTHENTICATION_FAILURE:1469 strMsg += Utf8StrFmt(tr("The specified user was not able to logon on guest"));1470 break;1471 1472 case VERR_INVALID_NAME:1473 strMsg += Utf8StrFmt(tr("The specified file is an invalid name"));1474 break;1475 1476 case VERR_TIMEOUT:1477 strMsg += Utf8StrFmt(tr("The guest did not respond within time"));1478 break;1479 1480 case VERR_CANCELLED:1481 strMsg += Utf8StrFmt(tr("The execution operation was canceled"));1482 break;1483 1484 case VERR_PERMISSION_DENIED:1485 strMsg += Utf8StrFmt(tr("Invalid user/password credentials"));1486 break;1487 1488 case VERR_MAX_PROCS_REACHED:1489 strMsg += Utf8StrFmt(tr("Maximum number of parallel guest processes has been reached"));1490 break;1491 1492 default:1493 strMsg += Utf8StrFmt(tr("Reported error %Rrc"), rc);1494 break;1495 }1496 }1497 1498 break;1499 }1500 1501 case ProcessStatus_Undefined:1502 default:1503 1504 /* Silently skip this request. */1505 break;1506 }1507 1508 HRESULT hr = S_OK;1509 if (RT_FAILURE(rc))1510 {1511 Assert(!strMsg.isEmpty());1512 hr = setError(VBOX_E_IPRT_ERROR, "%s", strMsg.c_str());1513 }1514 1515 if (fLog)1516 {1517 Assert(!strMsg.isEmpty());1518 1519 strMsg.append("\n");1520 LogRel(("%s", strMsg.c_str()));1521 }1522 1523 return hr;1524 }1525 1526 1391 int GuestProcess::writeData(uint32_t uHandle, uint32_t uFlags, 1527 1392 void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten) … … 1534 1399 1535 1400 if (mData.mStatus != ProcessStatus_Started) 1536 return V ERR_NOT_AVAILABLE;1401 return VINF_SUCCESS; /* Not available for writing (anymore). */ 1537 1402 1538 1403 uint32_t uContextID = 0; … … 1670 1535 AutoCaller autoCaller(this); 1671 1536 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1672 1673 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);1674 1537 1675 1538 int rc = terminateProcess(); -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r42702 r42716 144 144 } 145 145 146 /** @todo Merge this and the above call and let the above call do the open/close file handling so that the 147 * inner code only has to deal with file handles. No time now ... */ 146 148 SessionTaskCopyTo::SessionTaskCopyTo(GuestSession *pSession, 147 149 PRTFILE pSourceFile, size_t cbSourceOffset, uint64_t cbSourceSize, … … 746 748 { 747 749 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 748 Utf8StrFmt(GuestSession::tr(" Invalid installation medium \"%s\" detected: %Rrc"),750 Utf8StrFmt(GuestSession::tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"), 749 751 mSource.c_str(), rc)); 750 752 } … … 759 761 if (RT_FAILURE(rc)) 760 762 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 761 Utf8StrFmt(GuestSession::tr(" Could not seek to setup file on installation medium\"%s\": %Rrc"),762 mSource.c_str(), rc));763 Utf8StrFmt(GuestSession::tr("Unable to retrievev setup file \"%s\" information on \"%s\": %Rrc"), 764 strInstallerImage.c_str(), mSource.c_str(), rc)); 763 765 } 764 766 else … … 768 770 case VERR_FILE_NOT_FOUND: 769 771 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 770 Utf8StrFmt(GuestSession::tr(" Setup file was not found on installation medium\"%s\""),771 mSource.c_str()));772 Utf8StrFmt(GuestSession::tr("Installer \"%s\" was not found on \"%s\""), 773 strInstallerImage.c_str(), mSource.c_str())); 772 774 break; 773 775 774 776 default: 775 777 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 776 Utf8StrFmt(GuestSession::tr(" An unknown error (%Rrc) occured while retrieving information of setup file on installation medium \"%s\""),777 rc, mSource.c_str()));778 Utf8StrFmt(GuestSession::tr("Error while retrieving information for installer \"%s\" on \"%s\": %Rrc"), 779 strInstallerImage.c_str(), mSource.c_str(), rc)); 778 780 break; 779 781 } … … 849 851 * (with system rights). 850 852 */ 851 LogRel((" Starting Guest Additions installer ...\n"));853 LogRel(("Verifying Guest Additions installer ...\n")); 852 854 rc = setProgress(60); 855 } 856 857 if (RT_SUCCESS(rc)) 858 { 859 /* Determine where the installer image ended up and if it has the 860 * correct size. */ 861 GuestFsObjData objData; 862 int64_t cbSizeOnGuest; 863 rc = pSession->fileQuerySizeInternal(strInstallerDest, &cbSizeOnGuest); 864 if (RT_FAILURE(rc)) 865 { 866 /** @todo Windows only! */ 867 868 /* Because older Guest Additions have problems with environment variable 869 * expansion in parameters we have to check an alternative location on Windows. 870 * So check for "%TEMP%\VBoxWindowsAdditions.exe" in a screwed up way. */ 871 rc = pSession->fileQuerySizeInternal("C:\\Windows\\system32\\EMPVBoxWindowsAdditions.exe", &cbSizeOnGuest); 872 if (RT_SUCCESS(rc)) 873 strInstallerDest = "C:\\Windows\\system32\\EMPVBoxWindowsAdditions.exe"; 874 } 875 876 if ( RT_SUCCESS(rc) 877 && cbSize == (uint64_t)cbSizeOnGuest) 878 { 879 LogRel(("Guest Additions installer successfully verified\n")); 880 rc = setProgress(65); 881 } 882 else 883 { 884 if (RT_FAILURE(rc)) 885 { 886 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 887 Utf8StrFmt(GuestSession::tr("Unable to find Guest Additions installer on guest: %Rrc"), rc)); 888 } 889 else 890 { 891 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 892 Utf8StrFmt(GuestSession::tr("Guest Additions installer was not transfered fully (%RI64/%RU64)"), 893 cbSizeOnGuest, cbSize)); 894 rc = VERR_GENERAL_FAILURE; /* Fudge. */ 895 } 896 } 853 897 } 854 898 … … 904 948 } 905 949 else /* Yay, success! */ 950 { 951 /** @todo Add code for verifying the update. */ 952 LogRel(("Updating Guest Additions successful\n")); 906 953 hr = setProgressSuccess(); 954 } 907 955 } 908 956 else … … 912 960 Utf8StrFmt(GuestSession::tr("Error while waiting for Guest Additions update: %Rrc"), rc)); 913 961 else 914 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 915 Utf8StrFmt(GuestSession::tr("Error installing Guest Additions update: %Rrc"), 916 waitRes.mRC)); 962 { 963 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, pProcess->errorMsg()); 964 rc = VERR_GENERAL_FAILURE; /* Fudge. */ 965 } 917 966 } 918 967 } 968 if (!pProcess.isNull()) 969 pProcess->close(); 919 970 } 920 971 RTIsoFsClose(&iso);
Note:
See TracChangeset
for help on using the changeset viewer.