Changeset 71542 in vbox for trunk/src/VBox/Main
- Timestamp:
- Mar 28, 2018 3:20:26 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r71414 r71542 2523 2523 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2524 2524 2525 HRESULT hr = i_isReadyExternal(); 2526 if (FAILED(hr)) 2527 return hr; 2528 2525 2529 /* Close session on guest. */ 2526 2530 int rcGuest = VINF_SUCCESS; 2527 int rc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */, 2528 &rcGuest); 2531 int rc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */, &rcGuest); 2529 2532 /* On failure don't return here, instead do all the cleanup 2530 2533 * work first and then return an error. */ … … 2580 2583 return setError(E_NOTIMPL, tr("Flag(s) not yet implemented")); 2581 2584 2585 HRESULT hrc = i_isReadyExternal(); 2586 if (FAILED(hrc)) 2587 return hrc; 2588 2582 2589 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2583 2584 HRESULT hr = S_OK;2585 2590 2586 2591 try … … 2594 2599 catch(...) 2595 2600 { 2596 hr = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyFileFrom object"));2601 hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyFileFrom object")); 2597 2602 throw; 2598 2603 } 2599 2604 2600 2605 2601 hr = pTask->Init(Utf8StrFmt(tr("Copying \"%s\" from guest to \"%s\" on the host"), aSource.c_str(), aDest.c_str()));2602 if (FAILED(hr ))2606 hrc = pTask->Init(Utf8StrFmt(tr("Copying \"%s\" from guest to \"%s\" on the host"), aSource.c_str(), aDest.c_str())); 2607 if (FAILED(hrc)) 2603 2608 { 2604 2609 delete pTask; 2605 hr = setError(VBOX_E_IPRT_ERROR,2606 tr("Creating progress object for SessionTaskCopyFileFrom object failed"));2607 throw hr ;2608 } 2609 2610 hr = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER);2611 2612 if (SUCCEEDED(hr ))2610 hrc = setError(VBOX_E_IPRT_ERROR, 2611 tr("Creating progress object for SessionTaskCopyFileFrom object failed")); 2612 throw hrc; 2613 } 2614 2615 hrc = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER); 2616 2617 if (SUCCEEDED(hrc)) 2613 2618 { 2614 2619 /* Return progress to the caller. */ 2615 2620 pProgress = pTask->GetProgressObject(); 2616 hr = pProgress.queryInterfaceTo(aProgress.asOutParam());2621 hrc = pProgress.queryInterfaceTo(aProgress.asOutParam()); 2617 2622 } 2618 2623 else 2619 hr = setError(VBOX_E_IPRT_ERROR,2620 tr("Starting thread for copying file \"%s\" from guest to \"%s\" on the host failed "),2621 aSource.c_str(), aDest.c_str());2624 hrc = setError(VBOX_E_IPRT_ERROR, 2625 tr("Starting thread for copying file \"%s\" from guest to \"%s\" on the host failed "), 2626 aSource.c_str(), aDest.c_str()); 2622 2627 2623 2628 } 2624 2629 catch(std::bad_alloc &) 2625 2630 { 2626 hr = E_OUTOFMEMORY;2631 hrc = E_OUTOFMEMORY; 2627 2632 } 2628 2633 catch(HRESULT eHR) 2629 2634 { 2630 hr = eHR;2635 hrc = eHR; 2631 2636 LogFlowThisFunc(("Exception was caught in the function \n")); 2632 2637 } 2633 2638 2634 return hr ;2639 return hrc; 2635 2640 } 2636 2641 … … 2655 2660 return setError(E_NOTIMPL, tr("Flag(s) not yet implemented")); 2656 2661 2662 HRESULT hrc = i_isReadyExternal(); 2663 if (FAILED(hrc)) 2664 return hrc; 2665 2657 2666 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2658 2659 HRESULT hr = S_OK;2660 2667 2661 2668 try … … 2669 2676 catch(...) 2670 2677 { 2671 hr = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyFileTo object"));2678 hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyFileTo object")); 2672 2679 throw; 2673 2680 } 2674 2681 2675 hr = pTask->Init(Utf8StrFmt(tr("Copying \"%s\" from host to \"%s\" on the guest"), aSource.c_str(), aDest.c_str()));2676 if (FAILED(hr ))2682 hrc = pTask->Init(Utf8StrFmt(tr("Copying \"%s\" from host to \"%s\" on the guest"), aSource.c_str(), aDest.c_str())); 2683 if (FAILED(hrc)) 2677 2684 { 2678 2685 delete pTask; 2679 hr = setError(VBOX_E_IPRT_ERROR,2680 tr("Creating progress object for SessionTaskCopyFileTo object failed"));2681 throw hr ;2682 } 2683 2684 hr = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER);2685 2686 if (SUCCEEDED(hr ))2686 hrc = setError(VBOX_E_IPRT_ERROR, 2687 tr("Creating progress object for SessionTaskCopyFileTo object failed")); 2688 throw hrc; 2689 } 2690 2691 hrc = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER); 2692 2693 if (SUCCEEDED(hrc)) 2687 2694 { 2688 2695 /* Return progress to the caller. */ 2689 2696 pProgress = pTask->GetProgressObject(); 2690 hr = pProgress.queryInterfaceTo(aProgress.asOutParam());2697 hrc = pProgress.queryInterfaceTo(aProgress.asOutParam()); 2691 2698 } 2692 2699 else 2693 hr = setError(VBOX_E_IPRT_ERROR,2694 tr("Starting thread for copying file \"%s\" from host to \"%s\" on the guest failed "),2695 aSource.c_str(), aDest.c_str());2700 hrc = setError(VBOX_E_IPRT_ERROR, 2701 tr("Starting thread for copying file \"%s\" from host to \"%s\" on the guest failed "), 2702 aSource.c_str(), aDest.c_str()); 2696 2703 } 2697 2704 catch(std::bad_alloc &) 2698 2705 { 2699 hr = E_OUTOFMEMORY;2706 hrc = E_OUTOFMEMORY; 2700 2707 } 2701 2708 catch(HRESULT eHR) 2702 2709 { 2703 hr = eHR;2710 hrc = eHR; 2704 2711 LogFlowThisFunc(("Exception was caught in the function \n")); 2705 2712 } 2706 2713 2707 return hr ;2714 return hrc; 2708 2715 } 2709 2716 … … 2739 2746 } 2740 2747 2748 HRESULT hrc = i_isReadyExternal(); 2749 if (FAILED(hrc)) 2750 return hrc; 2751 2741 2752 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2742 2743 HRESULT hr = S_OK;2744 2753 2745 2754 try … … 2754 2763 catch(...) 2755 2764 { 2756 hr = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyDirFrom object"));2765 hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyDirFrom object")); 2757 2766 throw; 2758 2767 } 2759 2768 2760 hr = pTask->Init(Utf8StrFmt(tr("Copying directory \"%s\" from guest to \"%s\" on the host"),2761 aSource.c_str(), aDestination.c_str()));2762 if (FAILED(hr ))2769 hrc = pTask->Init(Utf8StrFmt(tr("Copying directory \"%s\" from guest to \"%s\" on the host"), 2770 aSource.c_str(), aDestination.c_str())); 2771 if (FAILED(hrc)) 2763 2772 { 2764 2773 delete pTask; 2765 hr = setError(VBOX_E_IPRT_ERROR,2766 tr("Creating progress object for SessionTaskCopyDirFrom object failed"));2767 throw hr ;2768 } 2769 2770 hr = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER);2771 2772 if (SUCCEEDED(hr ))2774 hrc = setError(VBOX_E_IPRT_ERROR, 2775 tr("Creating progress object for SessionTaskCopyDirFrom object failed")); 2776 throw hrc; 2777 } 2778 2779 hrc = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER); 2780 2781 if (SUCCEEDED(hrc)) 2773 2782 { 2774 2783 /* Return progress to the caller. */ 2775 2784 pProgress = pTask->GetProgressObject(); 2776 hr = pProgress.queryInterfaceTo(aProgress.asOutParam());2785 hrc = pProgress.queryInterfaceTo(aProgress.asOutParam()); 2777 2786 } 2778 2787 else 2779 hr = setError(VBOX_E_IPRT_ERROR,2780 tr("Starting thread for copying directory \"%s\" from guest to \"%s\" on the host failed"),2781 aSource.c_str(), aDestination.c_str());2788 hrc = setError(VBOX_E_IPRT_ERROR, 2789 tr("Starting thread for copying directory \"%s\" from guest to \"%s\" on the host failed"), 2790 aSource.c_str(), aDestination.c_str()); 2782 2791 } 2783 2792 catch(std::bad_alloc &) 2784 2793 { 2785 hr = E_OUTOFMEMORY;2794 hrc = E_OUTOFMEMORY; 2786 2795 } 2787 2796 catch(HRESULT eHR) 2788 2797 { 2789 hr = eHR;2798 hrc = eHR; 2790 2799 LogFlowThisFunc(("Exception was caught in the function\n")); 2791 2800 } 2792 2801 2793 return hr ;2802 return hrc; 2794 2803 } 2795 2804 … … 2821 2830 } 2822 2831 2832 HRESULT hrc = i_isReadyExternal(); 2833 if (FAILED(hrc)) 2834 return hrc; 2835 2823 2836 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2824 2825 HRESULT hr = S_OK;2826 2837 2827 2838 try … … 2836 2847 catch(...) 2837 2848 { 2838 hr = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyDirTo object"));2849 hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskCopyDirTo object")); 2839 2850 throw; 2840 2851 } 2841 2852 2842 hr = pTask->Init(Utf8StrFmt(tr("Copying directory \"%s\" from host to \"%s\" on the guest"),2843 aSource.c_str(), aDestination.c_str()));2844 if (FAILED(hr ))2853 hrc = pTask->Init(Utf8StrFmt(tr("Copying directory \"%s\" from host to \"%s\" on the guest"), 2854 aSource.c_str(), aDestination.c_str())); 2855 if (FAILED(hrc)) 2845 2856 { 2846 2857 delete pTask; 2847 hr = setError(VBOX_E_IPRT_ERROR,2848 tr("Creating progress object for SessionTaskCopyDirTo object failed"));2849 throw hr ;2850 } 2851 2852 hr = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER);2853 2854 if (SUCCEEDED(hr ))2858 hrc = setError(VBOX_E_IPRT_ERROR, 2859 tr("Creating progress object for SessionTaskCopyDirTo object failed")); 2860 throw hrc; 2861 } 2862 2863 hrc = pTask->createThreadWithType(RTTHREADTYPE_MAIN_HEAVY_WORKER); 2864 2865 if (SUCCEEDED(hrc)) 2855 2866 { 2856 2867 /* Return progress to the caller. */ 2857 2868 pProgress = pTask->GetProgressObject(); 2858 hr = pProgress.queryInterfaceTo(aProgress.asOutParam());2869 hrc = pProgress.queryInterfaceTo(aProgress.asOutParam()); 2859 2870 } 2860 2871 else 2861 hr = setError(VBOX_E_IPRT_ERROR,2862 tr("Starting thread for copying directory \"%s\" from host to \"%s\" on the guest failed"),2863 aSource.c_str(), aDestination.c_str());2872 hrc = setError(VBOX_E_IPRT_ERROR, 2873 tr("Starting thread for copying directory \"%s\" from host to \"%s\" on the guest failed"), 2874 aSource.c_str(), aDestination.c_str()); 2864 2875 } 2865 2876 catch(std::bad_alloc &) 2866 2877 { 2867 hr = E_OUTOFMEMORY;2878 hrc = E_OUTOFMEMORY; 2868 2879 } 2869 2880 catch(HRESULT eHR) 2870 2881 { 2871 hr = eHR;2882 hrc = eHR; 2872 2883 LogFlowThisFunc(("Exception was caught in the function\n")); 2873 2884 } 2874 2885 2875 return hr ;2886 return hrc; 2876 2887 } 2877 2888 … … 2895 2906 } 2896 2907 2897 HRESULT hr = S_OK; 2908 HRESULT hrc = i_isReadyExternal(); 2909 if (FAILED(hrc)) 2910 return hrc; 2898 2911 2899 2912 ComObjPtr <GuestDirectory> pDirectory; int rcGuest; … … 2903 2916 if (GuestProcess::i_isGuestError(rc)) 2904 2917 { 2905 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %s"),2906 GuestDirectory::i_guestErrorToString(rcGuest).c_str());2918 hrc = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %s"), 2919 GuestDirectory::i_guestErrorToString(rcGuest).c_str()); 2907 2920 } 2908 2921 else … … 2911 2924 { 2912 2925 case VERR_INVALID_PARAMETER: 2913 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Invalid parameters given"));2926 hrc = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Invalid parameters given")); 2914 2927 break; 2915 2928 2916 2929 case VERR_BROKEN_PIPE: 2917 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Unexpectedly aborted"));2930 hrc = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Unexpectedly aborted")); 2918 2931 break; 2919 2932 2920 2933 default: 2921 hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %Rrc"), rc);2934 hrc = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %Rrc"), rc); 2922 2935 break; 2923 2936 } … … 2925 2938 } 2926 2939 2927 return hr ;2940 return hrc; 2928 2941 } 2929 2942 … … 2939 2952 return setError(E_INVALIDARG, tr("No directory name specified")); 2940 2953 2941 HRESULT hr = S_OK; 2954 HRESULT hrc = i_isReadyExternal(); 2955 if (FAILED(hrc)) 2956 return hrc; 2942 2957 2943 2958 int rcGuest; … … 2948 2963 { 2949 2964 case VERR_GSTCTL_GUEST_ERROR: 2950 hr = GuestProcess::i_setErrorExternal(this, rcGuest);2965 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 2951 2966 break; 2952 2967 2953 2968 default: 2954 hr = setError(VBOX_E_IPRT_ERROR, tr("Temporary directory creation \"%s\" with template \"%s\" failed: %Rrc"),2955 aPath.c_str(), aTemplateName.c_str(), rc);2969 hrc = setError(VBOX_E_IPRT_ERROR, tr("Temporary directory creation \"%s\" with template \"%s\" failed: %Rrc"), 2970 aPath.c_str(), aTemplateName.c_str(), rc); 2956 2971 break; 2957 2972 } 2958 2973 } 2959 2974 2960 return hr ;2975 return hrc; 2961 2976 } 2962 2977 … … 2968 2983 return setError(E_INVALIDARG, tr("No directory to check existence for specified")); 2969 2984 2970 HRESULT hr = S_OK; 2985 HRESULT hrc = i_isReadyExternal(); 2986 if (FAILED(hrc)) 2987 return hrc; 2971 2988 2972 2989 GuestFsObjData objData; int rcGuest; … … 2986 3003 break; 2987 3004 default: 2988 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %s"),2989 aPath.c_str(), GuestProcess::i_guestErrorToString(rcGuest).c_str());3005 hrc = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %s"), 3006 aPath.c_str(), GuestProcess::i_guestErrorToString(rcGuest).c_str()); 2990 3007 break; 2991 3008 } … … 2994 3011 2995 3012 default: 2996 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %Rrc"),2997 aPath.c_str(), rc);3013 hrc = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %Rrc"), 3014 aPath.c_str(), rc); 2998 3015 break; 2999 3016 } 3000 3017 } 3001 3018 3002 return hr ;3019 return hrc; 3003 3020 } 3004 3021 … … 3023 3040 } 3024 3041 3025 HRESULT hr = S_OK; 3042 HRESULT hrc = i_isReadyExternal(); 3043 if (FAILED(hrc)) 3044 return hrc; 3026 3045 3027 3046 GuestDirectoryOpenInfo openInfo; … … 3035 3054 { 3036 3055 /* Return directory object to the caller. */ 3037 hr = pDirectory.queryInterfaceTo(aDirectory.asOutParam());3056 hrc = pDirectory.queryInterfaceTo(aDirectory.asOutParam()); 3038 3057 } 3039 3058 else … … 3042 3061 { 3043 3062 case VERR_INVALID_PARAMETER: 3044 hr = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed; invalid parameters given"),3045 aPath.c_str());3063 hrc = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed; invalid parameters given"), 3064 aPath.c_str()); 3046 3065 break; 3047 3066 3048 3067 case VERR_GSTCTL_GUEST_ERROR: 3049 hr = GuestDirectory::i_setErrorExternal(this, rcGuest);3068 hrc = GuestDirectory::i_setErrorExternal(this, rcGuest); 3050 3069 break; 3051 3070 3052 3071 default: 3053 hr = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed: %Rrc"),3054 aPath.c_str(),rc);3072 hrc = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed: %Rrc"), 3073 aPath.c_str(),rc); 3055 3074 break; 3056 3075 } 3057 3076 } 3058 3077 3059 return hr ;3078 return hrc; 3060 3079 } 3061 3080 … … 3067 3086 return setError(E_INVALIDARG, tr("No directory to remove specified")); 3068 3087 3069 HRESULT hr = i_isReadyExternal();3070 if (FAILED(hr ))3071 return hr ;3088 HRESULT hrc = i_isReadyExternal(); 3089 if (FAILED(hrc)) 3090 return hrc; 3072 3091 3073 3092 /* No flags; only remove the directory when empty. */ … … 3081 3100 { 3082 3101 case VERR_NOT_SUPPORTED: 3083 hr = setError(VBOX_E_IPRT_ERROR,3084 tr("Handling removing guest directories not supported by installed Guest Additions"));3102 hrc = setError(VBOX_E_IPRT_ERROR, 3103 tr("Handling removing guest directories not supported by installed Guest Additions")); 3085 3104 break; 3086 3105 3087 3106 case VERR_GSTCTL_GUEST_ERROR: 3088 hr = GuestDirectory::i_setErrorExternal(this, rcGuest);3107 hrc = GuestDirectory::i_setErrorExternal(this, rcGuest); 3089 3108 break; 3090 3109 3091 3110 default: 3092 hr = setError(VBOX_E_IPRT_ERROR, tr("Removing guest directory \"%s\" failed: %Rrc"),3093 aPath.c_str(), vrc);3111 hrc = setError(VBOX_E_IPRT_ERROR, tr("Removing guest directory \"%s\" failed: %Rrc"), 3112 aPath.c_str(), vrc); 3094 3113 break; 3095 3114 } 3096 3115 } 3097 3116 3098 return hr ;3117 return hrc; 3099 3118 } 3100 3119 … … 3111 3130 * further down!! */ 3112 3131 3113 HRESULT hr = i_isReadyExternal();3114 if (FAILED(hr ))3115 return hr ;3132 HRESULT hrc = i_isReadyExternal(); 3133 if (FAILED(hrc)) 3134 return hrc; 3116 3135 3117 3136 ComObjPtr<Progress> pProgress; 3118 hr = pProgress.createObject();3119 if (SUCCEEDED(hr ))3120 hr = pProgress->init(static_cast<IGuestSession *>(this),3121 Bstr(tr("Removing guest directory")).raw(),3122 TRUE /*aCancelable*/);3123 if (FAILED(hr ))3124 return hr ;3137 hrc = pProgress.createObject(); 3138 if (SUCCEEDED(hrc)) 3139 hrc = pProgress->init(static_cast<IGuestSession *>(this), 3140 Bstr(tr("Removing guest directory")).raw(), 3141 TRUE /*aCancelable*/); 3142 if (FAILED(hrc)) 3143 return hrc; 3125 3144 3126 3145 /* Note: At the moment we don't supply progress information while … … 3128 3147 * the progress object right now. */ 3129 3148 /** @todo Implement progress reporting on guest directory deletion! */ 3130 hr = pProgress->i_notifyComplete(S_OK);3131 if (FAILED(hr ))3132 return hr ;3149 hrc = pProgress->i_notifyComplete(S_OK); 3150 if (FAILED(hrc)) 3151 return hrc; 3133 3152 3134 3153 /* Remove the directory + all its contents. */ … … 3142 3161 { 3143 3162 case VERR_NOT_SUPPORTED: 3144 hr = setError(VBOX_E_IPRT_ERROR,3163 hrc = setError(VBOX_E_IPRT_ERROR, 3145 3164 tr("Handling removing guest directories recursively not supported by installed Guest Additions")); 3146 3165 break; 3147 3166 3148 3167 case VERR_GSTCTL_GUEST_ERROR: 3149 hr = GuestFile::i_setErrorExternal(this, rcGuest);3168 hrc = GuestFile::i_setErrorExternal(this, rcGuest); 3150 3169 break; 3151 3170 3152 3171 default: 3153 hr = setError(VBOX_E_IPRT_ERROR, tr("Recursively removing guest directory \"%s\" failed: %Rrc"),3154 aPath.c_str(), vrc);3172 hrc = setError(VBOX_E_IPRT_ERROR, tr("Recursively removing guest directory \"%s\" failed: %Rrc"), 3173 aPath.c_str(), vrc); 3155 3174 break; 3156 3175 } … … 3161 3180 } 3162 3181 3163 return hr ;3182 return hrc; 3164 3183 } 3165 3184 … … 3294 3313 } 3295 3314 3315 HRESULT hrc = i_isReadyExternal(); 3316 if (FAILED(hrc)) 3317 return hrc; 3318 3296 3319 GuestFsObjData objData; int rcGuest; 3297 3320 int vrc = i_fileQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); … … 3302 3325 } 3303 3326 3304 HRESULT hr = S_OK;3305 3306 3327 switch (vrc) 3307 3328 { 3308 3329 case VERR_GSTCTL_GUEST_ERROR: 3309 hr = GuestProcess::i_setErrorExternal(this, rcGuest);3330 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3310 3331 break; 3311 3332 … … 3317 3338 3318 3339 default: 3319 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file information for \"%s\" failed: %Rrc"),3320 aPath.c_str(), vrc);3340 hrc = setError(VBOX_E_IPRT_ERROR, tr("Querying file information for \"%s\" failed: %Rrc"), 3341 aPath.c_str(), vrc); 3321 3342 break; 3322 3343 } 3323 3344 3324 return hr ;3345 return hrc; 3325 3346 } 3326 3347 … … 3342 3363 return setError(E_INVALIDARG, tr("No file to open specified")); 3343 3364 3344 HRESULT hr = i_isReadyExternal();3345 if (FAILED(hr ))3346 return hr ;3365 HRESULT hrc = i_isReadyExternal(); 3366 if (FAILED(hrc)) 3367 return hrc; 3347 3368 3348 3369 GuestFileOpenInfo openInfo; … … 3411 3432 if (RT_SUCCESS(vrc)) 3412 3433 /* Return directory object to the caller. */ 3413 hr = pFile.queryInterfaceTo(aFile.asOutParam());3434 hrc = pFile.queryInterfaceTo(aFile.asOutParam()); 3414 3435 else 3415 3436 { … … 3417 3438 { 3418 3439 case VERR_NOT_SUPPORTED: 3419 hr = setError(VBOX_E_IPRT_ERROR,3440 hrc = setError(VBOX_E_IPRT_ERROR, 3420 3441 tr("Handling guest files not supported by installed Guest Additions")); 3421 3442 break; 3422 3443 3423 3444 case VERR_GSTCTL_GUEST_ERROR: 3424 hr = GuestFile::i_setErrorExternal(this, rcGuest);3445 hrc = GuestFile::i_setErrorExternal(this, rcGuest); 3425 3446 break; 3426 3447 3427 3448 default: 3428 hr = setError(VBOX_E_IPRT_ERROR, tr("Opening guest file \"%s\" failed: %Rrc"),3449 hrc = setError(VBOX_E_IPRT_ERROR, tr("Opening guest file \"%s\" failed: %Rrc"), 3429 3450 aPath.c_str(), vrc); 3430 3451 break; … … 3432 3453 } 3433 3454 3434 return hr ;3455 return hrc; 3435 3456 } 3436 3457 … … 3440 3461 return setError(E_INVALIDARG, tr("No path specified")); 3441 3462 3442 HRESULT hr = S_OK; 3463 HRESULT hrc = i_isReadyExternal(); 3464 if (FAILED(hrc)) 3465 return hrc; 3443 3466 3444 3467 int64_t llSize; int rcGuest; … … 3452 3475 if (GuestProcess::i_isGuestError(vrc)) 3453 3476 { 3454 hr = GuestProcess::i_setErrorExternal(this, rcGuest);3477 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3455 3478 } 3456 3479 else 3457 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file size failed: %Rrc"), vrc);3458 } 3459 3460 return hr ;3480 hrc = setError(VBOX_E_IPRT_ERROR, tr("Querying file size failed: %Rrc"), vrc); 3481 } 3482 3483 return hrc; 3461 3484 } 3462 3485 … … 3466 3489 return setError(E_INVALIDARG, tr("No path specified")); 3467 3490 3491 HRESULT hrc = i_isReadyExternal(); 3492 if (FAILED(hrc)) 3493 return hrc; 3494 3468 3495 LogFlowThisFunc(("aPath=%s, aFollowSymlinks=%RTbool\n", aPath.c_str(), RT_BOOL(aFollowSymlinks))); 3469 3470 HRESULT hrc = S_OK;3471 3496 3472 3497 *aExists = false; … … 3505 3530 return setError(E_INVALIDARG, tr("No path specified")); 3506 3531 3532 HRESULT hrc = i_isReadyExternal(); 3533 if (FAILED(hrc)) 3534 return hrc; 3535 3507 3536 LogFlowThisFunc(("aPath=%s, aFollowSymlinks=%RTbool\n", aPath.c_str(), RT_BOOL(aFollowSymlinks))); 3508 3509 HRESULT hrc = S_OK;3510 3537 3511 3538 GuestFsObjData Info; int rcGuest; … … 3542 3569 return setError(E_INVALIDARG, tr("No path specified")); 3543 3570 3571 HRESULT hrc = i_isReadyExternal(); 3572 if (FAILED(hrc)) 3573 return hrc; 3574 3544 3575 LogFlowThisFunc(("aPath=%s\n", aPath.c_str())); 3545 3546 HRESULT hrc = S_OK;3547 3576 3548 3577 int rcGuest; … … 3573 3602 LogFlowThisFunc(("aSource=%s, aDestination=%s\n", aSource.c_str(), aDestination.c_str())); 3574 3603 3575 HRESULT hr = i_isReadyExternal();3576 if (FAILED(hr ))3577 return hr ;3604 HRESULT hrc = i_isReadyExternal(); 3605 if (FAILED(hrc)) 3606 return hrc; 3578 3607 3579 3608 /* Combine, validate and convert flags. */ … … 3600 3629 { 3601 3630 case VERR_NOT_SUPPORTED: 3602 hr = setError(VBOX_E_IPRT_ERROR,3631 hrc = setError(VBOX_E_IPRT_ERROR, 3603 3632 tr("Handling renaming guest directories not supported by installed Guest Additions")); 3604 3633 break; 3605 3634 3606 3635 case VERR_GSTCTL_GUEST_ERROR: 3607 hr = setError(VBOX_E_IPRT_ERROR,3636 hrc = setError(VBOX_E_IPRT_ERROR, 3608 3637 tr("Renaming guest directory failed: %Rrc"), rcGuest); 3609 3638 break; 3610 3639 3611 3640 default: 3612 hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"),3613 aSource.c_str(), vrc);3641 hrc = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"), 3642 aSource.c_str(), vrc); 3614 3643 break; 3615 3644 } 3616 3645 } 3617 3646 3618 return hr ;3647 return hrc; 3619 3648 } 3620 3649 … … 3802 3831 LogFlowThisFuncEnter(); 3803 3832 3833 HRESULT hrc = i_isReadyExternal(); 3834 if (FAILED(hrc)) 3835 return hrc; 3836 3804 3837 /* 3805 3838 * Note: Do not hold any locks here while waiting! 3806 3839 */ 3807 HRESULT hr = S_OK;3808 3809 3840 int rcGuest; GuestSessionWaitResult_T waitResult; 3810 3841 int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &rcGuest); … … 3816 3847 { 3817 3848 case VERR_GSTCTL_GUEST_ERROR: 3818 hr = GuestSession::i_setErrorExternal(this, rcGuest);3849 hrc = GuestSession::i_setErrorExternal(this, rcGuest); 3819 3850 break; 3820 3851 … … 3826 3857 { 3827 3858 const char *pszSessionName = mData.mSession.mName.c_str(); 3828 hr = setError(VBOX_E_IPRT_ERROR,3829 tr("Waiting for guest session \"%s\" failed: %Rrc"),3830 pszSessionName ? pszSessionName : tr("Unnamed"), vrc);3859 hrc = setError(VBOX_E_IPRT_ERROR, 3860 tr("Waiting for guest session \"%s\" failed: %Rrc"), 3861 pszSessionName ? pszSessionName : tr("Unnamed"), vrc); 3831 3862 break; 3832 3863 } … … 3835 3866 3836 3867 LogFlowFuncLeaveRC(vrc); 3837 return hr ;3868 return hrc; 3838 3869 } 3839 3870 … … 3842 3873 { 3843 3874 LogFlowThisFuncEnter(); 3875 3876 HRESULT hrc = i_isReadyExternal(); 3877 if (FAILED(hrc)) 3878 return hrc; 3844 3879 3845 3880 /*
Note:
See TracChangeset
for help on using the changeset viewer.