Changeset 47491 in vbox for trunk/src/VBox
- Timestamp:
- Jul 31, 2013 1:25:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r47325 r47491 829 829 } 830 830 831 Assert(sessionWaitResult == GuestSessionWaitResult_Start); 831 Assert( sessionWaitResult == GuestSessionWaitResult_Start 832 /* Note: This might happen when Guest Additions < 4.3 are installed which don't 833 * support dedicated guest sessions. */ 834 || sessionWaitResult == GuestSessionWaitResult_WaitFlagNotSupported); 832 835 if (fVerbose) 833 836 RTPrintf("Guest session has been started\n"); … … 910 913 /* Just print plain PID to make it easier for scripts 911 914 * invoking VBoxManage. */ 912 RTPrintf("% ul\n", uPID);915 RTPrintf("%ld\n", uPID); 913 916 } 914 917 … … 1014 1017 } while (0); 1015 1018 1016 if (fVerbose) 1017 RTPrintf("Closing guest session ...\n"); 1018 rc = pGuestSession->Close(); 1019 if (FAILED(rc)) 1020 { 1021 ctrlPrintError(pGuestSession, COM_IIDOF(ISession)); 1022 1023 if (rcExit == RTEXITCODE_SUCCESS) 1024 rcExit = RTEXITCODE_FAILURE; 1025 } 1019 /* 1020 * Only close the guest session if we waited for the guest 1021 * process to exit. Otherwise we wouldn't have any chance to 1022 * access and/or kill detached guest process lateron. 1023 */ 1024 if (fWaitForExit) 1025 { 1026 if (fVerbose) 1027 RTPrintf("Closing guest session ...\n"); 1028 rc = pGuestSession->Close(); 1029 if (FAILED(rc)) 1030 { 1031 ctrlPrintError(pGuestSession, COM_IIDOF(ISession)); 1032 1033 if (rcExit == RTEXITCODE_SUCCESS) 1034 rcExit = RTEXITCODE_FAILURE; 1035 } 1036 } 1037 else if (fVerbose) 1038 RTPrintf("Guest session detached\n"); 1026 1039 1027 1040 return rcExit; … … 2813 2826 || fListSessions) 2814 2827 { 2815 RTPrintf("Active guest sessions:\n");2816 2817 2828 HRESULT rc; 2818 2829 do … … 2822 2833 SafeIfaceArray <IGuestSession> collSessions; 2823 2834 CHECK_ERROR_BREAK(guest, COMGETTER(Sessions)(ComSafeArrayAsOutParam(collSessions))); 2824 for (size_t i = 0; i < collSessions.size(); i++) 2825 { 2826 ComPtr<IGuestSession> pCurSession = collSessions[i]; 2827 if (!pCurSession.isNull()) 2835 size_t cSessions = collSessions.size(); 2836 2837 if (cSessions) 2838 { 2839 RTPrintf("Active guest sessions:\n"); 2840 2841 /** @todo Make this output a bit prettier. No time now. */ 2842 2843 for (size_t i = 0; i < cSessions; i++) 2828 2844 { 2829 Bstr strName; 2830 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Name)(strName.asOutParam())); 2831 Bstr strUser; 2832 CHECK_ERROR_BREAK(pCurSession, COMGETTER(User)(strUser.asOutParam())); 2833 ULONG uID; 2834 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Id)(&uID)); 2835 2836 RTPrintf("\n\tSession #%zu: ID=%RU32, User=%ls, Name=%ls", 2837 i, uID, strUser.raw(), strName.raw()); 2838 2839 if ( fListAll 2840 || fListProcesses) 2845 ComPtr<IGuestSession> pCurSession = collSessions[i]; 2846 if (!pCurSession.isNull()) 2841 2847 { 2842 SafeIfaceArray <IGuestProcess> collProcesses; 2843 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Processes)(ComSafeArrayAsOutParam(collProcesses))); 2844 for (size_t a = 0; a < collProcesses.size(); a++) 2848 Bstr strName; 2849 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Name)(strName.asOutParam())); 2850 Bstr strUser; 2851 CHECK_ERROR_BREAK(pCurSession, COMGETTER(User)(strUser.asOutParam())); 2852 ULONG uID; 2853 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Id)(&uID)); 2854 2855 RTPrintf("\n\tSession #%-3zu ID=%-3RU32 User=%-16ls Name=%ls", 2856 i, uID, strUser.raw(), strName.raw()); 2857 2858 if ( fListAll 2859 || fListProcesses) 2845 2860 { 2846 ComPtr<IGuestProcess> pCurProcess = collProcesses[a]; 2847 if (!pCurProcess.isNull()) 2861 SafeIfaceArray <IGuestProcess> collProcesses; 2862 CHECK_ERROR_BREAK(pCurSession, COMGETTER(Processes)(ComSafeArrayAsOutParam(collProcesses))); 2863 for (size_t a = 0; a < collProcesses.size(); a++) 2848 2864 { 2849 ULONG uPID; 2850 CHECK_ERROR_BREAK(pCurProcess, COMGETTER(PID)(&uPID)); 2851 Bstr strExecPath; 2852 CHECK_ERROR_BREAK(pCurProcess, COMGETTER(ExecutablePath)(strExecPath.asOutParam())); 2853 2854 RTPrintf("\n\t\tProcess #%zu: PID=%RU32, CmdLine=%ls", 2855 i, uPID, strExecPath.raw()); 2865 ComPtr<IGuestProcess> pCurProcess = collProcesses[a]; 2866 if (!pCurProcess.isNull()) 2867 { 2868 ULONG uPID; 2869 CHECK_ERROR_BREAK(pCurProcess, COMGETTER(PID)(&uPID)); 2870 Bstr strExecPath; 2871 CHECK_ERROR_BREAK(pCurProcess, COMGETTER(ExecutablePath)(strExecPath.asOutParam())); 2872 ProcessStatus_T status; 2873 CHECK_ERROR_BREAK(pCurProcess, COMGETTER(Status)(&status)); 2874 2875 RTPrintf("\n\t\tProcess #%-03zu PID=%-6RU32 Status=[%s] Command=%ls", 2876 a, uPID, ctrlExecProcessStatusToText(status), strExecPath.raw()); 2877 } 2856 2878 } 2879 2880 cTotalProcs += collProcesses.size(); 2857 2881 } 2858 2859 cTotalProcs += collProcesses.size();2860 2882 } 2861 2883 } 2862 } 2863 2864 RTPrintf("\n\nTotal guest sessions: %zu", collSessions.size()); 2865 RTPrintf("\n\nTotal guest processes: %zu", cTotalProcs); 2884 2885 RTPrintf("\n\nTotal guest sessions: %zu\n", collSessions.size()); 2886 RTPrintf("Total guest processes: %zu\n", cTotalProcs); 2887 } 2888 else 2889 RTPrintf("No active guest sessions found\n"); 2866 2890 2867 2891 } while (0);
Note:
See TracChangeset
for help on using the changeset viewer.