Changeset 34881 in vbox
- Timestamp:
- Dec 9, 2010 12:29:01 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 68694
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/GuestImpl.cpp
r34862 r34881 329 329 330 330 /* Resize buffer to reflect amount we just have read. */ 331 aInputData.resize(cbRead); 331 if (cbRead > 0) 332 aInputData.resize(cbRead); 332 333 333 334 ULONG uFlags = ProcessInputFlag_None; … … 429 430 } 430 431 else /* Everything else is not supported (yet). */ 431 throw setError(VBOX_E_NOT_SUPPORTED, tr("Guest OS not supported for automatic Guest Additions updating")); 432 throw TaskGuest::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->progress, 433 Guest::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"), 434 osType.c_str()); 432 435 433 436 /* … … 460 463 if (RT_FAILURE(vrc)) 461 464 { 462 rc = setError(VBOX_E_FILE_ERROR, tr("Invalid installation medium detected")); 465 rc = TaskGuest::setProgressErrorInfo(VBOX_E_FILE_ERROR, aTask->progress, 466 Guest::tr("Invalid installation medium (%s) detected"), 467 aTask->strSource.c_str()); 463 468 } 464 469 else … … 472 477 { 473 478 vrc = RTFileSeek(iso.file, cbOffset, RTFILE_SEEK_BEGIN, NULL); 479 if (RT_FAILURE(vrc)) 480 rc = TaskGuest::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, 481 Guest::tr("Could not seek to setup file on installation medium (%Rrc)"), vrc); 474 482 } 475 476 /* Specify the ouput path on the guest side. */ 477 Utf8Str strInstallerPath = "%TEMP%\\VBoxWindowsAdditions.exe"; 478 479 if (RT_FAILURE(vrc)) 483 else 480 484 { 481 485 switch (vrc) 482 486 { 483 487 case VERR_FILE_NOT_FOUND: 484 rc = setError(VBOX_E_IPRT_ERROR, tr("Setup file was not found on installation medium")); 488 rc = TaskGuest::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, 489 Guest::tr("Setup file was not found on installation medium")); 485 490 break; 486 491 487 492 default: 488 rc = setError(VBOX_E_IPRT_ERROR, tr("An unknown error occured (%Rrc)"), vrc); 493 rc = TaskGuest::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, 494 Guest::tr("An unknown error occured while retrieving information of setup file (%Rrc)"), vrc); 489 495 break; 490 496 } 491 497 } 492 else 498 499 /* Specify the ouput path on the guest side. */ 500 Utf8Str strInstallerPath = "%TEMP%\\VBoxWindowsAdditions.exe"; 501 502 if (RT_SUCCESS(vrc)) 493 503 { 494 504 /* Okay, we're ready to start our copy routine on the guest! */ … … 536 546 * support the guest execution feature in this version). */ 537 547 case VERR_NOT_FOUND: 538 rc = setError(VBOX_E_NOT_SUPPORTED,539 tr("Guest Additions seem not to be installed or are not ready to update yet"));548 rc = TaskGuest::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->progress, 549 Guest::tr("Guest Additions seem not to be installed or are not ready to update yet")); 540 550 break; 541 551 … … 543 553 * execution but not the built-in "vbox_cat" tool of VBoxService (< 4.0). */ 544 554 case VERR_INVALID_PARAMETER: 545 rc = setError(VBOX_E_NOT_SUPPORTED,546 tr("Installed Guest Additions do not support automatic updating"));555 rc = TaskGuest::setProgressErrorInfo(VBOX_E_NOT_SUPPORTED, aTask->progress, 556 Guest::tr("Installed Guest Additions do not support automatic updating")); 547 557 break; 548 558 549 559 default: 550 rc = setError(E_FAIL, 551 tr("Error copying Guest Additions installer (%Rrc)"), vrc); 560 rc = TaskGuest::setProgressErrorInfo(E_FAIL, aTask->progress, 561 Guest::tr("Error copying Guest Additions setup file to guest path \"%s\" (%Rrc)"), 562 strInstallerPath.c_str(), vrc); 552 563 break; 553 564 } … … 573 584 && RT_SUCCESS(vrc)) 574 585 { 575 /* Did we reach the end of the content 576 * we want to transfer (last chunk)? */ 586 /* Resize buffer to reflect amount we just have read. */ 587 if (cbRead > 0) 588 aInputData.resize(cbRead); 589 590 /* Did we reach the end of the content we want to transfer (last chunk)? */ 577 591 ULONG uFlags = ProcessInputFlag_None; 578 if (cbRead < _1M) 579 { 580 uFlags |= ProcessInputFlag_EndOfFile; 581 if (cbRead > 0) /* Don't allow an empty array! */ 582 aInputData.resize(cbRead); /* Adjust array size (less than 64K read). */ 583 } 584 585 /* 586 * Task canceled by caller? 587 * Then let the started process (cat) know by specifying end-of-file 588 * for the netxt input event that hopefully leads to a graceful exit ... 589 */ 590 if ( SUCCEEDED(aTask->progress->COMGETTER(Canceled(&fCanceled))) 591 && fCanceled) 592 if ( (cbRead < _1M) 593 /* ... or does the user want to cancel? */ 594 || ( SUCCEEDED(aTask->progress->COMGETTER(Canceled(&fCanceled))) 595 && fCanceled) 596 ) 592 597 { 593 598 uFlags |= ProcessInputFlag_EndOfFile; … … 602 607 ComSafeArrayAsInParam(aInputData), &uBytesWritten); 603 608 if (FAILED(rc)) 609 { 610 rc = TaskGuest::setProgressErrorInfo(rc, aTask->progress, pGuest); 604 611 break; 612 } 605 613 606 614 /* If task was canceled above also cancel the process execution. */ … … 714 722 else 715 723 { 716 rc = setError(VBOX_E_IPRT_ERROR,717 tr("Guest Additions update failed with exit code=%u (Status=%u, Flags=%u)"),718 uRetExitCode, uRetStatus, uRetFlags);724 rc = TaskGuest::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, 725 Guest::tr("Guest Additions update failed with exit code=%u (status=%u, flags=%u)"), 726 uRetExitCode, uRetStatus, uRetFlags); 719 727 } 720 728 } 721 729 else if (fCanceled) 722 730 { 723 rc = setError(VBOX_E_IPRT_ERROR,724 tr("Guest Additions update was canceled with exit code=%u (Status=%u, Flags=%u)"),725 uRetExitCode, uRetStatus, uRetFlags);731 rc = TaskGuest::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, 732 Guest::tr("Guest Additions update was canceled by the guest with exit code=%u (status=%u, flags=%u)"), 733 uRetExitCode, uRetStatus, uRetFlags); 726 734 } 727 735 else 728 AssertMsgFailed(("Unknown Guest Additions update status! "));736 AssertMsgFailed(("Unknown Guest Additions update status!\n")); 729 737 } 730 738 } 739 else 740 rc = TaskGuest::setProgressErrorInfo(rc, aTask->progress, pGuest); 731 741 } 732 742 } … … 739 749 /* Clean up */ 740 750 aTask->rc = rc; 741 742 if ( SUCCEEDED(aTask->progress->COMGETTER(Canceled(&fCanceled)))743 && !fCanceled744 && SUCCEEDED(aTask->progress->COMGETTER(Completed(&fCompleted)))745 && !fCompleted)746 {747 if (FAILED(rc))748 {749 aTask->progress->notifyComplete(rc,750 COM_IIDOF(IGuest),751 Guest::getStaticComponentName(),752 rc == VBOX_E_NOT_SUPPORTED753 ? Guest::tr("Automatic Guest Additions update not supported")754 : Guest::tr("Automatic Guest Additions update failed"));755 }756 else757 AssertMsgFailed(("Automatic Guest Additions update neither canceled nor completed and did *not* fail!? D'oh!\n"));758 }759 751 760 752 LogFlowFunc(("rc=%Rhrc\n", rc)); … … 1360 1352 1361 1353 default: 1362 AssertMsgFailed(("Unknown guest control notification received, u32Function=%u ", u32Function));1354 AssertMsgFailed(("Unknown guest control notification received, u32Function=%u\n", u32Function)); 1363 1355 rc = VERR_INVALID_PARAMETER; 1364 1356 break;
Note:
See TracChangeset
for help on using the changeset viewer.