Changeset 34831 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Dec 8, 2010 1:37:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r34769 r34831 201 201 static int ctrlPrintProgressError(ComPtr<IProgress> progress) 202 202 { 203 com::ProgressErrorInfo ErrInfo(progress); 204 return ctrlPrintError(ErrInfo); 203 int rc; 204 BOOL fCanceled; 205 if ( SUCCEEDED(progress->COMGETTER(Canceled(&fCanceled))) 206 && fCanceled) 207 { 208 rc = VERR_CANCELLED; 209 } 210 else 211 { 212 com::ProgressErrorInfo ErrInfo(progress); 213 rc = ctrlPrintError(ErrInfo); 214 } 215 return rc; 205 216 } 206 217 … … 954 965 * @return IPRT status code. 955 966 * @param pGuest IGuest interface pointer. 967 * @param fVerbose Verbose flag. 956 968 * @param pszSource Source path of existing host file to copy. 957 969 * @param pszDest Destination path on guest to copy the file to. … … 960 972 * @param uFlags Copy flags. 961 973 */ 962 static int ctrlCopyFileToGuest(IGuest *pGuest, const char *pszSource, const char *pszDest,974 static int ctrlCopyFileToGuest(IGuest *pGuest, bool fVerbose, const char *pszSource, const char *pszDest, 963 975 const char *pszUserName, const char *pszPassword, 964 976 uint32_t uFlags) … … 978 990 else 979 991 { 980 /* Setup signal handling if cancelable. */ 981 ASSERT(progress); 982 bool fCanceledAlready = false; 983 BOOL fCancelable = FALSE; 984 HRESULT hrc = progress->COMGETTER(Cancelable)(&fCancelable); 985 if (fCancelable) 986 ctrlSignalHandlerInstall(); 987 988 /* Wait for process to exit ... */ 989 BOOL fCompleted = FALSE; 990 BOOL fCanceled = FALSE; 991 while ( SUCCEEDED(progress->COMGETTER(Completed(&fCompleted))) 992 && !fCompleted) 993 { 994 /* Process async cancelation */ 995 if (g_fGuestCtrlCanceled && !fCanceledAlready) 996 { 997 hrc = progress->Cancel(); 998 if (SUCCEEDED(hrc)) 999 fCanceledAlready = TRUE; 1000 else 1001 g_fGuestCtrlCanceled = false; 1002 } 1003 1004 /* Progress canceled by Main API? */ 1005 if ( SUCCEEDED(progress->COMGETTER(Canceled(&fCanceled))) 1006 && fCanceled) 1007 { 1008 break; 1009 } 1010 } 1011 1012 /* Undo signal handling. */ 1013 if (fCancelable) 1014 ctrlSignalHandlerUninstall(); 1015 1016 if (fCanceled) 1017 { 1018 /* Nothing to do here right now. */ 1019 } 1020 else if ( fCompleted 1021 && SUCCEEDED(rc)) 1022 { 1023 LONG iRc; 1024 CHECK_ERROR_RET(progress, COMGETTER(ResultCode)(&iRc), rc); 1025 if (FAILED(iRc)) 1026 vrc = ctrlPrintProgressError(progress); 1027 } 992 rc = showProgress(progress); 993 if (FAILED(rc)) 994 vrc = ctrlPrintProgressError(progress); 1028 995 } 1029 996 return vrc; … … 1208 1175 /* Finally copy the desired file (if no dry run selected). */ 1209 1176 if (!fDryRun) 1210 vrc = ctrlCopyFileToGuest(guest, pNode->pszSourcePath, pNode->pszDestPath,1177 vrc = ctrlCopyFileToGuest(guest, fVerbose, pNode->pszSourcePath, pNode->pszDestPath, 1211 1178 Utf8UserName.c_str(), Utf8Password.c_str(), uFlags); 1212 1179 }
Note:
See TracChangeset
for help on using the changeset viewer.