Changeset 39475 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 30, 2011 1:20:06 PM (13 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r39446 r39475 203 203 AssertReturn(uContextID, VERR_INVALID_PARAMETER); 204 204 /* pEnmType is optional. */ 205 AssertPtrReturn(ppvData, VERR_INVALID_PARAMETER);205 /* ppvData is optional. */ 206 206 /* pcbData is optional. */ 207 207 … … 209 209 210 210 CallbackMapIterConst it = mCallbackMap.find(uContextID); 211 if (it != mCallbackMap.end()) 212 { 213 if (pEnmType) 214 *pEnmType = it->second.mType; 215 211 if (it == mCallbackMap.end()) 212 return VERR_NOT_FOUND; 213 214 if (pEnmType) 215 *pEnmType = it->second.mType; 216 217 if ( ppvData 218 && it->second.cbData) 219 { 216 220 void *pvData = RTMemAlloc(it->second.cbData); 217 221 AssertPtrReturn(pvData, VERR_NO_MEMORY); 218 222 memcpy(pvData, it->second.pvData, it->second.cbData); 219 223 *ppvData = pvData; 220 221 if (pcbData) 222 *pcbData = it->second.cbData; 223 224 return VINF_SUCCESS; 225 } 226 227 return VERR_NOT_FOUND; 224 } 225 226 if (pcbData) 227 *pcbData = it->second.cbData; 228 229 return VINF_SUCCESS; 228 230 } 229 231 … … 252 254 /* Everything else is optional. */ 253 255 254 int rc = VINF_SUCCESS;256 int vrc = VINF_SUCCESS; 255 257 switch (enmType) 256 258 { … … 279 281 PCALLBACKDATAEXECINSTATUS pData = (PCALLBACKDATAEXECINSTATUS)RTMemAlloc(sizeof(CALLBACKDATAEXECINSTATUS)); 280 282 AssertPtrReturn(pData, VERR_NO_MEMORY); 281 RT_BZERO(pData, sizeof( PCALLBACKDATAEXECINSTATUS));282 pCallback->cbData = sizeof( PCALLBACKDATAEXECINSTATUS);283 RT_BZERO(pData, sizeof(CALLBACKDATAEXECINSTATUS)); 284 pCallback->cbData = sizeof(CALLBACKDATAEXECINSTATUS); 283 285 pCallback->pvData = pData; 284 286 break; … … 286 288 287 289 default: 288 rc = VERR_INVALID_PARAMETER;290 vrc = VERR_INVALID_PARAMETER; 289 291 break; 290 292 } 291 293 292 if (RT_SUCCESS( rc))294 if (RT_SUCCESS(vrc)) 293 295 { 294 296 /* Init/set common stuff. */ … … 297 299 } 298 300 299 return rc;301 return vrc; 300 302 } 301 303 … … 1517 1519 ExecuteProcessStatus_T *pRetStatus, ULONG *puRetExitCode) 1518 1520 { 1519 if (uTimeoutMS == 0)1520 uTimeoutMS = UINT32_MAX;1521 1522 uint64_t u64StartMS = RTTimeMilliTS();1523 1524 HRESULT hRC;1525 1521 ULONG uExitCode, uRetFlags; 1526 1522 ExecuteProcessStatus_T curStatus; 1527 hRC = GetProcessStatus(uPID, &uExitCode, &uRetFlags, &curStatus);1523 HRESULT hRC = GetProcessStatus(uPID, &uExitCode, &uRetFlags, &curStatus); 1528 1524 if (FAILED(hRC)) 1529 1525 return hRC; 1530 1526 1531 do 1532 { 1533 if ( uTimeoutMS != UINT32_MAX 1534 && RTTimeMilliTS() - u64StartMS > uTimeoutMS) 1535 { 1536 hRC = setError(VBOX_E_IPRT_ERROR, 1537 tr("The process (PID %u) did not change its status within time (%ums)"), 1538 uPID, uTimeoutMS); 1539 break; 1540 } 1541 hRC = GetProcessStatus(uPID, &uExitCode, &uRetFlags, &curStatus); 1542 if (FAILED(hRC)) 1543 break; 1544 RTThreadSleep(100); 1545 } while(*pRetStatus == curStatus); 1527 /* We only want to wait for started processes. All other statuses 1528 * won't be found anyway anymore (see processGetStatus() to know why). */ 1529 if (curStatus == ExecuteProcessStatus_Started) 1530 { 1531 uint64_t u64StartMS = RTTimeMilliTS(); 1532 if (uTimeoutMS == 0) 1533 uTimeoutMS = UINT32_MAX; 1534 1535 do 1536 { 1537 if ( uTimeoutMS != UINT32_MAX 1538 && RTTimeMilliTS() - u64StartMS > uTimeoutMS) 1539 { 1540 hRC = setError(VBOX_E_IPRT_ERROR, 1541 tr("The process (PID %u) did not change its status within time (%ums)"), 1542 uPID, uTimeoutMS); 1543 break; 1544 } 1545 hRC = GetProcessStatus(uPID, &uExitCode, &uRetFlags, &curStatus); 1546 if (FAILED(hRC)) 1547 break; 1548 RTThreadSleep(100); 1549 } while(*pRetStatus == curStatus); 1550 } 1546 1551 1547 1552 if (SUCCEEDED(hRC)) … … 1852 1857 Guest::tr("Cannot inject input to non-existent process (PID %u)"), aPID); 1853 1858 1854 if ( SUCCEEDED(rc))1859 if (RT_SUCCESS(vrc)) 1855 1860 { 1856 1861 uint32_t uContextID = 0; … … 1922 1927 vrc = pVMMDev->hgcmHostCall("VBoxGuestControlSvc", HOST_EXEC_SET_INPUT, 1923 1928 i, paParms); 1929 if (RT_FAILURE(vrc)) 1930 rc = handleErrorHGCM(vrc); 1924 1931 } 1925 1932 } … … 1930 1937 LogFlowFunc(("Waiting for HGCM callback ...\n")); 1931 1938 1932 /* 1933 * Wait for the HGCM low level callback until the process 1934 * has been started (or something went wrong). This is necessary to 1935 * get the PID. 1939 /* 1940 * Wait for getting back the input response from the guest. 1936 1941 */ 1937 1938 PCALLBACKDATAEXECINSTATUS pExecStatusIn = NULL; 1939 1940 /* 1941 * Wait for the first stage (=0) to complete (that is starting the process). 1942 */ 1943 vrc = callbackWaitForCompletion(uContextID, 0 /* Stage */, aTimeoutMS); 1942 vrc = callbackWaitForCompletion(uContextID, -1 /* No staging required */, aTimeoutMS); 1944 1943 if (RT_SUCCESS(vrc)) 1945 1944 { 1945 PCALLBACKDATAEXECINSTATUS pExecStatusIn; 1946 1946 vrc = callbackGetUserData(uContextID, NULL /* We know the type. */, 1947 1947 (void**)&pExecStatusIn, NULL /* Don't need the size. */); 1948 1948 if (RT_SUCCESS(vrc)) 1949 1949 { 1950 AssertPtr(pExecStatusIn); 1950 1951 switch (pExecStatusIn->u32Status) 1951 1952 { … … 1954 1955 break; 1955 1956 1957 case INPUT_STS_ERROR: 1958 rc = setError(VBOX_E_IPRT_ERROR, 1959 tr("Client reported error %Rrc while processing input data"), 1960 pExecStatusIn->u32Flags); 1961 break; 1962 1963 case INPUT_STS_TERMINATED: 1964 rc = setError(VBOX_E_IPRT_ERROR, 1965 tr("Client terminated while processing input data")); 1966 break; 1967 1968 case INPUT_STS_OVERFLOW: 1969 rc = setError(VBOX_E_IPRT_ERROR, 1970 tr("Client reported buffer overflow while processing input data")); 1971 break; 1972 1956 1973 default: 1957 rc = setError(VBOX_E_IPRT_ERROR,1958 tr("Client error %u while processing input data"), pExecStatusIn->u32Status);1974 /*AssertReleaseMsgFailed(("Client reported unknown input error, status=%u, flags=%u\n", 1975 pExecStatusIn->u32Status, pExecStatusIn->u32Flags));*/ 1959 1976 break; 1960 1977 } … … 1970 1987 else 1971 1988 rc = handleErrorCompletion(vrc); 1972 }1973 else1974 rc = handleErrorHGCM(vrc);1975 1976 if (SUCCEEDED(rc))1977 {1978 /* Nothing to do here yet. */1979 1989 } 1980 1990 -
trunk/src/VBox/Main/src-client/GuestCtrlImplTasks.cpp
r39418 r39475 43 43 : taskType(aTaskType), 44 44 pGuest(aThat), 45 p rogress(aProgress),45 pProgress(aProgress), 46 46 rc(S_OK) 47 47 { … … 67 67 AssertReturn(task.get(), VERR_GENERAL_FAILURE); 68 68 69 Guest *pGuest = task->pGuest;69 ComObjPtr<Guest> pGuest = task->pGuest; 70 70 71 71 LogFlowFuncEnter(); … … 110 110 111 111 if ( pTask 112 && !pTask->p rogress.isNull())112 && !pTask->pProgress.isNull()) 113 113 { 114 114 BOOL fCanceled; 115 pTask->p rogress->COMGETTER(Canceled)(&fCanceled);115 pTask->pProgress->COMGETTER(Canceled)(&fCanceled); 116 116 if (fCanceled) 117 117 return -1; 118 pTask->p rogress->SetCurrentOperationProgress(uPercent);118 pTask->pProgress->SetCurrentOperationProgress(uPercent); 119 119 } 120 120 return VINF_SUCCESS; … … 173 173 try 174 174 { 175 Guest *pGuest = aTask->pGuest; 176 AssertPtr(pGuest); 175 ComObjPtr<Guest> pGuest = aTask->pGuest; 177 176 178 177 /* Does our source file exist? */ 179 178 if (!RTFileExists(aTask->strSource.c_str())) 180 179 { 181 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,180 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 182 181 Guest::tr("Source file \"%s\" does not exist, or is not a file"), 183 182 aTask->strSource.c_str()); … … 190 189 if (RT_FAILURE(vrc)) 191 190 { 192 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,191 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 193 192 Guest::tr("Could not open source file \"%s\" for reading (%Rrc)"), 194 193 aTask->strSource.c_str(), vrc); … … 200 199 if (RT_FAILURE(vrc)) 201 200 { 202 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,201 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 203 202 Guest::tr("Could not query file size of \"%s\" (%Rrc)"), 204 203 aTask->strSource.c_str(), vrc); … … 234 233 else 235 234 { 236 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,235 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 237 236 Guest::tr("Error preparing command line")); 238 237 } … … 248 247 * actual copying, start the guest part now. 249 248 */ 250 rc = pGuest-> ExecuteProcess(Bstr(VBOXSERVICE_TOOL_CAT).raw(),251 ExecuteProcessFlag_Hidden252 | ExecuteProcessFlag_WaitForProcessStartOnly,253 ComSafeArrayAsInParam(args),254 ComSafeArrayAsInParam(env),255 Bstr(aTask->strUserName).raw(),256 Bstr(aTask->strPassword).raw(),257 5 * 1000 /* Wait 5s for getting the process started. */,258 &uPID, execProgress.asOutParam());249 rc = pGuest->executeAndWaitForTool(Bstr(VBOXSERVICE_TOOL_CAT).raw(), 250 Bstr("Copying file to guest").raw(), 251 ComSafeArrayAsInParam(args), 252 ComSafeArrayAsInParam(env), 253 Bstr(aTask->strUserName).raw(), 254 Bstr(aTask->strPassword).raw(), 255 ExecuteProcessFlag_None, 256 NULL, NULL, 257 execProgress.asOutParam(), &uPID); 259 258 if (FAILED(rc)) 260 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);259 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 261 260 } 262 261 … … 267 266 268 267 size_t cbToRead = cbSize; 269 size_t cbTransfered = 0; 268 uint64_t cbTransferedTotal = 0; 269 270 270 size_t cbRead; 271 271 272 SafeArray<BYTE> aInputData(_64K); 272 273 while ( SUCCEEDED(execProgress->COMGETTER(Completed(&fCompleted))) 273 274 && !fCompleted) 274 275 { 275 if (!cbToRead) 276 cbRead = 0; 277 else 276 /** @todo Not very efficient, but works for now. */ 277 vrc = RTFileSeek(fileSource, cbTransferedTotal, 278 RTFILE_SEEK_BEGIN, NULL /* poffActual */); 279 if (RT_SUCCESS(vrc)) 278 280 { 279 281 vrc = RTFileRead(fileSource, (uint8_t*)aInputData.raw(), … … 286 288 if (RT_FAILURE(vrc)) 287 289 { 288 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,290 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 289 291 Guest::tr("Could not read from file \"%s\" (%Rrc)"), 290 292 aTask->strSource.c_str(), vrc); … … 292 294 } 293 295 } 294 296 else 297 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 298 Guest::tr("Seeking file \"%s\" failed; offset = %RU64 (%Rrc)"), 299 aTask->strSource.c_str(), cbTransferedTotal, vrc); 295 300 /* Resize buffer to reflect amount we just have read. 296 301 * Size 0 is allowed! */ … … 303 308 || (cbToRead - cbRead == 0) 304 309 /* ... or does the user want to cancel? */ 305 || ( SUCCEEDED(aTask->p rogress->COMGETTER(Canceled(&fCanceled)))310 || ( SUCCEEDED(aTask->pProgress->COMGETTER(Canceled(&fCanceled))) 306 311 && fCanceled) 307 312 ) … … 310 315 } 311 316 312 /* Transfer the current chunk ... */313 317 ULONG uBytesWritten; 314 318 rc = pGuest->SetProcessInput(uPID, uFlags, 315 10 * 1000 /* Wait 10s for getting the input data transfered.*/,319 0 /* Infinite timeout */, 316 320 ComSafeArrayAsInParam(aInputData), &uBytesWritten); 317 321 if (FAILED(rc)) 318 322 { 319 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);323 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 320 324 break; 321 325 } … … 325 329 cbToRead -= cbRead; 326 330 327 cbTransfered += uBytesWritten;328 Assert(cbTransfered <= cbSize);329 aTask->p rogress->SetCurrentOperationProgress(cbTransfered/ (cbSize / 100.0));331 cbTransferedTotal += uBytesWritten; 332 Assert(cbTransferedTotal <= cbSize); 333 aTask->pProgress->SetCurrentOperationProgress(cbTransferedTotal / (cbSize / 100.0)); 330 334 331 335 /* End of file reached? */ … … 341 345 && fCanceled) 342 346 { 343 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,347 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 344 348 Guest::tr("Copy operation of file \"%s\" was canceled on guest side"), 345 349 aTask->strSource.c_str()); … … 356 360 ExecuteProcessStatus_T retStatus; 357 361 ULONG uRetExitCode; 358 rc = pGuest->executeWaitForStatusChange(uPID, 10 * 1000 /* 10stimeout. */,362 rc = pGuest->executeWaitForStatusChange(uPID, 0 /* No timeout. */, 359 363 &retStatus, &uRetExitCode); 360 364 if (FAILED(rc)) 361 365 { 362 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);366 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 363 367 } 364 368 else … … 367 371 || retStatus != ExecuteProcessStatus_TerminatedNormally) 368 372 { 369 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,373 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 370 374 Guest::tr("Guest reported error %u while copying file \"%s\" to \"%s\""), 371 375 uRetExitCode, aTask->strSource.c_str(), aTask->strDest.c_str()); … … 382 386 * notify the object with a complete event when it's canceled. 383 387 */ 384 aTask->p rogress->notifyComplete(VBOX_E_IPRT_ERROR,388 aTask->pProgress->notifyComplete(VBOX_E_IPRT_ERROR, 385 389 COM_IIDOF(IGuest), 386 390 Guest::getStaticComponentName(), … … 394 398 */ 395 399 if ( cbSize > 0 396 && cbTransfered == 0)400 && cbTransferedTotal == 0) 397 401 { 398 402 /* If nothing was transfered but the file size was > 0 then "vbox_cat" wasn't able to write 399 403 * to the destination -> access denied. */ 400 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,404 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 401 405 Guest::tr("Access denied when copying file \"%s\" to \"%s\""), 402 406 aTask->strSource.c_str(), aTask->strDest.c_str()); 403 407 } 404 else if (cbTransfered < cbSize)408 else if (cbTransferedTotal < cbSize) 405 409 { 406 410 /* If we did not copy all let the user know. */ 407 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,411 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 408 412 Guest::tr("Copying file \"%s\" failed (%u/%u bytes transfered)"), 409 aTask->strSource.c_str(), cbTransfered , cbSize);413 aTask->strSource.c_str(), cbTransferedTotal, cbSize); 410 414 } 411 415 else /* Yay, all went fine! */ 412 aTask->p rogress->notifyComplete(S_OK);416 aTask->pProgress->notifyComplete(S_OK); 413 417 } 414 418 } … … 450 454 try 451 455 { 452 Guest *pGuest = aTask->pGuest; 453 AssertPtr(pGuest); 456 ComObjPtr<Guest> pGuest = aTask->pGuest; 454 457 455 458 /* Does our source file exist? */ … … 461 464 { 462 465 if (!fFileExists) 463 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,466 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 464 467 Guest::tr("Source file \"%s\" does not exist, or is not a file"), 465 468 aTask->strSource.c_str()); 466 469 } 467 470 else 468 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);471 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 469 472 470 473 /* Query file size to make an estimate for our progress object. */ … … 476 479 &lFileSize); 477 480 if (FAILED(rc)) 478 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);481 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 479 482 480 483 com::SafeArray<IN_BSTR> args; … … 507 510 } 508 511 else 509 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,512 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 510 513 Guest::tr("Error preparing command line")); 511 514 } … … 532 535 execProgress.asOutParam(), &uPID); 533 536 if (FAILED(rc)) 534 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);537 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 535 538 } 536 539 … … 544 547 RTFILE_O_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE); 545 548 if (RT_FAILURE(vrc)) 546 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,549 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 547 550 Guest::tr("Unable to create/open destination file \"%s\", rc=%Rrc"), 548 551 aTask->strDest.c_str(), vrc); … … 565 568 if (RT_FAILURE(vrc)) 566 569 { 567 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,570 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 568 571 Guest::tr("Error writing to file \"%s\" (%u bytes left), rc=%Rrc"), 569 572 aTask->strSource.c_str(), cbToRead, vrc); … … 575 578 cbTransfered += aOutputData.size(); 576 579 577 aTask->p rogress->SetCurrentOperationProgress(cbTransfered / (lFileSize / 100.0));580 aTask->pProgress->SetCurrentOperationProgress(cbTransfered / (lFileSize / 100.0)); 578 581 } 579 582 … … 582 585 else 583 586 { 584 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);587 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 585 588 break; 586 589 } … … 597 600 * be (almost) sure that this file is not meant to be read by the specified user. 598 601 */ 599 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,602 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 600 603 Guest::tr("Unexpected end of file \"%s\" (%u bytes total, %u bytes transferred)"), 601 604 aTask->strSource.c_str(), lFileSize, cbTransfered); … … 603 606 604 607 if (SUCCEEDED(rc)) 605 aTask->p rogress->notifyComplete(S_OK);608 aTask->pProgress->notifyComplete(S_OK); 606 609 } 607 610 } … … 641 644 try 642 645 { 643 Guest *pGuest = aTask->pGuest; 644 AssertPtr(pGuest); 645 646 aTask->progress->SetCurrentOperationProgress(10); 646 ComObjPtr<Guest> pGuest = aTask->pGuest; 647 648 aTask->pProgress->SetCurrentOperationProgress(10); 647 649 648 650 /* … … 667 669 } 668 670 else /* Everything else is not supported (yet). */ 669 throw GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->p rogress,671 throw GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->pProgress, 670 672 Guest::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"), 671 673 osTypeIdUtf8.c_str()); 672 674 } 673 675 else 674 throw GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->p rogress,676 throw GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->pProgress, 675 677 Guest::tr("Could not detected guest OS type/version, please update manually")); 676 678 Assert(!installerImage.isEmpty()); … … 683 685 if (RT_FAILURE(vrc)) 684 686 { 685 rc = GuestTask::setProgressErrorInfo(VBOX_E_FILE_ERROR, aTask->p rogress,687 rc = GuestTask::setProgressErrorInfo(VBOX_E_FILE_ERROR, aTask->pProgress, 686 688 Guest::tr("Invalid installation medium detected: \"%s\""), 687 689 aTask->strSource.c_str()); … … 698 700 vrc = RTFileSeek(iso.file, cbOffset, RTFILE_SEEK_BEGIN, NULL); 699 701 if (RT_FAILURE(vrc)) 700 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,702 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 701 703 Guest::tr("Could not seek to setup file on installation medium \"%s\" (%Rrc)"), 702 704 aTask->strSource.c_str(), vrc); … … 707 709 { 708 710 case VERR_FILE_NOT_FOUND: 709 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,711 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 710 712 Guest::tr("Setup file was not found on installation medium \"%s\""), 711 713 aTask->strSource.c_str()); … … 713 715 714 716 default: 715 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,717 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 716 718 Guest::tr("An unknown error (%Rrc) occured while retrieving information of setup file on installation medium \"%s\""), 717 719 vrc, aTask->strSource.c_str()); … … 726 728 { 727 729 /* Okay, we're ready to start our copy routine on the guest! */ 728 aTask->p rogress->SetCurrentOperationProgress(15);730 aTask->pProgress->SetCurrentOperationProgress(15); 729 731 730 732 /* Prepare command line args. */ … … 768 770 case VERR_NOT_FOUND: 769 771 LogRel(("Guest Additions seem not to be installed yet\n")); 770 rc = GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->p rogress,772 rc = GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->pProgress, 771 773 Guest::tr("Guest Additions seem not to be installed or are not ready to update yet")); 772 774 break; … … 776 778 case VERR_INVALID_PARAMETER: 777 779 LogRel(("Guest Additions are installed but don't supported automatic updating\n")); 778 rc = GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->p rogress,780 rc = GuestTask::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->pProgress, 779 781 Guest::tr("Installed Guest Additions do not support automatic updating")); 780 782 break; … … 782 784 case VERR_TIMEOUT: 783 785 LogRel(("Guest was unable to start copying the Guest Additions setup within time\n")); 784 rc = GuestTask::setProgressErrorInfo(E_FAIL, aTask->p rogress,786 rc = GuestTask::setProgressErrorInfo(E_FAIL, aTask->pProgress, 785 787 Guest::tr("Guest was unable to start copying the Guest Additions setup within time")); 786 788 break; 787 789 788 790 default: 789 rc = GuestTask::setProgressErrorInfo(E_FAIL, aTask->p rogress,791 rc = GuestTask::setProgressErrorInfo(E_FAIL, aTask->pProgress, 790 792 Guest::tr("Error copying Guest Additions setup file to guest path \"%s\" (%Rrc)"), 791 793 strInstallerPath.c_str(), vrc); … … 798 800 LogRel(("Copying Guest Additions installer \"%s\" to \"%s\" on guest ...\n", 799 801 installerImage.c_str(), strInstallerPath.c_str())); 800 aTask->p rogress->SetCurrentOperationProgress(20);802 aTask->pProgress->SetCurrentOperationProgress(20); 801 803 802 804 /* Wait for process to exit ... */ … … 825 827 || (cbToRead - cbRead == 0) 826 828 /* ... or does the user want to cancel? */ 827 || ( SUCCEEDED(aTask->p rogress->COMGETTER(Canceled(&fCanceled)))829 || ( SUCCEEDED(aTask->pProgress->COMGETTER(Canceled(&fCanceled))) 828 830 && fCanceled) 829 831 ) … … 842 844 if (FAILED(rc)) 843 845 { 844 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);846 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 845 847 break; 846 848 } … … 858 860 else if (RT_FAILURE(vrc)) 859 861 { 860 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,862 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 861 863 Guest::tr("Error while reading setup file \"%s\" (To read: %u, Size: %u) from installation medium (%Rrc)"), 862 864 installerImage.c_str(), cbToRead, cbLength, vrc); … … 868 870 && fCanceled) 869 871 { 870 aTask->p rogress->Cancel();872 aTask->pProgress->Cancel(); 871 873 break; 872 874 } … … 878 880 879 881 if ( SUCCEEDED(rc) 880 && ( SUCCEEDED(aTask->p rogress->COMGETTER(Canceled(&fCanceled)))882 && ( SUCCEEDED(aTask->pProgress->COMGETTER(Canceled(&fCanceled))) 881 883 && !fCanceled 882 884 ) … … 888 890 */ 889 891 LogRel(("Preparing to execute Guest Additions update ...\n")); 890 aTask->p rogress->SetCurrentOperationProgress(66);892 aTask->pProgress->SetCurrentOperationProgress(66); 891 893 892 894 /* Prepare command line args for installer. */ … … 931 933 * complete the progress object now so that the caller can do other work. */ 932 934 if (aTask->uFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly) 933 aTask->p rogress->notifyComplete(S_OK);935 aTask->pProgress->notifyComplete(S_OK); 934 936 else 935 aTask->p rogress->SetCurrentOperationProgress(70);937 aTask->pProgress->SetCurrentOperationProgress(70); 936 938 937 939 /* Wait until the Guest Additions installer finishes ... */ … … 939 941 && !fCompleted) 940 942 { 941 if ( SUCCEEDED(aTask->p rogress->COMGETTER(Canceled(&fCanceled)))943 if ( SUCCEEDED(aTask->pProgress->COMGETTER(Canceled(&fCanceled))) 942 944 && fCanceled) 943 945 { … … 964 966 { 965 967 LogRel(("Guest Additions update successful!\n")); 966 if ( SUCCEEDED(aTask->p rogress->COMGETTER(Completed(&fCompleted)))968 if ( SUCCEEDED(aTask->pProgress->COMGETTER(Completed(&fCompleted))) 967 969 && !fCompleted) 968 aTask->p rogress->notifyComplete(S_OK);970 aTask->pProgress->notifyComplete(S_OK); 969 971 } 970 972 else … … 972 974 LogRel(("Guest Additions update failed (Exit code=%u, Status=%u, Flags=%u)\n", 973 975 uRetExitCode, retStatus, uRetFlags)); 974 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,976 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 975 977 Guest::tr("Guest Additions update failed with exit code=%u (status=%u, flags=%u)"), 976 978 uRetExitCode, retStatus, uRetFlags); … … 981 983 { 982 984 LogRel(("Guest Additions update was canceled\n")); 983 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->p rogress,985 rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->pProgress, 984 986 Guest::tr("Guest Additions update was canceled by the guest with exit code=%u (status=%u, flags=%u)"), 985 987 uRetExitCode, retStatus, uRetFlags); … … 991 993 } 992 994 else 993 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);995 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 994 996 } 995 997 else 996 rc = GuestTask::setProgressErrorInfo(rc, aTask->p rogress, pGuest);998 rc = GuestTask::setProgressErrorInfo(rc, aTask->pProgress, pGuest); 997 999 } 998 1000 }
Note:
See TracChangeset
for help on using the changeset viewer.