Changeset 71219 in vbox
- Timestamp:
- Mar 5, 2018 9:32:09 PM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestSessionImpl.h
r71213 r71219 76 76 /** @name Directory handling primitives. 77 77 * @{ */ 78 int directoryCreate(const com::Utf8Str &strPath, DirectoryCreateFlag_T enmDirecotryCreateFlags, uint32_t uMode, bool fFollowSymlinks); 78 int directoryCreate(const com::Utf8Str &strPath, DirectoryCreateFlag_T enmDirecotryCreateFlags, uint32_t uMode, 79 bool fFollowSymlinks); 79 80 /** @} */ 80 81 81 82 /** @name File handling primitives. 82 83 * @{ */ 83 int fileCopyToGuestEx(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags, PRTFILE pFile, uint64_t cbOffset, uint64_t cbSize); 84 int fileCopyToGuestEx(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags, PRTFILE pFile, 85 uint64_t cbOffset, uint64_t cbSize); /**< r=bird: 'cbOffset' makes no sense what so ever. It should be 'off', or do you mean sizeof(uint64_t)? */ 84 86 int fileCopyToGuest(const Utf8Str &strSource, const Utf8Str &strDest, FileCopyFlag_T enmFileCopyFlags); 85 87 /** @} */ … … 144 146 public: 145 147 146 SessionTaskCopyDirFrom(GuestSession *pSession, 147 const Utf8Str &strSource, const Utf8Str &strDest, const Utf8Str &strFilter,DirectoryCopyFlags_T enmDirCopyFlags);148 SessionTaskCopyDirFrom(GuestSession *pSession, const Utf8Str &strSource, const Utf8Str &strDest, const Utf8Str &strFilter, 149 DirectoryCopyFlags_T enmDirCopyFlags); 148 150 virtual ~SessionTaskCopyDirFrom(void); 149 151 int Run(void); … … 151 153 protected: 152 154 153 int directoryCopyToHost(const Utf8Str &strSource, const Utf8Str &strFilter, const Utf8Str &strDest, bool fRecursive, bool fFollowSymlinks,154 const Utf8Str &strSubDir /* For recursion. */);155 int directoryCopyToHost(const Utf8Str &strSource, const Utf8Str &strFilter, const Utf8Str &strDest, bool fRecursive, 156 bool fFollowSymlinks, const Utf8Str &strSubDir /* For recursion. */); 155 157 protected: 156 158 … … 168 170 public: 169 171 170 SessionTaskCopyDirTo(GuestSession *pSession, 171 const Utf8Str &strSource, const Utf8Str &strDest, const Utf8Str &strFilter,DirectoryCopyFlags_T enmDirCopyFlags);172 SessionTaskCopyDirTo(GuestSession *pSession, const Utf8Str &strSource, const Utf8Str &strDest, const Utf8Str &strFilter, 173 DirectoryCopyFlags_T enmDirCopyFlags); 172 174 virtual ~SessionTaskCopyDirTo(void); 173 175 int Run(void); … … 175 177 protected: 176 178 177 int directoryCopyToGuest(const Utf8Str &strSource, const Utf8Str &strFilter, const Utf8Str &strDest, bool fRecursive, bool fFollowSymlinks,178 const Utf8Str &strSubDir /* For recursion. */);179 int directoryCopyToGuest(const Utf8Str &strSource, const Utf8Str &strFilter, const Utf8Str &strDest, bool fRecursive, 180 bool fFollowSymlinks, const Utf8Str &strSubDir /* For recursion. */); 179 181 protected: 180 182 -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r71213 r71219 2635 2635 try 2636 2636 { 2637 pTask = new SessionTaskCopyDirTo(this /* GuestSession */, aSource, aDestination, "" /* strFilter */, fFlags); 2637 pTask = new SessionTaskCopyDirTo(this /* GuestSession */, aSource, aDestination, "" /* strFilter */, 2638 (DirectoryCopyFlags_T)fFlags); 2638 2639 } 2639 2640 catch(...) -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r71213 r71219 301 301 int rc = mSession->i_processCreateExInternal(procInfo, pProcess); 302 302 303 int guestRc;303 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 304 304 if (RT_SUCCESS(rc)) 305 305 { 306 306 Assert(!pProcess.isNull()); 307 rc = pProcess->i_startProcess(msTimeout, &guestRc); 308 } 309 307 rc = pProcess->i_startProcess(msTimeout, &rcGuest); 308 } 310 309 if (RT_FAILURE(rc)) 311 310 { … … 313 312 { 314 313 case VERR_GSTCTL_GUEST_ERROR: 315 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 316 GuestProcess::i_guestErrorToString(guestRc)); 314 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 317 315 break; 318 316 319 317 default: 320 318 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 321 Utf8StrFmt(GuestSession::tr( 322 "Error while creating guest process for copying file \"%s\" from guest to host: %Rrc"), 323 strSource.c_str(), rc)); 319 Utf8StrFmt(GuestSession::tr("Error while creating guest process for copying file \"%s\" from guest to host: %Rrc"), 320 strSource.c_str(), rc)); 324 321 break; 325 322 } 326 }327 328 if (RT_FAILURE(rc))329 323 return rc; 324 } 330 325 331 326 ProcessWaitResult_T waitRes; … … 338 333 for (;;) 339 334 { 340 rc = pProcess->i_waitFor(ProcessWaitForFlag_StdIn, msTimeout, waitRes, & guestRc);335 rc = pProcess->i_waitFor(ProcessWaitForFlag_StdIn, msTimeout, waitRes, &rcGuest); 341 336 if ( RT_FAILURE(rc) 342 337 || ( waitRes != ProcessWaitResult_StdIn … … 401 396 uint32_t cbWritten; 402 397 Assert(sizeof(byBuf) >= cbRead); 403 rc = pProcess->i_writeData(0 /* StdIn */, fFlags, 404 byBuf, cbRead, 405 msTimeout, &cbWritten, &guestRc); 398 rc = pProcess->i_writeData(0 /* StdIn */, fFlags, byBuf, cbRead, msTimeout, &cbWritten, &rcGuest); 406 399 if (RT_FAILURE(rc)) 407 400 { … … 409 402 { 410 403 case VERR_GSTCTL_GUEST_ERROR: 411 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 412 GuestProcess::i_guestErrorToString(guestRc)); 404 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 413 405 break; 414 406 … … 460 452 || RT_SUCCESS(rc)) 461 453 { 462 rc = pProcess->i_waitFor(ProcessWaitForFlag_Terminate, msTimeout, waitRes, & guestRc);454 rc = pProcess->i_waitFor(ProcessWaitForFlag_Terminate, msTimeout, waitRes, &rcGuest); 463 455 if ( RT_FAILURE(rc) 464 456 || waitRes != ProcessWaitResult_Terminate) … … 901 893 || mDest.endsWith("\\")) 902 894 { 903 int guestRc;895 int rcGuest; 904 896 GuestFsObjData objData; 905 rc = mSession->i_fsQueryInfoInternal(mDest, true /* fFollowSymlinks */, objData, & guestRc);897 rc = mSession->i_fsQueryInfoInternal(mDest, true /* fFollowSymlinks */, objData, &rcGuest); 906 898 if (RT_SUCCESS(rc)) 907 899 { … … 924 916 case VERR_GSTCTL_GUEST_ERROR: 925 917 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 926 GuestProcess::i_guestErrorToString( guestRc));918 GuestProcess::i_guestErrorToString(rcGuest)); 927 919 break; 928 920 … … 939 931 { 940 932 if (mSourceFile) /* Use existing file handle. */ 941 rc = fileCopyToGuestEx(mSource, mDest, mCopyFileFlags, 942 mSourceFile, mSourceOffset, mSourceSize); 933 rc = fileCopyToGuestEx(mSource, mDest, (FileCopyFlag_T)mCopyFileFlags, mSourceFile, mSourceOffset, mSourceSize); 943 934 else 944 rc = fileCopyToGuest(mSource, mDest, mCopyFileFlags);935 rc = fileCopyToGuest(mSource, mDest, (FileCopyFlag_T)mCopyFileFlags); 945 936 946 937 if (RT_SUCCESS(rc)) … … 982 973 ** @todo Use the IGuestFile API for locking down the file on the guest! 983 974 */ 984 GuestFsObjData objData; int guestRc; 985 int rc = mSession->i_fileQueryInfoInternal(Utf8Str(mSource), false /*fFollowSymlinks*/, objData, &guestRc); 975 GuestFsObjData objData; 976 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 977 int rc = mSession->i_fileQueryInfoInternal(Utf8Str(mSource), false /*fFollowSymlinks*/, objData, &rcGuest); 986 978 if (RT_FAILURE(rc)) 987 979 { … … 1024 1016 rc = mSession->i_processCreateExInternal(procInfo, pProcess); 1025 1017 if (RT_SUCCESS(rc)) 1026 rc = pProcess->i_startProcess(msTimeout, & guestRc);1018 rc = pProcess->i_startProcess(msTimeout, &rcGuest); 1027 1019 if (RT_FAILURE(rc)) 1028 1020 { … … 1030 1022 { 1031 1023 case VERR_GSTCTL_GUEST_ERROR: 1032 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString( guestRc));1024 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 1033 1025 break; 1034 1026 … … 1052 1044 for (;;) 1053 1045 { 1054 rc = pProcess->i_waitFor(ProcessWaitForFlag_StdOut, msTimeout, waitRes, & guestRc);1046 rc = pProcess->i_waitFor(ProcessWaitForFlag_StdOut, msTimeout, waitRes, &rcGuest); 1055 1047 if (RT_FAILURE(rc)) 1056 1048 { … … 1058 1050 { 1059 1051 case VERR_GSTCTL_GUEST_ERROR: 1060 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1061 GuestProcess::i_guestErrorToString(guestRc)); 1052 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 1062 1053 break; 1063 1054 … … 1083 1074 rc = pProcess->i_readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf), 1084 1075 msTimeout, byBuf, sizeof(byBuf), 1085 &cbRead, & guestRc);1076 &cbRead, &rcGuest); 1086 1077 if (RT_FAILURE(rc)) 1087 1078 { … … 1089 1080 { 1090 1081 case VERR_GSTCTL_GUEST_ERROR: 1091 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1092 GuestProcess::i_guestErrorToString(guestRc)); 1082 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 1093 1083 break; 1094 1084 … … 1139 1129 } /* for */ 1140 1130 1141 LogFlowThisFunc(("rc=%Rrc, guestrc=%Rrc, waitRes=%ld, cbWrittenTotal=%RU64, cbSize=%RI64, cbToRead=%RU64\n",1142 rc, guestRc, waitRes, cbWrittenTotal, objData.mObjectSize, cbToRead));1131 LogFlowThisFunc(("rc=%Rrc, rcGuest=%Rrc, waitRes=%ld, cbWrittenTotal=%RU64, cbSize=%RI64, cbToRead=%RU64\n", 1132 rc, rcGuest, waitRes, cbWrittenTotal, objData.mObjectSize, cbToRead)); 1143 1133 1144 1134 /* … … 1148 1138 || RT_SUCCESS(rc)) 1149 1139 { 1150 rc = pProcess->i_waitFor(ProcessWaitForFlag_Terminate, msTimeout, waitRes, & guestRc);1140 rc = pProcess->i_waitFor(ProcessWaitForFlag_Terminate, msTimeout, waitRes, &rcGuest); 1151 1141 if ( RT_FAILURE(rc) 1152 1142 || waitRes != ProcessWaitResult_Terminate) … … 1392 1382 1393 1383 GuestFsObjData objData; 1394 int64_t cbSizeOnGuest; int guestRc; 1395 rc = pSession->i_fileQuerySizeInternal(strFileDest, false /*fFollowSymlinks*/, &cbSizeOnGuest, &guestRc); 1384 int64_t cbSizeOnGuest; 1385 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 1386 rc = pSession->i_fileQuerySizeInternal(strFileDest, false /*fFollowSymlinks*/, &cbSizeOnGuest, &rcGuest); 1396 1387 if ( RT_SUCCESS(rc) 1397 1388 && cbSize == (uint64_t)cbSizeOnGuest) … … 1413 1404 { 1414 1405 case VERR_GSTCTL_GUEST_ERROR: 1415 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1416 GuestProcess::i_guestErrorToString(guestRc)); 1406 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 1417 1407 break; 1418 1408 … … 1442 1432 LogRel(("Running %s ...\n", procInfo.mName.c_str())); 1443 1433 1444 GuestProcessTool procTool; int guestRc; 1445 int vrc = procTool.Init(pSession, procInfo, false /* Async */, &guestRc); 1434 GuestProcessTool procTool; 1435 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 1436 int vrc = procTool.Init(pSession, procInfo, false /* Async */, &rcGuest); 1446 1437 if (RT_SUCCESS(vrc)) 1447 1438 { 1448 if (RT_SUCCESS( guestRc))1449 vrc = procTool.i_wait(GUESTPROCESSTOOL_FLAG_NONE, & guestRc);1439 if (RT_SUCCESS(rcGuest)) 1440 vrc = procTool.i_wait(GUESTPROCESSTOOL_FLAG_NONE, &rcGuest); 1450 1441 if (RT_SUCCESS(vrc)) 1451 1442 vrc = procTool.i_terminatedOk(); … … 1463 1454 1464 1455 case VERR_GSTCTL_GUEST_ERROR: 1465 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1466 GuestProcess::i_guestErrorToString(guestRc)); 1456 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 1467 1457 break; 1468 1458 … … 1704 1694 1705 1695 /* Create the installation directory. */ 1706 int guestRc; 1707 rc = pSession->i_directoryCreateInternal(strUpdateDir, 1708 755 /* Mode */, DirectoryCreateFlag_Parents, &guestRc); 1696 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 1697 rc = pSession->i_directoryCreateInternal(strUpdateDir, 755 /* Mode */, DirectoryCreateFlag_Parents, &rcGuest); 1709 1698 if (RT_FAILURE(rc)) 1710 1699 { … … 1712 1701 { 1713 1702 case VERR_GSTCTL_GUEST_ERROR: 1714 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1715 GuestProcess::i_guestErrorToString(guestRc)); 1703 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest)); 1716 1704 break; 1717 1705
Note:
See TracChangeset
for help on using the changeset viewer.