Changeset 104640 in vbox for trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
- Timestamp:
- May 15, 2024 1:16:55 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r104637 r104640 2483 2483 } 2484 2484 2485 UpdateAdditionsProcess::~UpdateAdditionsProcess() 2486 { 2487 /* Log any remainders if not done yet. */ 2488 if (mLineStdOut.isNotEmpty()) 2489 LogRel(("Guest Additions Update: %s\n", mLineStdOut.c_str())); 2490 if (mLineStdErr.isNotEmpty()) 2491 LogRel(("Guest Additions Update: %s\n", mLineStdErr.c_str())); 2492 } 2493 2494 /** 2495 * Callback implementation to output guest update process stdout / stderr output to the release log. 2496 * Only complete lines will be logged for cosmetic reasons. 2497 * 2498 * @returns VBox status code. 2499 * @param uHandle Process output handle. 2500 * @param pbData Pointer to data. 2501 * @param cbData Size (in bytes) of \a pbData. 2502 * 2503 * @note Only stdout (handle ID 1) and stderr (handle ID 2) are implemented. 2504 */ 2505 int UpdateAdditionsProcess::onOutputCallback(uint32_t uHandle, const BYTE *pbData, size_t cbData) 2506 { 2507 AssertReturn(RTStrValidateEncodingEx((const char *)pbData, cbData, RTSTR_VALIDATE_ENCODING_EXACT_LENGTH 2508 | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED), 2509 VERR_INVALID_PARAMETER); 2510 2511 Utf8Str *pstrLine = NULL; 2512 2513 switch (uHandle) 2514 { 2515 case GUEST_PROC_OUT_H_STDOUT: 2516 pstrLine = &mLineStdOut; 2517 break; 2518 2519 case GUEST_PROC_OUT_H_STDERR: 2520 pstrLine = &mLineStdErr; 2521 break; 2522 2523 default: 2524 /* Ignore. */ 2525 break; 2526 } 2527 2528 int vrc = VINF_SUCCESS; 2529 2530 if (pstrLine) 2531 { 2532 const char *cch = (const char *)pbData; 2533 while (cbData) 2534 { 2535 if (*cch == '\n') 2536 break; 2537 pstrLine->append(*cch); 2538 cch++; 2539 cbData--; 2540 } 2541 2542 if (*cch == '\n') 2543 { 2544 LogRel(("Guest Additions Update: %s\n", pstrLine->c_str())); 2545 pstrLine->setNull(); 2546 cch++; 2547 } 2548 2549 while (cbData) 2550 { 2551 pstrLine->append(*cch); 2552 cch++; 2553 cbData--; 2554 } 2555 } 2556 2557 return vrc; 2558 } 2559 2485 2560 GuestSessionTaskUpdateAdditions::GuestSessionTaskUpdateAdditions(GuestSession *pSession, 2486 2561 const Utf8Str &strSource, … … 2662 2737 LogRel(("Guest Additions Update: Running \"%s\" ...\n", procInfo.mName.c_str())); 2663 2738 2664 GuestProcessToolbox procToRun;2739 UpdateAdditionsProcess guestProc; 2665 2740 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 2666 int vrc = procToRun.init(pSession, procInfo, false /* Async */, &vrcGuest);2741 int vrc = guestProc.init(pSession, procInfo, false /* Async */, &vrcGuest); 2667 2742 if (RT_SUCCESS(vrc)) 2668 2743 { 2669 2744 if (RT_SUCCESS(vrcGuest)) 2670 vrc = procToRun.wait(GUESTPROCESSTOOL_WAIT_FLAG_NONE,&vrcGuest);2745 vrc = guestProc.wait(&vrcGuest); 2671 2746 if (RT_SUCCESS(vrc)) 2672 vrc = procToRun.getTerminationStatus();2747 vrc = guestProc.getTerminationStatus(); 2673 2748 } 2674 2749 … … 2679 2754 { 2680 2755 case VERR_GSTCTL_PROCESS_EXIT_CODE: 2756 { 2757 int32_t iExitCode; 2758 vrc = guestProc.getTerminationStatus(&iExitCode); 2759 Assert(vrc == VERR_GSTCTL_PROCESS_EXIT_CODE); 2681 2760 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, 2682 Utf8StrFmt(tr("Running update file \"%s\" on guest failed : %Rrc"),2683 procInfo.mExecutable.c_str(), procToRun.getRc()));2761 Utf8StrFmt(tr("Running update file \"%s\" on guest failed with exit code %d"), 2762 procInfo.mExecutable.c_str(), iExitCode)); 2684 2763 break; 2685 2764 2765 } 2686 2766 case VERR_GSTCTL_GUEST_ERROR: 2687 2767 setUpdateErrorMsg(VBOX_E_GSTCTL_GUEST_ERROR, tr("Running update file on guest failed"), … … 3098 3178 /* First pass: Copy over the file (first time only) + execute it to remove any 3099 3179 * existing VBox certificates. */ 3100 GuestProcessStartupInfo siCertUtilRem;3180 UpdateAdditionsStartupInfo siCertUtilRem; 3101 3181 siCertUtilRem.mName = "VirtualBox Certificate Utility, removing old VirtualBox certificates"; 3102 3182 /* The argv[0] should contain full path to the executable module */ … … 3113 3193 /* Second pass: Only execute (but don't copy) again, this time installng the 3114 3194 * recent certificates just copied over. */ 3115 GuestProcessStartupInfo siCertUtilAdd;3195 UpdateAdditionsStartupInfo siCertUtilAdd; 3116 3196 siCertUtilAdd.mName = "VirtualBox Certificate Utility, installing VirtualBox certificates"; 3117 3197 /* The argv[0] should contain full path to the executable module */ … … 3136 3216 ISOFILE_FLAG_COPY_FROM_ISO)); 3137 3217 /* The stub loader which decides which flavor to run. */ 3138 GuestProcessStartupInfo siInstaller;3218 UpdateAdditionsStartupInfo siInstaller; 3139 3219 siInstaller.mName = "VirtualBox Windows Guest Additions Installer"; 3140 3220 /* Set a running timeout of 5 minutes -- the Windows Guest Additions … … 3173 3253 strUpdateDir + "VBoxLinuxAdditions.run", ISOFILE_FLAG_COPY_FROM_ISO)); 3174 3254 3175 GuestProcessStartupInfo siInstaller;3255 UpdateAdditionsStartupInfo siInstaller; 3176 3256 siInstaller.mName = "VirtualBox Linux Guest Additions Installer"; 3177 3257 /* Set a running timeout of 5 minutes -- compiling modules and stuff for the Linux Guest Additions
Note:
See TracChangeset
for help on using the changeset viewer.