- Timestamp:
- Jul 9, 2018 11:09:32 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123555
- Location:
- trunk/src/VBox/Main
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r70766 r73003 257 257 258 258 static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...); 259 static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *pcsz, ...); 259 260 HRESULT i_setInvalidMachineStateError(); 260 261 -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r69783 r73003 352 352 BOOL *aResult); 353 353 354 static HRESULT i_setErrorStatic(HRESULT aResultCode, 355 const Utf8Str &aText) 354 static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const Utf8Str &aText) 356 355 { 357 return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true );356 return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true, vrc); 358 357 } 359 358 -
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r69753 r73003 572 572 { 573 573 if (vrc != VERR_EOF) 574 hrc = setError (VBOX_E_IPRT_ERROR, tr("RTVfsFsStrmNext failed: %Rrc"), vrc);574 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("RTVfsFsStrmNext failed: %Rrc"), vrc); 575 575 else 576 hrc = setError (E_UNEXPECTED, tr("'%s' was found in the manifest but not in the tarball"), szName);576 hrc = setErrorBoth(E_UNEXPECTED, vrc, tr("'%s' was found in the manifest but not in the tarball"), szName); 577 577 break; 578 578 } … … 608 608 } 609 609 else 610 hrc = setError (VBOX_E_IPRT_ERROR,611 tr("The license file '%s' is empty or contains invalid UTF-8 encoding"),612 szName);610 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 611 tr("The license file '%s' is empty or contains invalid UTF-8 encoding"), 612 szName); 613 613 } 614 614 else 615 hrc = setError (VBOX_E_IPRT_ERROR, tr("Failed to read '%s': %Rrc"), szName, vrc);615 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to read '%s': %Rrc"), szName, vrc); 616 616 RTMemFree(pvFile); 617 617 } … … 620 620 } 621 621 else 622 hrc = setError (VBOX_E_IPRT_ERROR, tr("RTVfsIoStrmQueryInfo on '%s': %Rrc"), szName, vrc);622 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("RTVfsIoStrmQueryInfo on '%s': %Rrc"), szName, vrc); 623 623 RTVfsIoStrmRelease(hVfsIos); 624 624 break; 625 625 } 626 626 … … 634 634 hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s"), szError); 635 635 } 636 636 else 637 637 hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in '%s'"), 638 638 szName, m->strExtPackFile.c_str()); 639 639 } 640 640 return hrc; … … 872 872 LogRel(("ExtPack pfnUninstall returned %Rrc for %s\n", vrc, m->Desc.strName.c_str())); 873 873 if (!a_fForcedRemoval) 874 hrc = setError (E_FAIL, tr("pfnUninstall returned %Rrc"), vrc);874 hrc = setErrorBoth(E_FAIL, vrc, tr("pfnUninstall returned %Rrc"), vrc); 875 875 } 876 876 } … … 1870 1870 } 1871 1871 else if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND) 1872 hrc = setError (VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in extension pack '%s'"),1873 szName, m->Desc.strName.c_str());1872 hrc = setErrorBoth(VBOX_E_OBJECT_NOT_FOUND, vrc, tr("The license file '%s' was not found in extension pack '%s'"), 1873 szName, m->Desc.strName.c_str()); 1874 1874 else 1875 hrc = setError (VBOX_E_FILE_ERROR, tr("Failed to open the license file '%s': %Rrc"), szPath, vrc);1875 hrc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Failed to open the license file '%s': %Rrc"), szPath, vrc); 1876 1876 } 1877 1877 else 1878 hrc = setError (VBOX_E_IPRT_ERROR, tr("RTPathJoin failed: %Rrc"), vrc);1878 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("RTPathJoin failed: %Rrc"), vrc); 1879 1879 } 1880 1880 return hrc; … … 2132 2132 else 2133 2133 hrc = setError(VBOX_E_IPRT_ERROR, 2134 tr("Starting thread for an extension pack uninstallation failed with %Rrc"), hrc);2134 tr("Starting thread for an extension pack uninstallation failed with %Rrc"), hrc); 2135 2135 } 2136 2136 else 2137 hrc = setError(VBOX_E_IPRT_ERROR, 2138 tr("Looks like creating a progress object for ExtraPackUninstallTask object failed")); 2137 hrc = setError(hrc, tr("Looks like creating a progress object for ExtraPackUninstallTask object failed")); 2139 2138 } 2140 2139 catch (std::bad_alloc &) … … 2415 2414 } 2416 2415 else 2417 hrc = setError (VBOX_E_IPRT_ERROR, tr("Failed to launch the helper application '%s' (%Rrc)"), szExecName, vrc);2416 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to launch the helper application '%s' (%Rrc)"), szExecName, vrc); 2418 2417 2419 2418 RTPipeClose(hPipeR); … … 2741 2740 "--forced", 2742 2741 (const char *)NULL); 2743 hrc = setError (E_FAIL, tr("The installation hook failed: %Rrc - %s"),2744 ErrInfo.Core.rc, ErrInfo.Core.pszMsg);2742 hrc = setErrorBoth(E_FAIL, ErrInfo.Core.rc, tr("The installation hook failed: %Rrc - %s"), 2743 ErrInfo.Core.rc, ErrInfo.Core.pszMsg); 2745 2744 } 2746 2745 } -
trunk/src/VBox/Main/src-all/ProgressImpl.cpp
r69500 r73003 708 708 709 709 if (!mCompleted) 710 return setError(E_FAIL, 711 tr("Result code is not available, operation is still in progress")); 710 return setError(E_FAIL, tr("Result code is not available, operation is still in progress")); 712 711 713 712 *aResultCode = mResultCode; … … 721 720 722 721 if (!mCompleted) 723 return setError(E_FAIL, 724 tr("Error info is not available, operation is still in progress")); 722 return setError(E_FAIL, tr("Error info is not available, operation is still in progress")); 725 723 726 724 mErrorInfo.queryInterfaceTo(aErrorInfo.asOutParam()); … … 791 789 792 790 if (!mCancelable) 793 return setError(VBOX_E_INVALID_OBJECT_STATE, 794 tr("Operation cannot be canceled")); 791 return setError(VBOX_E_INVALID_OBJECT_STATE, tr("Operation cannot be canceled")); 795 792 m_cMsTimeout = aTimeout; 796 793 … … 915 912 916 913 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 917 return setError(VBOX_E_IPRT_ERROR, 918 tr("Failed to wait for the task completion (%Rrc)"), 919 vrc); 914 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to wait for the task completion (%Rrc)"), vrc); 920 915 } 921 916 … … 977 972 978 973 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 979 return setError(E_FAIL, 980 tr("Failed to wait for the operation completion (%Rrc)"), 981 vrc); 974 return setErrorBoth(E_FAIL, vrc, tr("Failed to wait for the operation completion (%Rrc)"), vrc); 982 975 } 983 976 … … 1076 1069 1077 1070 if (!mCancelable) 1078 return setError(VBOX_E_INVALID_OBJECT_STATE, 1079 tr("Operation cannot be canceled")); 1071 return setError(VBOX_E_INVALID_OBJECT_STATE, tr("Operation cannot be canceled")); 1080 1072 1081 1073 if (!mCanceled) -
trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp
r69500 r73003 280 280 sizeof (hostPathFull)); 281 281 if (RT_FAILURE(vrc)) 282 return setError(E_INVALIDARG, 283 tr("Invalid shared folder path: '%s' (%Rrc)"), 284 hostPath.c_str(), vrc); 282 return setErrorBoth(E_INVALIDARG, vrc, tr("Invalid shared folder path: '%s' (%Rrc)"), hostPath.c_str(), vrc); 285 283 286 284 if (RTPathCompare(hostPath.c_str(), hostPathFull) != 0) 287 return setError(E_INVALIDARG, 288 tr("Shared folder path '%s' is not absolute"), 289 hostPath.c_str()); 285 return setError(E_INVALIDARG, tr("Shared folder path '%s' is not absolute"), hostPath.c_str()); 290 286 } 291 287 -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r72980 r73003 1586 1586 1587 1587 if (RT_FAILURE(vrc)) 1588 rc = setError (VBOX_E_FILE_ERROR,1589 tr("The saved state file '%ls' is invalid (%Rrc). Delete the saved state and try again"),1590 savedStateFile.raw(), vrc);1588 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, 1589 tr("The saved state file '%ls' is invalid (%Rrc). Delete the saved state and try again"), 1590 savedStateFile.raw(), vrc); 1591 1591 1592 1592 mSavedStateDataLoaded = true; … … 1837 1837 Utf8Buf.jolt(); 1838 1838 if (parm[2].type != VBOX_HGCM_SVC_PARM_32BIT) 1839 return setError (E_FAIL, tr("Internal application error"));1839 return setErrorBoth(E_FAIL, vrc, tr("Internal application error")); 1840 1840 cchBuf = parm[2].u.uint32; 1841 1841 } 1842 if (VERR_BUFFER_OVERFLOW == vrc) 1843 return setError(E_UNEXPECTED, 1844 tr("Temporary failure due to guest activity, please retry")); 1842 if (vrc == VERR_BUFFER_OVERFLOW) 1843 return setError(E_UNEXPECTED, tr("Temporary failure due to guest activity, please retry")); 1845 1844 1846 1845 /* … … 2214 2213 { 2215 2214 delete task; 2216 rc = setError(E_FAIL, "Could not create VMPowerDownTask object 2215 rc = setError(E_FAIL, "Could not create VMPowerDownTask object\n"); 2217 2216 break; 2218 2217 } … … 2272 2271 int vrc = VMR3Reset(ptrVM.rawUVM()); 2273 2272 2274 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : 2275 setError(VBOX_E_VM_ERROR, 2276 tr("Could not reset the machine (%Rrc)"), 2277 vrc); 2273 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not reset the machine (%Rrc)"), vrc); 2278 2274 2279 2275 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); … … 2388 2384 } 2389 2385 else 2390 rc = setError(VBOX_E_VM_ERROR, 2391 tr("Hot-Remove failed (rc=%Rrc)"), vrc); 2386 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Hot-Remove failed (rc=%Rrc)"), vrc); 2392 2387 } 2393 2388 else 2394 rc = setError (VBOX_E_VM_ERROR,2395 tr("Hot-Remove was aborted because the CPU may still be used by the guest"), VERR_RESOURCE_BUSY);2389 rc = setErrorBoth(VBOX_E_VM_ERROR, VERR_RESOURCE_BUSY, 2390 tr("Hot-Remove was aborted because the CPU may still be used by the guest"), VERR_RESOURCE_BUSY); 2396 2391 2397 2392 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); … … 2499 2494 } 2500 2495 else 2501 rc = setError(VBOX_E_VM_ERROR, 2502 tr("Could not add CPU to the machine (%Rrc)"), 2503 vrc); 2496 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not add CPU to the machine (%Rrc)"), vrc); 2504 2497 2505 2498 LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc)); … … 2569 2562 } 2570 2563 2571 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : 2572 setError(VBOX_E_PDM_ERROR, 2573 tr("Controlled power off failed (%Rrc)"), 2574 vrc); 2564 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Controlled power off failed (%Rrc)"), vrc); 2575 2565 2576 2566 LogFlowThisFunc(("rc=%Rhrc\n", rc)); … … 2618 2608 } 2619 2609 2620 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : 2621 setError(VBOX_E_PDM_ERROR, 2622 tr("Checking if the ACPI Power Button event was handled by the guest OS failed (%Rrc)"), 2623 vrc); 2610 HRESULT rc = RT_SUCCESS(vrc) ? S_OK 2611 : setErrorBoth(VBOX_E_PDM_ERROR, vrc, 2612 tr("Checking if the ACPI Power Button event was handled by the guest OS failed (%Rrc)"), vrc); 2624 2613 2625 2614 LogFlowThisFunc(("rc=%Rhrc\n", rc)); … … 2641 2630 ) 2642 2631 return setError(VBOX_E_INVALID_VM_STATE, 2643 tr("Invalid machine state %s when checking if the guest entered the ACPI mode)"),2644 Global::stringifyMachineState(mMachineState));2632 tr("Invalid machine state %s when checking if the guest entered the ACPI mode)"), 2633 Global::stringifyMachineState(mMachineState)); 2645 2634 2646 2635 /* get the VM handle. */ … … 2704 2693 } 2705 2694 2706 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : 2707 setError(VBOX_E_PDM_ERROR, 2708 tr("Sending sleep button event failed (%Rrc)"), 2709 vrc); 2695 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Sending sleep button event failed (%Rrc)"), vrc); 2710 2696 2711 2697 LogFlowThisFunc(("rc=%Rhrc\n", rc)); … … 2778 2764 2779 2765 default: 2780 return setError(E_INVALIDARG, 2781 tr("Invalid device type: %d"), 2782 aType[iType]); 2766 return setError(E_INVALIDARG, tr("Invalid device type: %d"), aType[iType]); 2783 2767 } 2784 2768 … … 2810 2794 && mMachineState != MachineState_Paused) 2811 2795 return setError(VBOX_E_INVALID_VM_STATE, 2812 tr("Cannot attach a USB device to the machine which is not running or paused (machine state: %s)"),2813 Global::stringifyMachineState(mMachineState));2796 tr("Cannot attach a USB device to the machine which is not running or paused (machine state: %s)"), 2797 Global::stringifyMachineState(mMachineState)); 2814 2798 2815 2799 /* Get the VM handle. */ … … 2820 2804 /* Don't proceed unless we have a USB controller. */ 2821 2805 if (!mfVMHasUsbController) 2822 return setError(VBOX_E_PDM_ERROR, 2823 tr("The virtual machine does not have a USB controller")); 2806 return setError(VBOX_E_PDM_ERROR, tr("The virtual machine does not have a USB controller")); 2824 2807 2825 2808 /* release the lock because the USB Proxy service may call us back … … 2831 2814 2832 2815 #else /* !VBOX_WITH_USB */ 2833 return setError(VBOX_E_PDM_ERROR, 2834 tr("The virtual machine does not have a USB controller")); 2816 return setError(VBOX_E_PDM_ERROR, tr("The virtual machine does not have a USB controller")); 2835 2817 #endif /* !VBOX_WITH_USB */ 2836 2818 } … … 2857 2839 2858 2840 if (!pUSBDevice) 2859 return setError(E_INVALIDARG, 2860 tr("USB device with UUID {%RTuuid} is not attached to this machine"), 2861 aId.raw()); 2841 return setError(E_INVALIDARG, tr("USB device with UUID {%RTuuid} is not attached to this machine"), aId.raw()); 2862 2842 2863 2843 /* Remove the device from the collection, it is re-added below for failures */ … … 2896 2876 2897 2877 #else /* !VBOX_WITH_USB */ 2898 return setError(VBOX_E_PDM_ERROR, 2899 tr("The virtual machine does not have a USB controller")); 2878 return setError(VBOX_E_PDM_ERROR, tr("The virtual machine does not have a USB controller")); 2900 2879 #endif /* !VBOX_WITH_USB */ 2901 2880 } … … 2926 2905 } 2927 2906 2928 return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND, 2929 tr("Could not find a USB device with address '%s'"), 2930 aName.c_str()); 2907 return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND, tr("Could not find a USB device with address '%s'"), aName.c_str()); 2931 2908 2932 2909 #else /* !VBOX_WITH_USB */ … … 2960 2937 } 2961 2938 2962 return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND, 2963 tr("Could not find a USB device with uuid {%RTuuid}"), 2964 Guid(aId).raw()); 2939 return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND, tr("Could not find a USB device with uuid {%RTuuid}"), Guid(aId).raw()); 2965 2940 2966 2941 #else /* !VBOX_WITH_USB */ … … 2978 2953 if (mMachineState == MachineState_Saved) 2979 2954 return setError(VBOX_E_INVALID_VM_STATE, 2980 tr("Cannot create a transient shared folder on the machine in the saved state"));2955 tr("Cannot create a transient shared folder on the machine in the saved state")); 2981 2956 if ( mMachineState != MachineState_PoweredOff 2982 2957 && mMachineState != MachineState_Teleported … … 2986 2961 ) 2987 2962 return setError(VBOX_E_INVALID_VM_STATE, 2988 tr("Cannot create a transient shared folder on the machine while it is changing the state (machine state: %s)"),2989 Global::stringifyMachineState(mMachineState));2963 tr("Cannot create a transient shared folder on the machine while it is changing the state (machine state: %s)"), 2964 Global::stringifyMachineState(mMachineState)); 2990 2965 2991 2966 ComObjPtr<SharedFolder> pSharedFolder; … … 3048 3023 if (mMachineState == MachineState_Saved) 3049 3024 return setError(VBOX_E_INVALID_VM_STATE, 3050 tr("Cannot remove a transient shared folder from the machine in the saved state"));3025 tr("Cannot remove a transient shared folder from the machine in the saved state")); 3051 3026 if ( mMachineState != MachineState_PoweredOff 3052 3027 && mMachineState != MachineState_Teleported … … 3111 3086 const uint8_t *pbKey = (const uint8_t *)aPassword.c_str(); 3112 3087 3113 int rc = m_pKeyStore->addSecretKey(aId, pbKey, cbKey);3114 if (RT_SUCCESS( rc))3088 int vrc = m_pKeyStore->addSecretKey(aId, pbKey, cbKey); 3089 if (RT_SUCCESS(vrc)) 3115 3090 { 3116 3091 unsigned cDisksConfigured = 0; … … 3120 3095 { 3121 3096 SecretKey *pKey = NULL; 3122 rc = m_pKeyStore->retainSecretKey(aId, &pKey);3123 AssertRCReturn( rc, E_FAIL);3097 vrc = m_pKeyStore->retainSecretKey(aId, &pKey); 3098 AssertRCReturn(vrc, E_FAIL); 3124 3099 3125 3100 pKey->setUsers(cDisksConfigured); … … 3137 3112 3138 3113 alock.release(); 3139 int vrc = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG); 3140 3141 hrc = RT_SUCCESS(vrc) ? S_OK : 3142 setError(VBOX_E_VM_ERROR, 3143 tr("Could not resume the machine execution (%Rrc)"), 3144 vrc); 3114 vrc = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG); 3115 3116 hrc = RT_SUCCESS(vrc) ? S_OK 3117 : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not resume the machine execution (%Rrc)"), vrc); 3145 3118 } 3146 3119 } 3147 3120 } 3148 else if ( rc == VERR_ALREADY_EXISTS)3149 hrc = setError (VBOX_E_OBJECT_IN_USE, tr("A password with the given ID already exists"));3150 else if ( rc == VERR_NO_MEMORY)3151 hrc = setError (E_FAIL, tr("Failed to allocate enough secure memory for the key"));3121 else if (vrc == VERR_ALREADY_EXISTS) 3122 hrc = setErrorBoth(VBOX_E_OBJECT_IN_USE, vrc, tr("A password with the given ID already exists")); 3123 else if (vrc == VERR_NO_MEMORY) 3124 hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to allocate enough secure memory for the key")); 3152 3125 else 3153 hrc = setError (E_FAIL, tr("Unknown error happened while adding a password (%Rrc)"),rc);3126 hrc = setErrorBoth(E_FAIL, vrc, tr("Unknown error happened while adding a password (%Rrc)"), vrc); 3154 3127 3155 3128 return hrc; … … 3174 3147 { 3175 3148 SecretKey *pKey = NULL; 3176 int rc = m_pKeyStore->retainSecretKey(aIds[i], &pKey);3177 if ( rc != VERR_NOT_FOUND)3149 int vrc = m_pKeyStore->retainSecretKey(aIds[i], &pKey); 3150 if (vrc != VERR_NOT_FOUND) 3178 3151 { 3179 3152 AssertPtr(pKey); … … 3215 3188 3216 3189 SecretKey *pKey = NULL; 3217 int rc = m_pKeyStore->retainSecretKey(aId, &pKey);3218 if (RT_SUCCESS( rc))3190 int vrc = m_pKeyStore->retainSecretKey(aId, &pKey); 3191 if (RT_SUCCESS(vrc)) 3219 3192 { 3220 3193 m_cDisksPwProvided -= pKey->getUsers(); 3221 3194 m_pKeyStore->releaseSecretKey(aId); 3222 rc = m_pKeyStore->deleteSecretKey(aId); 3223 AssertRCReturn(rc, E_FAIL); 3224 } 3225 else if (rc == VERR_NOT_FOUND) 3226 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("A password with the ID \"%s\" does not exist"), 3227 aId.c_str()); 3195 vrc = m_pKeyStore->deleteSecretKey(aId); 3196 AssertRCReturn(vrc, E_FAIL); 3197 } 3198 else if (vrc == VERR_NOT_FOUND) 3199 return setErrorBoth(VBOX_E_OBJECT_NOT_FOUND, vrc, tr("A password with the ID \"%s\" does not exist"), aId.c_str()); 3228 3200 else 3229 return setError(E_FAIL, tr("Failed to remove password with ID \"%s\" (%Rrc)"), 3230 aId.c_str(), rc); 3201 return setErrorBoth(E_FAIL, vrc, tr("Failed to remove password with ID \"%s\" (%Rrc)"), aId.c_str(), vrc); 3231 3202 3232 3203 return S_OK; … … 3237 3208 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3238 3209 3239 int rc = m_pKeyStore->deleteAllSecretKeys(false /* fSuspend */, false /* fForce */);3240 if ( rc == VERR_RESOURCE_IN_USE)3241 return setError (VBOX_E_OBJECT_IN_USE, tr("A password is still in use by the VM"));3242 else if (RT_FAILURE( rc))3243 return setError (E_FAIL, tr("Deleting all passwords failed (%Rrc)"));3210 int vrc = m_pKeyStore->deleteAllSecretKeys(false /* fSuspend */, false /* fForce */); 3211 if (vrc == VERR_RESOURCE_IN_USE) 3212 return setErrorBoth(VBOX_E_OBJECT_IN_USE, vrc, tr("A password is still in use by the VM")); 3213 else if (RT_FAILURE(vrc)) 3214 return setErrorBoth(E_FAIL, vrc, tr("Deleting all passwords failed (%Rrc)")); 3244 3215 3245 3216 m_cDisksPwProvided = 0; … … 3261 3232 false /* aWarning */, 3262 3233 true /* aLogIt */); 3234 va_end(args); 3235 return rc; 3236 } 3237 3238 /*static*/ 3239 HRESULT Console::i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *pcsz, ...) 3240 { 3241 va_list args; 3242 va_start(args, pcsz); 3243 HRESULT rc = setErrorInternal(aResultCode, 3244 getStaticClassIID(), 3245 getStaticComponentName(), 3246 Utf8Str(pcsz, args), 3247 false /* aWarning */, 3248 true /* aLogIt */, 3249 vrc); 3263 3250 va_end(args); 3264 3251 return rc; … … 3363 3350 if (pAlock) 3364 3351 pAlock->release(); 3365 int rc = VMR3Suspend(pUVM, VMSUSPENDREASON_RECONFIG);3352 int vrc = VMR3Suspend(pUVM, VMSUSPENDREASON_RECONFIG); 3366 3353 if (pAlock) 3367 3354 pAlock->acquire(); 3368 3355 mVMStateChangeCallbackDisabled = false; 3369 if (RT_FAILURE( rc))3356 if (RT_FAILURE(vrc)) 3370 3357 return setErrorInternal(VBOX_E_INVALID_VM_STATE, 3371 3358 COM_IIDOF(IConsole), 3372 3359 getStaticComponentName(), 3373 Utf8StrFmt("Could suspend VM for medium change (%Rrc)", rc),3360 Utf8StrFmt("Could suspend VM for medium change (%Rrc)", vrc), 3374 3361 false /*aWarning*/, 3375 true /*aLogIt*/); 3362 true /*aLogIt*/, 3363 vrc); 3376 3364 *pfResume = true; 3377 3365 break; … … 3523 3511 3524 3512 if (pMedium) 3525 return setError(E_FAIL, 3526 tr("Could not mount the media/drive '%ls' (%Rrc)"), 3527 mediumLocation.raw(), vrc); 3528 3529 return setError(E_FAIL, 3530 tr("Could not unmount the currently mounted media/drive (%Rrc)"), 3531 vrc); 3513 return setErrorBoth(E_FAIL, vrc, tr("Could not mount the media/drive '%ls' (%Rrc)"), mediumLocation.raw(), vrc); 3514 return setErrorBoth(E_FAIL, vrc, tr("Could not unmount the currently mounted media/drive (%Rrc)"), vrc); 3532 3515 } 3533 3516 … … 3701 3684 3702 3685 if (!pMedium) 3703 return setError(E_FAIL, 3704 tr("Could not mount the media/drive '%ls' (%Rrc)"), 3705 mediumLocation.raw(), vrc); 3706 3707 return setError(E_FAIL, 3708 tr("Could not unmount the currently mounted media/drive (%Rrc)"), 3709 vrc); 3686 return setErrorBoth(E_FAIL, vrc, tr("Could not mount the media/drive '%ls' (%Rrc)"), mediumLocation.raw(), vrc); 3687 return setErrorBoth(E_FAIL, vrc, tr("Could not unmount the currently mounted media/drive (%Rrc)"), vrc); 3710 3688 } 3711 3689 … … 3876 3854 3877 3855 if (!pMedium) 3878 return setError(E_FAIL, 3879 tr("Could not mount the media/drive '%ls' (%Rrc)"), 3880 mediumLocation.raw(), vrc); 3881 3882 return setError(E_FAIL, 3883 tr("Could not unmount the currently mounted media/drive (%Rrc)"), 3884 vrc); 3856 return setErrorBoth(E_FAIL, vrc, tr("Could not mount the media/drive '%ls' (%Rrc)"), mediumLocation.raw(), vrc); 3857 return setErrorBoth(E_FAIL, vrc, tr("Could not unmount the currently mounted media/drive (%Rrc)"), vrc); 3885 3858 } 3886 3859 … … 4081 4054 } 4082 4055 else if (vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND) 4083 return setError(E_FAIL, 4084 tr("The network adapter #%u is not enabled"), ulInstance); 4056 return setErrorBoth(E_FAIL, vrc, tr("The network adapter #%u is not enabled"), ulInstance); 4085 4057 else 4086 4058 ComAssertRC(vrc); … … 4667 4639 PPDMIBASE pIBase = NULL; 4668 4640 PPDMIMEDIA pIMedium = NULL; 4669 int rc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);4670 if (RT_SUCCESS( rc))4641 int vrc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase); 4642 if (RT_SUCCESS(vrc)) 4671 4643 { 4672 4644 if (pIBase) … … 4675 4647 if (!pIMedium) 4676 4648 return setError(E_FAIL, tr("could not query medium interface of controller")); 4677 else 4649 vrc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey, mpIfSecKeyHlp); 4650 if (vrc == VERR_VD_PASSWORD_INCORRECT) 4678 4651 { 4679 rc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey, mpIfSecKeyHlp); 4680 if (rc == VERR_VD_PASSWORD_INCORRECT) 4681 { 4682 hrc = setError(VBOX_E_PASSWORD_INCORRECT, tr("The provided password for ID \"%s\" is not correct for at least one disk using this ID"), 4683 strId.c_str()); 4684 break; 4685 } 4686 else if (RT_FAILURE(rc)) 4687 { 4688 hrc = setError(E_FAIL, tr("Failed to set the encryption key (%Rrc)"), rc); 4689 break; 4690 } 4691 4692 if (RT_SUCCESS(rc)) 4693 cDisksConfigured++; 4652 hrc = setError(VBOX_E_PASSWORD_INCORRECT, 4653 tr("The provided password for ID \"%s\" is not correct for at least one disk using this ID"), 4654 strId.c_str()); 4655 break; 4694 4656 } 4657 else if (RT_FAILURE(vrc)) 4658 { 4659 hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to set the encryption key (%Rrc)"), vrc); 4660 break; 4661 } 4662 4663 if (RT_SUCCESS(vrc)) 4664 cDisksConfigured++; 4695 4665 } 4696 4666 else … … 4795 4765 } 4796 4766 else 4797 hrc = setError(E_FAIL, 4798 tr("Failed to decode the key (%Rrc)"), 4799 rc); 4767 hrc = setErrorBoth(E_FAIL, rc, tr("Failed to decode the key (%Rrc)"), rc); 4800 4768 4801 4769 RTMemSaferFree(pbKey, cbKey); 4802 4770 } 4803 4771 else 4804 hrc = setError(E_FAIL, 4805 tr("Failed to allocate secure memory for the key (%Rrc)"), rc); 4772 hrc = setErrorBoth(E_FAIL, rc, tr("Failed to allocate secure memory for the key (%Rrc)"), rc); 4806 4773 } 4807 4774 else … … 4896 4863 return S_OK; 4897 4864 4898 return setError(E_FAIL, 4899 tr("Could not change the network adaptor attachement type (%Rrc)"), rc); 4865 return setErrorBoth(E_FAIL, rc, tr("Could not change the network adaptor attachement type (%Rrc)"), rc); 4900 4866 } 4901 4867 … … 5222 5188 m_aeSerialPortMode[ulSlot] = eHostMode; 5223 5189 else 5224 hrc = setError(E_FAIL, 5225 tr("Failed to change the serial port attachment (%Rrc)"), rc); 5190 hrc = setErrorBoth(E_FAIL, rc, tr("Failed to change the serial port attachment (%Rrc)"), rc); 5226 5191 } 5227 5192 } … … 5549 5514 { 5550 5515 Utf8Str errMsg = VRDPServerErrorToMsg(vrc); 5551 rc = setError (E_FAIL, errMsg.c_str());5516 rc = setErrorBoth(E_FAIL, vrc, errMsg.c_str()); 5552 5517 } 5553 5518 else … … 5629 5594 } 5630 5595 5631 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : 5632 setError(VBOX_E_PDM_ERROR, 5633 tr("Sending monitor hot-plug event failed (%Rrc)"), 5634 vrc); 5596 HRESULT rc = RT_SUCCESS(vrc) ? S_OK 5597 : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Sending monitor hot-plug event failed (%Rrc)"), vrc); 5635 5598 5636 5599 LogFlowThisFunc(("rc=%Rhrc\n", rc)); … … 5675 5638 vrc = mDisplay->i_videoRecStart(); 5676 5639 if (RT_FAILURE(vrc)) 5677 rc = setError (E_FAIL, tr("Unable to start video capturing (%Rrc)"), vrc);5640 rc = setErrorBoth(E_FAIL, vrc, tr("Unable to start video capturing (%Rrc)"), vrc); 5678 5641 } 5679 5642 else … … 6120 6083 } 6121 6084 else 6122 rc = setError(VBOX_E_IPRT_ERROR, 6123 tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), 6124 vrc); 6085 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc); 6125 6086 } 6126 6087 catch(std::bad_alloc & /*e*/) … … 6179 6140 HRESULT hrc = S_OK; 6180 6141 if (RT_FAILURE(vrc)) 6181 hrc = setError (VBOX_E_IPRT_ERROR, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc);6142 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc); 6182 6143 return hrc; 6183 6144 #endif /* VBOX_WITH_GUEST_PROPS */ … … 6210 6171 HRESULT hrc = S_OK; 6211 6172 if (RT_FAILURE(vrc)) 6212 hrc = setError (VBOX_E_IPRT_ERROR, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc);6173 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc); 6213 6174 return hrc; 6214 6175 #endif /* VBOX_WITH_GUEST_PROPS */ … … 6379 6340 6380 6341 if (RT_FAILURE(vrc)) 6381 return setError (E_FAIL, tr("%Rrc"), vrc);6342 return setErrorBoth(E_FAIL, vrc, tr("%Rrc"), vrc); 6382 6343 if (FAILED(rc)) 6383 6344 return rc; … … 6401 6362 vrc = pIMedium->pfnMerge(pIMedium, onlineMergeMediumProgress, aProgress); 6402 6363 if (RT_FAILURE(vrc)) 6403 return setError (E_FAIL, tr("Failed to perform an online medium merge (%Rrc)"), vrc);6364 return setErrorBoth(E_FAIL, vrc, tr("Failed to perform an online medium merge (%Rrc)"), vrc); 6404 6365 6405 6366 alock.acquire(); … … 6425 6386 6426 6387 if (RT_FAILURE(vrc)) 6427 return setError (E_FAIL, tr("%Rrc"), vrc);6388 return setErrorBoth(E_FAIL, vrc, tr("%Rrc"), vrc); 6428 6389 if (FAILED(rc)) 6429 6390 return rc; … … 6507 6468 pAttachment, mMachineState, &rc); 6508 6469 if (RT_FAILURE(vrc)) 6509 throw setError (E_FAIL, tr("%Rrc"), vrc);6470 throw setErrorBoth(E_FAIL, vrc, tr("%Rrc"), vrc); 6510 6471 if (FAILED(rc)) 6511 6472 throw rc; … … 6602 6563 HRESULT hrc = S_OK; 6603 6564 if (RT_FAILURE(vrc)) 6604 hrc = setError (VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);6565 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not suspend the machine execution (%Rrc)"), vrc); 6605 6566 else if ( aReason == Reason_HostSuspend 6606 6567 || aReason == Reason_HostBatteryLow) … … 6695 6656 } 6696 6657 6697 HRESULT rc = RT_SUCCESS(vrc) ? S_OK : 6698 setError(VBOX_E_VM_ERROR, 6699 tr("Could not resume the machine execution (%Rrc)"), 6700 vrc); 6658 HRESULT rc = RT_SUCCESS(vrc) ? S_OK 6659 : setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not resume the machine execution (%Rrc)"), vrc); 6701 6660 6702 6661 LogFlowThisFunc(("rc=%Rhrc\n", rc)); … … 6739 6698 { 6740 6699 return setError(VBOX_E_INVALID_VM_STATE, 6741 tr("Cannot save the execution state as the machine is not running or paused (machine state: %s)"),6742 Global::stringifyMachineState(mMachineState));6700 tr("Cannot save the execution state as the machine is not running or paused (machine state: %s)"), 6701 Global::stringifyMachineState(mMachineState)); 6743 6702 } 6744 6703 bool fContinueAfterwards = mMachineState != MachineState_Saving; … … 6761 6720 int vrc = RTDirCreateFullPath(dir.c_str(), 0700); 6762 6721 if (RT_FAILURE(vrc)) 6763 return setError(VBOX_E_FILE_ERROR, 6764 tr("Could not create a directory '%s' to save the state to (%Rrc)"), 6765 dir.c_str(), vrc); 6722 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Could not create a directory '%s' to save the state to (%Rrc)"), 6723 dir.c_str(), vrc); 6766 6724 } 6767 6725 } … … 6786 6744 6787 6745 if (RT_FAILURE(vrc)) 6788 return setError (VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);6746 return setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not suspend the machine execution (%Rrc)"), vrc); 6789 6747 fPaused = true; 6790 6748 } … … 6812 6770 alock.acquire(); 6813 6771 } 6814 return setError(E_FAIL, tr("Failed to save the machine state to '%s' (%Rrc)"), 6815 aStateFilePath.c_str(), vrc); 6772 return setErrorBoth(E_FAIL, vrc, tr("Failed to save the machine state to '%s' (%Rrc)"), aStateFilePath.c_str(), vrc); 6816 6773 } 6817 6774 Assert(fContinueAfterwards || !aLeftPaused); … … 7204 7161 { 7205 7162 /* powerDown() is waiting for all callers to finish */ 7206 return aQuiet ? E_ACCESSDENIED : setError(E_ACCESSDENIED, 7207 tr("The virtual machine is being powered down")); 7163 return aQuiet ? E_ACCESSDENIED : setError(E_ACCESSDENIED, tr("The virtual machine is being powered down")); 7208 7164 } 7209 7165 … … 7213 7169 7214 7170 /* The machine is not powered up */ 7215 return aQuiet ? E_ACCESSDENIED : setError(E_ACCESSDENIED, 7216 tr("The virtual machine is not powered up")); 7171 return aQuiet ? E_ACCESSDENIED : setError(E_ACCESSDENIED, tr("The virtual machine is not powered up")); 7217 7172 } 7218 7173 … … 7364 7319 0 /* uHistoryFileSize */, RTErrInfoInitStatic(&ErrInfo)); 7365 7320 if (RT_FAILURE(vrc)) 7366 hrc = setError (E_FAIL, tr("Failed to open release log (%s, %Rrc)"), ErrInfo.Core.pszMsg, vrc);7321 hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to open release log (%s, %Rrc)"), ErrInfo.Core.pszMsg, vrc); 7367 7322 7368 7323 /* If we've made any directory changes, flush the directory to increase … … 7408 7363 { 7409 7364 if (Global::IsOnlineOrTransient(mMachineState)) 7410 throw setError(VBOX_E_INVALID_VM_STATE, 7411 tr("The virtual machine is already running or busy (machine state: %s)"), 7412 Global::stringifyMachineState(mMachineState)); 7365 throw setError(VBOX_E_INVALID_VM_STATE, tr("The virtual machine is already running or busy (machine state: %s)"), 7366 Global::stringifyMachineState(mMachineState)); 7413 7367 7414 7368 /* Set up release logging as early as possible after the check if … … 7472 7426 int vrc = SSMR3ValidateFile(Utf8Str(savedStateFile).c_str(), false /* fChecksumIt */); 7473 7427 if (RT_FAILURE(vrc)) 7474 throw setError (VBOX_E_FILE_ERROR,7475 tr("VM cannot start because the saved state file '%ls' is invalid (%Rrc). Delete the saved state prior to starting the VM"),7476 savedStateFile.raw(), vrc);7428 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 7429 tr("VM cannot start because the saved state file '%ls' is invalid (%Rrc). Delete the saved state prior to starting the VM"), 7430 savedStateFile.raw(), vrc); 7477 7431 } 7478 7432 … … 7653 7607 vrc = RTDirCreateFullPath(pszDumpDir, 0700); 7654 7608 if (RT_FAILURE(vrc)) 7655 throw setError (E_FAIL, "Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)\n",7656 pszDumpDir, vrc);7609 throw setErrorBoth(E_FAIL, vrc, "Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)\n", 7610 pszDumpDir, vrc); 7657 7611 } 7658 7612 7659 7613 vrc = RTCoreDumperSetup(pszDumpDir, fCoreFlags); 7660 7614 if (RT_FAILURE(vrc)) 7661 throw setError(E_FAIL, "Failed to setup CoreDumper (%Rrc)", vrc); 7662 else 7663 LogRel(("CoreDumper setup successful. pszDumpDir=%s fFlags=%#x\n", pszDumpDir ? pszDumpDir : ".", fCoreFlags)); 7615 throw setErrorBoth(E_FAIL, vrc, "Failed to setup CoreDumper (%Rrc)", vrc); 7616 LogRel(("CoreDumper setup successful. pszDumpDir=%s fFlags=%#x\n", pszDumpDir ? pszDumpDir : ".", fCoreFlags)); 7664 7617 } 7665 7618 #endif … … 7771 7724 { 7772 7725 throw setError(VBOX_E_HOST_ERROR, 7773 tr("VM cannot start because host interface networking requires a host interface name to be set"));7726 tr("VM cannot start because host interface networking requires a host interface name to be set")); 7774 7727 } 7775 7728 ComPtr<IVirtualBox> pVirtualBox; … … 7782 7735 { 7783 7736 throw setError(VBOX_E_HOST_ERROR, 7784 tr("VM cannot start because the host interface '%ls' does not exist"), 7785 hostif.raw()); 7737 tr("VM cannot start because the host interface '%ls' does not exist"), hostif.raw()); 7786 7738 } 7787 7739 break; … … 8103 8055 mpUVM = pUVM; 8104 8056 pUVM = NULL; 8105 rc = setError(VBOX_E_VM_ERROR, 8106 tr("Could not destroy the machine. (Error: %Rrc)"), 8107 vrc); 8057 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not destroy the machine. (Error: %Rrc)"), vrc); 8108 8058 } 8109 8059 … … 8121 8071 } 8122 8072 else 8123 { 8124 rc = setError(VBOX_E_VM_ERROR, 8125 tr("Could not power off the machine. (Error: %Rrc)"), 8126 vrc); 8127 } 8073 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not power off the machine. (Error: %Rrc)"), vrc); 8128 8074 8129 8075 /* … … 8227 8173 8228 8174 if (aSetError) 8229 setError(VBOX_E_FILE_ERROR, 8230 tr("Could not find a shared folder named '%s'."), 8231 strName.c_str()); 8175 setError(VBOX_E_FILE_ERROR, tr("Could not find a shared folder named '%s'."), strName.c_str()); 8232 8176 8233 8177 return VBOX_E_FILE_ERROR; … … 8444 8388 bool fMissing = false; 8445 8389 if (RT_FAILURE(vrc)) 8446 return setError(E_INVALIDARG, 8447 tr("Invalid shared folder path: '%s' (%Rrc)"), 8448 aData.m_strHostPath.c_str(), vrc); 8390 return setErrorBoth(E_INVALIDARG, vrc, tr("Invalid shared folder path: '%s' (%Rrc)"), aData.m_strHostPath.c_str(), vrc); 8449 8391 if (!RTPathExists(hostPathFull)) 8450 8392 fMissing = true; … … 8506 8448 8507 8449 if (RT_FAILURE(vrc)) 8508 return setError(E_FAIL, 8509 tr("Could not create a shared folder '%s' mapped to '%s' (%Rrc)"), 8510 strName.c_str(), aData.m_strHostPath.c_str(), vrc); 8450 return setErrorBoth(E_FAIL, vrc, tr("Could not create a shared folder '%s' mapped to '%s' (%Rrc)"), 8451 strName.c_str(), aData.m_strHostPath.c_str(), vrc); 8511 8452 8512 8453 if (fMissing) … … 8560 8501 RTMemFree(pMapName); 8561 8502 if (RT_FAILURE(vrc)) 8562 return setError(E_FAIL, 8563 tr("Could not remove the shared folder '%s' (%Rrc)"), 8564 strName.c_str(), vrc); 8503 return setErrorBoth(E_FAIL, vrc, tr("Could not remove the shared folder '%s' (%Rrc)"), strName.c_str(), vrc); 8565 8504 8566 8505 return S_OK; … … 9102 9041 { 9103 9042 case VERR_VUSB_NO_PORTS: 9104 hrc = setError (E_FAIL, tr("Failed to attach the USB device. (No available ports on the USB controller)."));9043 hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to attach the USB device. (No available ports on the USB controller).")); 9105 9044 break; 9106 9045 case VERR_VUSB_USBFS_PERMISSION: 9107 hrc = setError (E_FAIL, tr("Not permitted to open the USB device, check usbfs options"));9046 hrc = setErrorBoth(E_FAIL, vrc, tr("Not permitted to open the USB device, check usbfs options")); 9108 9047 break; 9109 9048 default: 9110 hrc = setError (E_FAIL, tr("Failed to create a proxy device for the USB device. (Error: %Rrc)"), vrc);9049 hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to create a proxy device for the USB device. (Error: %Rrc)"), vrc); 9111 9050 break; 9112 9051 } … … 9277 9216 * Allocate a host interface device 9278 9217 */ 9279 int rcVBox= RTFileOpen(&maTapFD[slot], "/dev/net/tun",9280 9281 if (RT_SUCCESS( rcVBox))9218 int vrc = RTFileOpen(&maTapFD[slot], "/dev/net/tun", 9219 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT); 9220 if (RT_SUCCESS(vrc)) 9282 9221 { 9283 9222 /* … … 9303 9242 RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), str.c_str()); /** @todo bitch about names which are too long... */ 9304 9243 IfReq.ifr_flags = IFF_TAP | IFF_NO_PI; 9305 rcVBox= ioctl(RTFileToNative(maTapFD[slot]), TUNSETIFF, &IfReq);9306 if ( rcVBox!= 0)9244 vrc = ioctl(RTFileToNative(maTapFD[slot]), TUNSETIFF, &IfReq); 9245 if (vrc != 0) 9307 9246 { 9308 9247 LogRel(("Failed to open the host network interface %ls\n", tapDeviceName.raw())); 9309 rc = setError(E_FAIL, 9310 tr("Failed to open the host network interface %ls"), 9311 tapDeviceName.raw()); 9248 rc = setErrorBoth(E_FAIL, vrc, tr("Failed to open the host network interface %ls"), tapDeviceName.raw()); 9312 9249 } 9313 9250 } … … 9326 9263 */ 9327 9264 maTAPDeviceName[slot] = tapDeviceName; 9328 rcVBox= VINF_SUCCESS;9265 vrc = VINF_SUCCESS; 9329 9266 } 9330 9267 else … … 9333 9270 9334 9271 LogRel(("Configuration error: Failed to configure /dev/net/tun non blocking. Error: %s\n", strerror(iErr))); 9335 rcVBox = VERR_HOSTIF_BLOCKING; 9336 rc = setError(E_FAIL, 9337 tr("could not set up the host networking device for non blocking access: %s"), 9338 strerror(errno)); 9272 vrc = VERR_HOSTIF_BLOCKING; 9273 rc = setErrorBoth(E_FAIL, vrc, tr("could not set up the host networking device for non blocking access: %s"), 9274 strerror(errno)); 9339 9275 } 9340 9276 } … … 9342 9278 else 9343 9279 { 9344 LogRel(("Configuration error: Failed to open /dev/net/tun rc=%Rrc\n", rcVBox));9345 switch ( rcVBox)9280 LogRel(("Configuration error: Failed to open /dev/net/tun rc=%Rrc\n", vrc)); 9281 switch (vrc) 9346 9282 { 9347 9283 case VERR_ACCESS_DENIED: 9348 9284 /* will be handled by our caller */ 9349 rc = rcVBox;9285 rc = vrc; 9350 9286 break; 9351 9287 default: 9352 rc = setError(E_FAIL, 9353 tr("Could not set up the host networking device: %Rrc"), 9354 rcVBox); 9288 rc = setErrorBoth(E_FAIL, vrc, tr("Could not set up the host networking device: %Rrc"), vrc); 9355 9289 break; 9356 9290 } … … 9379 9313 memcpy(szTapdev + strlen(szTapdev), str.c_str(), 9380 9314 sizeof(szTapdev) - strlen(szTapdev) - 1); /** @todo bitch about names which are too long... */ 9381 int rcVBox= RTFileOpen(&maTapFD[slot], szTapdev,9382 9383 9384 if (RT_SUCCESS( rcVBox))9315 int vrc = RTFileOpen(&maTapFD[slot], szTapdev, 9316 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT | RTFILE_O_NON_BLOCK); 9317 9318 if (RT_SUCCESS(vrc)) 9385 9319 maTAPDeviceName[slot] = tapDeviceName; 9386 9320 else 9387 9321 { 9388 switch ( rcVBox)9322 switch (vrc) 9389 9323 { 9390 9324 case VERR_ACCESS_DENIED: 9391 9325 /* will be handled by our caller */ 9392 rc = rcVBox;9326 rc = vrc; 9393 9327 break; 9394 9328 default: 9395 rc = setError(E_FAIL, 9396 tr("Failed to open the host network interface %ls"), 9397 tapDeviceName.raw()); 9329 rc = setErrorBoth(E_FAIL, vrc, tr("Failed to open the host network interface %ls"), tapDeviceName.raw()); 9398 9330 break; 9399 9331 } … … 9403 9335 # endif 9404 9336 /* in case of failure, cleanup. */ 9405 if (RT_FAILURE( rcVBox) && SUCCEEDED(rc))9337 if (RT_FAILURE(vrc) && SUCCEEDED(rc)) 9406 9338 { 9407 9339 LogRel(("General failure attaching to host interface\n")); 9408 rc = setError(E_FAIL, 9409 tr("General failure attaching to host interface")); 9340 rc = setError(E_FAIL, vrc, tr("General failure attaching to host interface")); 9410 9341 } 9411 9342 LogFlowThisFunc(("rc=%Rhrc\n", rc)); … … 9950 9881 if ( RT_FAILURE(vrc) 9951 9882 && vrc != VERR_NET_ADDRESS_IN_USE) /* not fatal */ 9952 throw i_setErrorStatic (E_FAIL, errMsg.c_str());9883 throw i_setErrorStaticBoth(E_FAIL, vrc, errMsg.c_str()); 9953 9884 } 9954 9885 … … 10278 10209 /* Set the error message as the COM error. 10279 10210 * Progress::notifyComplete() will pick it up later. */ 10280 throw i_setErrorStatic (E_FAIL, pTask->mErrorMsg.c_str());10211 throw i_setErrorStaticBoth(E_FAIL, vrc, pTask->mErrorMsg.c_str()); 10281 10212 } 10282 10213 } -
trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
r69500 r73003 238 238 int vrc = teleporterTcpReadLine(pState, szMsg, sizeof(szMsg)); 239 239 if (RT_FAILURE(vrc)) 240 return setError (E_FAIL, tr("Failed reading ACK(%s): %Rrc"), pszWhich, vrc);240 return setErrorBoth(E_FAIL, vrc, tr("Failed reading ACK(%s): %Rrc"), pszWhich, vrc); 241 241 242 242 if (!strcmp(szMsg, "ACK")) … … 300 300 int vrc = RTTcpSgWriteL(pState->mhSocket, 2, pszCommand, strlen(pszCommand), "\n", sizeof("\n") - 1); 301 301 if (RT_FAILURE(vrc)) 302 return setError (E_FAIL, tr("Failed writing command '%s': %Rrc"), pszCommand, vrc);302 return setErrorBoth(E_FAIL, vrc, tr("Failed writing command '%s': %Rrc"), pszCommand, vrc); 303 303 if (!fWaitForAck) 304 304 return S_OK; … … 655 655 int vrc = RTTcpClientConnect(pState->mstrHostname.c_str(), pState->muPort, &pState->mhSocket); 656 656 if (RT_FAILURE(vrc)) 657 return setError (E_FAIL, tr("Failed to connect to port %u on '%s': %Rrc"),658 pState->muPort, pState->mstrHostname.c_str(), vrc);657 return setErrorBoth(E_FAIL, vrc, tr("Failed to connect to port %u on '%s': %Rrc"), 658 pState->muPort, pState->mstrHostname.c_str(), vrc); 659 659 vrc = RTTcpSetSendCoalescing(pState->mhSocket, false /*fEnable*/); 660 660 AssertRC(vrc); … … 665 665 vrc = RTTcpRead(pState->mhSocket, szLine, sizeof(g_szWelcome) - 1, NULL); 666 666 if (RT_FAILURE(vrc)) 667 return setError (E_FAIL, tr("Failed to read welcome message: %Rrc"), vrc);667 return setErrorBoth(E_FAIL, vrc, tr("Failed to read welcome message: %Rrc"), vrc); 668 668 if (strcmp(szLine, g_szWelcome)) 669 669 return setError(E_FAIL, tr("Unexpected welcome %.*Rhxs"), sizeof(g_szWelcome) - 1, szLine); … … 673 673 vrc = RTTcpWrite(pState->mhSocket, pState->mstrPassword.c_str(), pState->mstrPassword.length()); 674 674 if (RT_FAILURE(vrc)) 675 return setError (E_FAIL, tr("Failed to send password: %Rrc"), vrc);675 return setErrorBoth(E_FAIL, vrc, tr("Failed to send password: %Rrc"), vrc); 676 676 677 677 /* ACK */ … … 708 708 return hrc; 709 709 } 710 return setError (E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc);710 return setErrorBoth(E_FAIL, vrc, tr("VMR3Teleport -> %Rrc"), vrc); 711 711 } 712 712 … … 968 968 969 969 default: 970 return setError(VBOX_E_INVALID_VM_STATE, 971 tr("Invalid machine state: %s (must be Running or Paused)"), 972 Global::stringifyMachineState(mMachineState)); 970 return setError(VBOX_E_INVALID_VM_STATE, tr("Invalid machine state: %s (must be Running or Paused)"), 971 Global::stringifyMachineState(mMachineState)); 973 972 } 974 973 … … 1018 1017 ptrProgress->i_setCancelCallback(NULL, NULL); 1019 1018 delete pState; 1020 hrc = setError (E_FAIL, tr("RTThreadCreate -> %Rrc"), vrc);1019 hrc = setErrorBoth(E_FAIL, vrc, tr("RTThreadCreate -> %Rrc"), vrc); 1021 1020 } 1022 1021 … … 1099 1098 } 1100 1099 if (RT_FAILURE(vrc)) 1101 return setError (E_FAIL, tr("RTTcpServerCreateEx failed with status %Rrc"), vrc);1100 return setErrorBoth(E_FAIL, vrc, tr("RTTcpServerCreateEx failed with status %Rrc"), vrc); 1102 1101 1103 1102 /* … … 1162 1161 else 1163 1162 { 1164 hrc = setError (E_FAIL, tr("Unexpected RTTcpServerListen status code %Rrc"), vrc);1163 hrc = setErrorBoth(E_FAIL, vrc, tr("Unexpected RTTcpServerListen status code %Rrc"), vrc); 1165 1164 LogRel(("Teleporter: Unexpected RTTcpServerListen rc: %Rrc\n", vrc)); 1166 1165 } … … 1176 1175 } 1177 1176 else 1178 hrc = setError (E_FAIL, "RTTimerLRStart -> %Rrc", vrc);1177 hrc = setErrorBoth(E_FAIL, vrc, "RTTimerLRStart -> %Rrc", vrc); 1179 1178 1180 1179 RTTimerLRDestroy(hTimerLR); 1181 1180 } 1182 1181 else 1183 hrc = setError (E_FAIL, "RTTimerLRCreate -> %Rrc", vrc);1182 hrc = setErrorBoth(E_FAIL, vrc, "RTTimerLRCreate -> %Rrc", vrc); 1184 1183 RTTcpServerDestroy(hServer); 1185 1184 -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r70496 r73003 3201 3201 Utf8Str filename = authLibrary; 3202 3202 3203 int rc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 3204 3205 if (RT_FAILURE(rc)) 3206 { 3207 mConsole->setError(E_FAIL, 3208 mConsole->tr("Could not load the external authentication library '%s' (%Rrc)"), 3209 filename.c_str(), 3210 rc); 3211 3203 int vrc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 3204 if (RT_FAILURE(vrc)) 3205 { 3206 mConsole->setErrorBoth(E_FAIL, vrc, mConsole->tr("Could not load the external authentication library '%s' (%Rrc)"), 3207 filename.c_str(), vrc); 3212 3208 return AuthResultAccessDenied; 3213 3209 } -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r72980 r73003 2344 2344 } 2345 2345 else 2346 { 2347 rc = setError(VBOX_E_IPRT_ERROR, 2348 tr("Could not convert screenshot to PNG (%Rrc)"), vrc); 2349 } 2346 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not convert screenshot to PNG (%Rrc)"), vrc); 2350 2347 RTMemFree(pu8PNG); 2351 2348 } 2352 2349 } 2353 2350 else if (vrc == VERR_TRY_AGAIN) 2354 rc = setError(E_UNEXPECTED, 2355 tr("Screenshot is not available at this time")); 2351 rc = setErrorBoth(E_UNEXPECTED, vrc, tr("Screenshot is not available at this time")); 2356 2352 else if (RT_FAILURE(vrc)) 2357 rc = setError(VBOX_E_IPRT_ERROR, 2358 tr("Could not take a screenshot (%Rrc)"), vrc); 2353 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not take a screenshot (%Rrc)"), vrc); 2359 2354 2360 2355 return rc; … … 2817 2812 * dirty conversion work. 2818 2813 */ 2819 int rcVBox= VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7,2820 2814 int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7, 2815 this, aScreenId, aAddress, aX, aY, aWidth, aHeight); 2821 2816 2822 2817 /* … … 2825 2820 */ 2826 2821 HRESULT rc = S_OK; 2827 if ( rcVBox == VERR_NOT_SUPPORTED || rcVBox== VERR_NOT_IMPLEMENTED)2822 if (vrc == VERR_NOT_SUPPORTED || vrc == VERR_NOT_IMPLEMENTED) 2828 2823 { 2829 2824 /** @todo implement generic fallback for screen blitting. */ 2830 2825 rc = E_NOTIMPL; 2831 2826 } 2832 else if (RT_FAILURE(rcVBox)) 2833 rc = setError(VBOX_E_IPRT_ERROR, 2834 tr("Could not draw to the screen (%Rrc)"), rcVBox); 2827 else if (RT_FAILURE(vrc)) 2828 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not draw to the screen (%Rrc)"), vrc); 2835 2829 /// @todo 2836 2830 // else … … 2958 2952 alock.release(); 2959 2953 2960 int rcVBox= VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,2961 2954 int vrc = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2955 3, this, 0, true); 2962 2956 alock.acquire(); 2963 2957 2964 if (RT_FAILURE(rcVBox)) 2965 rc = setError(VBOX_E_IPRT_ERROR, 2966 tr("Could not invalidate and update the screen (%Rrc)"), rcVBox); 2958 if (RT_FAILURE(vrc)) 2959 rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not invalidate and update the screen (%Rrc)"), vrc); 2967 2960 2968 2961 LogRelFlowFunc(("rc=%Rhrc\n", rc)); … … 2980 2973 return ptrVM.rc(); 2981 2974 2982 int rcVBox = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2983 3, this, aScreenId, false); 2984 if (RT_FAILURE(rcVBox)) 2985 rc = setError(VBOX_E_IPRT_ERROR, 2986 tr("Could not invalidate and update the screen %d (%Rrc)"), aScreenId, rcVBox); 2975 int vrc = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT, 2976 3, this, aScreenId, false); 2977 if (RT_FAILURE(vrc)) 2978 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not invalidate and update the screen %d (%Rrc)"), aScreenId, vrc); 2987 2979 2988 2980 LogRelFlowFunc(("rc=%Rhrc\n", rc)); -
trunk/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
r69500 r73003 213 213 { 214 214 LogFlowThisFunc(("%Rrc\n", vrc)); 215 hrc = pConsole->setError(VBOX_E_IPRT_ERROR, 216 "Init emulated USB webcam (%Rrc)", vrc); 215 hrc = pConsole->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, "Init emulated USB webcam (%Rrc)", vrc); 217 216 } 218 217 … … 313 312 { 314 313 LogFlowThisFunc(("%Rrc\n", vrc)); 315 hrc = pConsole->setError(VBOX_E_IPRT_ERROR, 316 "Attach emulated USB webcam (%Rrc)", vrc); 314 hrc = pConsole->setErrorBoth(VBOX_E_VM_ERROR, vrc, "Attach emulated USB webcam (%Rrc)", vrc); 317 315 } 318 316 … … 332 330 { 333 331 LogFlowThisFunc(("%Rrc\n", vrc)); 334 hrc = pConsole->setError(VBOX_E_IPRT_ERROR, 335 "Detach emulated USB webcam (%Rrc)", vrc); 332 hrc = pConsole->setErrorBoth(VBOX_E_VM_ERROR, vrc, "Detach emulated USB webcam (%Rrc)", vrc); 336 333 } 337 334 -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r72958 r73003 375 375 376 376 ComObjPtr<GuestSession> pSession; 377 int rc = i_sessionCreate(startupInfo, guestCreds, pSession);378 if (RT_SUCCESS( rc))377 int vrc = i_sessionCreate(startupInfo, guestCreds, pSession); 378 if (RT_SUCCESS(vrc)) 379 379 { 380 380 /* Return guest session to the caller. */ 381 381 HRESULT hr2 = pSession.queryInterfaceTo(aGuestSession.asOutParam()); 382 382 if (FAILED(hr2)) 383 rc = VERR_COM_OBJECT_NOT_FOUND;384 } 385 386 if (RT_SUCCESS( rc))383 vrc = VERR_COM_OBJECT_NOT_FOUND; 384 } 385 386 if (RT_SUCCESS(vrc)) 387 387 /* Start (fork) the session asynchronously 388 388 * on the guest. */ 389 rc = pSession->i_startSessionAsync();389 vrc = pSession->i_startSessionAsync(); 390 390 391 391 HRESULT hr = S_OK; 392 392 393 if (RT_FAILURE( rc))394 { 395 switch ( rc)393 if (RT_FAILURE(vrc)) 394 { 395 switch (vrc) 396 396 { 397 397 case VERR_MAX_PROCS_REACHED: 398 hr = setError (VBOX_E_MAXIMUM_REACHED, tr("Maximum number of concurrent guest sessions (%ld) reached"),399 VBOX_GUESTCTRL_MAX_SESSIONS);398 hr = setErrorBoth(VBOX_E_MAXIMUM_REACHED, vrc, tr("Maximum number of concurrent guest sessions (%d) reached"), 399 VBOX_GUESTCTRL_MAX_SESSIONS); 400 400 break; 401 401 … … 403 403 404 404 default: 405 hr = setError (VBOX_E_IPRT_ERROR, tr("Could not create guest session: %Rrc"),rc);405 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not create guest session: %Rrc"), vrc); 406 406 break; 407 407 } … … 470 470 return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), fFlags); 471 471 472 int rc = VINF_SUCCESS;472 int vrc = VINF_SUCCESS; 473 473 474 474 ProcessArguments aArgs; … … 484 484 catch(std::bad_alloc &) 485 485 { 486 rc = VERR_NO_MEMORY;486 vrc = VERR_NO_MEMORY; 487 487 } 488 488 } … … 501 501 502 502 ComObjPtr<GuestSession> pSession; 503 if (RT_SUCCESS( rc))504 rc = i_sessionCreate(startupInfo, guestCreds, pSession);505 if (RT_FAILURE( rc))506 { 507 switch ( rc)503 if (RT_SUCCESS(vrc)) 504 vrc = i_sessionCreate(startupInfo, guestCreds, pSession); 505 if (RT_FAILURE(vrc)) 506 { 507 switch (vrc) 508 508 { 509 509 case VERR_MAX_PROCS_REACHED: 510 hr = setError (VBOX_E_IPRT_ERROR, tr("Maximum number of concurrent guest sessions (%ld) reached"),511 VBOX_GUESTCTRL_MAX_SESSIONS);510 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Maximum number of concurrent guest sessions (%d) reached"), 511 VBOX_GUESTCTRL_MAX_SESSIONS); 512 512 break; 513 513 … … 515 515 516 516 default: 517 hr = setError (VBOX_E_IPRT_ERROR, tr("Could not create guest session: %Rrc"),rc);517 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not create guest session: %Rrc"), vrc); 518 518 break; 519 519 } … … 523 523 Assert(!pSession.isNull()); 524 524 int rcGuest; 525 rc = pSession->i_startSession(&rcGuest);526 if (RT_FAILURE( rc))525 vrc = pSession->i_startSession(&rcGuest); 526 if (RT_FAILURE(vrc)) 527 527 { 528 528 /** @todo Handle rcGuest! */ 529 529 530 hr = setError (VBOX_E_IPRT_ERROR, tr("Could not open guest session: %Rrc"),rc);530 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not open guest session: %Rrc"), vrc); 531 531 } 532 532 else … … 543 543 catch(...) 544 544 { 545 hr = setError( VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskUpdateAdditions object "));545 hr = setError(E_OUTOFMEMORY, tr("Failed to create SessionTaskUpdateAdditions object ")); 546 546 throw; 547 547 } … … 552 552 { 553 553 delete pTask; 554 hr = setError(VBOX_E_IPRT_ERROR, 555 tr("Creating progress object for SessionTaskUpdateAdditions object failed")); 554 hr = setError(hr, tr("Creating progress object for SessionTaskUpdateAdditions object failed")); 556 555 throw hr; 557 556 } … … 566 565 } 567 566 else 568 hr = setError(VBOX_E_IPRT_ERROR, 569 tr("Starting thread for updating Guest Additions on the guest failed ")); 567 hr = setError(hr, tr("Starting thread for updating Guest Additions on the guest failed ")); 570 568 } 571 569 catch(std::bad_alloc &) -
trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
r71566 r73003 342 342 343 343 int rcGuest; 344 int rc = i_closeInternal(&rcGuest);345 if (RT_FAILURE( rc))346 { 347 switch ( rc)344 int vrc = i_closeInternal(&rcGuest); 345 if (RT_FAILURE(vrc)) 346 { 347 switch (vrc) 348 348 { 349 349 case VERR_GSTCTL_GUEST_ERROR: … … 357 357 358 358 default: 359 hr = setError(VBOX_E_IPRT_ERROR, 360 tr("Terminating open guest directory \"%s\" failed: %Rrc"), 361 mData.mOpenInfo.mPath.c_str(), rc); 359 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 360 tr("Terminating open guest directory \"%s\" failed: %Rrc"), mData.mOpenInfo.mPath.c_str(), vrc); 362 361 break; 363 362 } … … 377 376 378 377 ComObjPtr<GuestFsObjInfo> fsObjInfo; int rcGuest; 379 int rc = i_readInternal(fsObjInfo, &rcGuest); 380 if (RT_SUCCESS(rc)) 381 { 378 int vrc = i_readInternal(fsObjInfo, &rcGuest); 379 if (RT_SUCCESS(vrc)) 380 { 381 AssertMsg(vrc != VWRN_GSTCTL_PROCESS_EXIT_CODE, ("Buggy status code handling! See futher down...\n")); 382 382 /* Return info object to the caller. */ 383 383 hr = fsObjInfo.queryInterfaceTo(aObjInfo.asOutParam()); … … 385 385 else 386 386 { 387 switch ( rc)387 switch (vrc) 388 388 { 389 389 case VERR_GSTCTL_GUEST_ERROR: … … 391 391 break; 392 392 393 /** @todo r=bird: VWRN_GSTCTL_PROCESS_EXIT_CODE won't ever get here because 394 * RT_SUCCESS(VWRN_GSTCTL_PROCESS_EXIT_CODE) -> true. 395 * 396 */ 393 397 case VWRN_GSTCTL_PROCESS_EXIT_CODE: 394 hr = setError (VBOX_E_IPRT_ERROR, tr("Reading directory \"%s\" failed: %Rrc"),395 mData.mOpenInfo.mPath.c_str(), mData.mProcessTool.getRc());398 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Reading directory \"%s\" failed: %Rrc"), 399 mData.mOpenInfo.mPath.c_str(), mData.mProcessTool.getRc()); 396 400 break; 397 401 398 402 case VERR_PATH_NOT_FOUND: 399 hr = setError (VBOX_E_IPRT_ERROR, tr("Reading directory \"%s\" failed: Path not found"),400 mData.mOpenInfo.mPath.c_str());403 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Reading directory \"%s\" failed: Path not found"), 404 mData.mOpenInfo.mPath.c_str()); 401 405 break; 402 406 403 407 case VERR_NO_MORE_FILES: 404 408 /* See SDK reference. */ 405 hr = setError (VBOX_E_OBJECT_NOT_FOUND, tr("Reading directory \"%s\" failed: No more entries"),406 mData.mOpenInfo.mPath.c_str());409 hr = setErrorBoth(VBOX_E_OBJECT_NOT_FOUND, vrc, tr("Reading directory \"%s\" failed: No more entries"), 410 mData.mOpenInfo.mPath.c_str()); 407 411 break; 408 412 409 413 default: 410 hr = setError (VBOX_E_IPRT_ERROR, tr("Reading directory \"%s\" returned error: %Rrc\n"),411 mData.mOpenInfo.mPath.c_str(),rc);414 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Reading directory \"%s\" returned error: %Rrc\n"), 415 mData.mOpenInfo.mPath.c_str(), vrc); 412 416 break; 413 417 } 414 418 } 415 419 416 LogFlowThisFunc(("Returning rc=%Rrc\n",rc));420 LogFlowThisFunc(("Returning hr=%Rhrc / vrc=%Rrc\n", hr, vrc)); 417 421 return hr; 418 422 } -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r69500 r73003 400 400 } 401 401 else 402 hr = setError( VBOX_E_IPRT_ERROR, tr("Starting thread for GuestDnDSource::i_receiveDataThread failed (%Rhrc)"), hr);402 hr = setError(hr, tr("Starting thread for GuestDnDSource::i_receiveDataThread failed (%Rhrc)"), hr); 403 403 /* Note: mDataBase.mfTransferIsPending will be set to false again by i_receiveDataThread. */ 404 404 -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r69500 r73003 514 514 Msg.setNextUInt32(cbFormats); 515 515 516 int rc = GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());517 if (RT_SUCCESS( rc))516 int vrc = GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms()); 517 if (RT_SUCCESS(vrc)) 518 518 { 519 519 GuestDnDResponse *pResp = GuestDnDInst()->response(); 520 520 AssertPtr(pResp); 521 521 522 rc = pResp->waitForGuestResponse();523 if (RT_SUCCESS( rc))522 vrc = pResp->waitForGuestResponse(); 523 if (RT_SUCCESS(vrc)) 524 524 { 525 525 resAction = GuestDnD::toMainAction(pResp->defAction()); … … 532 532 } 533 533 else 534 /** @todo r=bird: This isn't an IPRT error, is it? */ 534 535 hr = setError(VBOX_E_IPRT_ERROR, tr("Guest returned invalid drop formats (%zu formats)"), lstFormats.size()); 535 536 } 536 537 else 537 hr = setError (VBOX_E_IPRT_ERROR, tr("Waiting for response of dropped event failed (%Rrc)"),rc);538 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Waiting for response of dropped event failed (%Rrc)"), vrc); 538 539 } 539 540 else 540 hr = setError (VBOX_E_IPRT_ERROR, tr("Sending dropped event to guest failed (%Rrc)"),rc);541 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Sending dropped event to guest failed (%Rrc)"), vrc); 541 542 } 542 543 else … … 674 675 } 675 676 else 676 hr = setError( VBOX_E_IPRT_ERROR, tr("Starting thread for GuestDnDTarget::i_sendDataThread (%Rhrc)"), hr);677 hr = setError(hr, tr("Starting thread for GuestDnDTarget::i_sendDataThread (%Rhrc)"), hr); 677 678 678 679 LogFlowFunc(("Returning hr=%Rhrc\n", hr)); -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r72980 r73003 1260 1260 /* Close file on guest. */ 1261 1261 int rcGuest; 1262 int rc = i_closeFile(&rcGuest);1262 int vrc = i_closeFile(&rcGuest); 1263 1263 /* On failure don't return here, instead do all the cleanup 1264 1264 * work first and then return an error. */ 1265 1265 1266 1266 AssertPtr(mSession); 1267 int rc2 = mSession->i_fileUnregister(this);1268 if (RT_SUCCESS( rc))1269 rc =rc2;1270 1271 if (RT_FAILURE( rc))1272 { 1273 if ( rc == VERR_GSTCTL_GUEST_ERROR)1267 int vrc2 = mSession->i_fileUnregister(this); 1268 if (RT_SUCCESS(vrc)) 1269 vrc = vrc2; 1270 1271 if (RT_FAILURE(vrc)) 1272 { 1273 if (vrc == VERR_GSTCTL_GUEST_ERROR) 1274 1274 return GuestFile::i_setErrorExternal(this, rcGuest); 1275 1276 return setError(VBOX_E_IPRT_ERROR, 1277 tr("Closing guest file failed with %Rrc\n"), rc); 1278 } 1279 1280 LogFlowThisFunc(("Returning rc=%Rrc\n", rc)); 1275 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Closing guest file failed with %Rrc\n"), vrc); 1276 } 1277 1278 LogFlowThisFunc(("Returning S_OK / vrc=%Rrc\n", vrc)); 1281 1279 return S_OK; 1282 1280 } … … 1309 1307 { 1310 1308 if (GuestProcess::i_isGuestError(vrc)) 1311 {1312 1309 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 1313 }1314 1310 else 1315 1311 hr = setErrorVrc(vrc, tr("Querying file information failed: %Rrc"), vrc); … … 1338 1334 { 1339 1335 if (GuestProcess::i_isGuestError(vrc)) 1340 {1341 1336 hr = GuestProcess::i_setErrorExternal(this, rcGuest); 1342 }1343 1337 else 1344 1338 hr = setErrorVrc(vrc, tr("Querying file size failed: %Rrc"), vrc); … … 1376 1370 aData.resize(0); 1377 1371 1378 switch (vrc) 1379 { 1380 default: 1381 hr = setError(VBOX_E_IPRT_ERROR, 1382 tr("Reading from file \"%s\" failed: %Rrc"), 1383 mData.mOpenInfo.mFileName.c_str(), vrc); 1384 break; 1385 } 1372 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Reading from file \"%s\" failed: %Rrc"), 1373 mData.mOpenInfo.mFileName.c_str(), vrc); 1386 1374 } 1387 1375 … … 1416 1404 aData.resize(0); 1417 1405 1418 switch (vrc) 1419 { 1420 default: 1421 hr = setError(VBOX_E_IPRT_ERROR, 1422 tr("Reading from file \"%s\" (at offset %RU64) failed: %Rrc"), 1423 mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1424 break; 1425 } 1406 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Reading from file \"%s\" (at offset %RU64) failed: %Rrc"), 1407 mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1426 1408 } 1427 1409 … … 1454 1436 default: 1455 1437 return setError(E_INVALIDARG, tr("Invalid seek type specified")); 1456 break; /* Never reached. */1457 1438 } 1458 1439 … … 1465 1446 *aNewOffset = RT_MIN(uNewOffset, (uint64_t)INT64_MAX); 1466 1447 else 1467 { 1468 switch (vrc) 1469 { 1470 default: 1471 hr = setError(VBOX_E_IPRT_ERROR, 1472 tr("Seeking file \"%s\" (to offset %RI64) failed: %Rrc"), 1473 mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1474 break; 1475 } 1476 } 1448 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Seeking file \"%s\" (to offset %RI64) failed: %Rrc"), 1449 mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1477 1450 1478 1451 LogFlowFuncLeaveRC(vrc); … … 1505 1478 int vrc = i_writeData(aTimeoutMS, pvData, cbData, (uint32_t*)aWritten); 1506 1479 if (RT_FAILURE(vrc)) 1507 { 1508 switch (vrc) 1509 { 1510 default: 1511 hr = setError(VBOX_E_IPRT_ERROR, 1512 tr("Writing %zubytes to file \"%s\" failed: %Rrc"), 1513 aData.size(), mData.mOpenInfo.mFileName.c_str(), vrc); 1514 break; 1515 } 1516 } 1480 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Writing %zubytes to file \"%s\" failed: %Rrc"), 1481 aData.size(), mData.mOpenInfo.mFileName.c_str(), vrc); 1517 1482 1518 1483 LogFlowFuncLeaveRC(vrc); … … 1533 1498 int vrc = i_writeData(aTimeoutMS, pvData, cbData, (uint32_t*)aWritten); 1534 1499 if (RT_FAILURE(vrc)) 1535 { 1536 switch (vrc) 1537 { 1538 default: 1539 hr = setError(VBOX_E_IPRT_ERROR, 1540 tr("Writing %zubytes to file \"%s\" (at offset %RU64) failed: %Rrc"), 1541 aData.size(), mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1542 break; 1543 } 1544 } 1500 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Writing %zubytes to file \"%s\" (at offset %RU64) failed: %Rrc"), 1501 aData.size(), mData.mOpenInfo.mFileName.c_str(), aOffset, vrc); 1545 1502 1546 1503 LogFlowFuncLeaveRC(vrc); -
trunk/src/VBox/Main/src-client/GuestImpl.cpp
r69500 r73003 809 809 if (Utf8Str(aDomain) == "@@disk") 810 810 return mParent->i_setDiskEncryptionKeys(aPassword); 811 elseif (Utf8Str(aDomain) == "@@mem")811 if (Utf8Str(aDomain) == "@@mem") 812 812 { 813 813 /** @todo */ 814 814 return E_NOTIMPL; 815 815 } 816 else 817 { 818 /* forward the information to the VMM device */ 819 VMMDev *pVMMDev = mParent->i_getVMMDev(); 820 if (pVMMDev) 821 { 822 PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort(); 823 if (pVMMDevPort) 824 { 825 uint32_t u32Flags = VMMDEV_SETCREDENTIALS_GUESTLOGON; 826 if (!aAllowInteractiveLogon) 827 u32Flags = VMMDEV_SETCREDENTIALS_NOLOCALLOGON; 828 829 pVMMDevPort->pfnSetCredentials(pVMMDevPort, 830 aUserName.c_str(), 831 aPassword.c_str(), 832 aDomain.c_str(), 833 u32Flags); 834 return S_OK; 835 } 836 } 837 } 838 839 return setError(VBOX_E_VM_ERROR, 840 tr("VMM device is not available (is the VM running?)")); 816 817 /* forward the information to the VMM device */ 818 VMMDev *pVMMDev = mParent->i_getVMMDev(); 819 if (pVMMDev) 820 { 821 PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort(); 822 if (pVMMDevPort) 823 { 824 uint32_t u32Flags = VMMDEV_SETCREDENTIALS_GUESTLOGON; 825 if (!aAllowInteractiveLogon) 826 u32Flags = VMMDEV_SETCREDENTIALS_NOLOCALLOGON; 827 828 pVMMDevPort->pfnSetCredentials(pVMMDevPort, 829 aUserName.c_str(), 830 aPassword.c_str(), 831 aDomain.c_str(), 832 u32Flags); 833 return S_OK; 834 } 835 } 836 837 return setError(VBOX_E_VM_ERROR, tr("VMM device is not available (is the VM running?)")); 841 838 } 842 839 -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r72973 r73003 1000 1000 AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n")); 1001 1001 1002 return pInterface->setError (VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(rcGuest).c_str());1002 return pInterface->setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, GuestProcess::i_guestErrorToString(rcGuest).c_str()); 1003 1003 } 1004 1004 … … 1791 1791 1792 1792 default: 1793 hr = setError(VBOX_E_IPRT_ERROR, 1794 tr("Reading from process \"%s\" (PID %RU32) failed: %Rrc"), 1795 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1793 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Reading from process \"%s\" (PID %RU32) failed: %Rrc"), 1794 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1796 1795 break; 1797 1796 } … … 1824 1823 1825 1824 case VERR_NOT_SUPPORTED: 1826 hr = setError (VBOX_E_IPRT_ERROR,1827 tr("Terminating process \"%s\" (PID %RU32) not supported by installed Guest Additions"),1828 mData.mProcess.mExecutable.c_str(), mData.mPID);1825 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1826 tr("Terminating process \"%s\" (PID %RU32) not supported by installed Guest Additions"), 1827 mData.mProcess.mExecutable.c_str(), mData.mPID); 1829 1828 break; 1830 1829 1831 1830 default: 1832 hr = setError(VBOX_E_IPRT_ERROR, 1833 tr("Terminating process \"%s\" (PID %RU32) failed: %Rrc"), 1834 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1831 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Terminating process \"%s\" (PID %RU32) failed: %Rrc"), 1832 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1835 1833 break; 1836 1834 } … … 1880 1878 1881 1879 default: 1882 hr = setError(VBOX_E_IPRT_ERROR, 1883 tr("Waiting for process \"%s\" (PID %RU32) failed: %Rrc"), 1884 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1880 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Waiting for process \"%s\" (PID %RU32) failed: %Rrc"), 1881 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1885 1882 break; 1886 1883 } … … 1924 1921 1925 1922 default: 1926 hr = setError(VBOX_E_IPRT_ERROR, 1927 tr("Writing to process \"%s\" (PID %RU32) failed: %Rrc"), 1928 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1923 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Writing to process \"%s\" (PID %RU32) failed: %Rrc"), 1924 mData.mProcess.mExecutable.c_str(), mData.mPID, vrc); 1929 1925 break; 1930 1926 } -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r72980 r73003 557 557 { 558 558 case VERR_NOT_SUPPORTED: 559 hr = setError(VBOX_E_IPRT_ERROR, tr("Getting the user's home path is not supported by installed Guest Additions")); 559 hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, 560 tr("Getting the user's home path is not supported by installed Guest Additions")); 560 561 break; 561 562 562 563 default: 563 hr = setError(VBOX_E_IPRT_ERROR, tr("Getting the user's home path failed on the guest: %Rrc"), rcGuest); 564 hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, 565 tr("Getting the user's home path failed on the guest: %Rrc"), rcGuest); 564 566 break; 565 567 } … … 568 570 569 571 default: 570 hr = setError (VBOX_E_IPRT_ERROR, tr("Getting the user's home path failed: %Rrc"), vrc);572 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's home path failed: %Rrc"), vrc); 571 573 break; 572 574 } … … 593 595 { 594 596 case VERR_NOT_SUPPORTED: 595 hr = setError(VBOX_E_IPRT_ERROR, tr("Getting the user's documents path is not supported by installed Guest Additions")); 597 hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, 598 tr("Getting the user's documents path is not supported by installed Guest Additions")); 596 599 break; 597 600 598 601 default: 599 hr = setError(VBOX_E_IPRT_ERROR, tr("Getting the user's documents path failed on the guest: %Rrc"), rcGuest); 602 hr = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, 603 tr("Getting the user's documents path failed on the guest: %Rrc"), rcGuest); 600 604 break; 601 605 } … … 604 608 605 609 default: 606 hr = setError (VBOX_E_IPRT_ERROR, tr("Getting the user's documents path failed: %Rrc"), vrc);610 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Getting the user's documents path failed: %Rrc"), vrc); 607 611 break; 608 612 } … … 780 784 } 781 785 else 782 hrc = setError(VBOX_E_IPRT_ERROR, 783 tr("Starting thread for copying from guest to \"%s\" on the host failed"), strDestination.c_str()); 786 hrc = setError(hrc, tr("Starting thread for copying from guest to \"%s\" on the host failed"), strDestination.c_str()); 784 787 785 788 } … … 852 855 } 853 856 else 854 hrc = setError(VBOX_E_IPRT_ERROR, 855 tr("Starting thread for copying from host to \"%s\" on the guest failed"), strDestination.c_str()); 857 hrc = setError(hrc, tr("Starting thread for copying from host to \"%s\" on the guest failed"), strDestination.c_str()); 856 858 857 859 } … … 2485 2487 AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n")); 2486 2488 2487 return pInterface->setError (VBOX_E_IPRT_ERROR, GuestSession::i_guestErrorToString(rcGuest).c_str());2489 return pInterface->setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, GuestSession::i_guestErrorToString(rcGuest).c_str()); 2488 2490 } 2489 2491 … … 2804 2806 /* Close session on guest. */ 2805 2807 int rcGuest = VINF_SUCCESS; 2806 int rc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */, &rcGuest);2808 int vrc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */, &rcGuest); 2807 2809 /* On failure don't return here, instead do all the cleanup 2808 2810 * work first and then return an error. */ … … 2810 2812 /* Remove ourselves from the session list. */ 2811 2813 AssertPtr(mParent); 2812 int rc2 = mParent->i_sessionRemove(mData.mSession.mID);2813 if ( rc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */2814 rc2 = VINF_SUCCESS;2815 2816 if (RT_SUCCESS( rc))2817 rc =rc2;2818 2819 LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", rc, rcGuest));2820 2821 if (RT_FAILURE( rc))2822 { 2823 if ( rc == VERR_GSTCTL_GUEST_ERROR)2814 int vrc2 = mParent->i_sessionRemove(mData.mSession.mID); 2815 if (vrc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */ 2816 vrc2 = VINF_SUCCESS; 2817 2818 if (RT_SUCCESS(vrc)) 2819 vrc = vrc2; 2820 2821 LogFlowThisFunc(("Returning rc=%Rrc, rcGuest=%Rrc\n", vrc, rcGuest)); 2822 2823 if (RT_FAILURE(vrc)) 2824 { 2825 if (vrc == VERR_GSTCTL_GUEST_ERROR) 2824 2826 return GuestSession::i_setErrorExternal(this, rcGuest); 2825 2826 return setError(VBOX_E_IPRT_ERROR, 2827 tr("Closing guest session failed with %Rrc"), rc); 2827 return setError(VBOX_E_IPRT_ERROR, tr("Closing guest session failed with %Rrc"), vrc); 2828 2828 } 2829 2829 … … 3087 3087 3088 3088 ComObjPtr <GuestDirectory> pDirectory; int rcGuest; 3089 int rc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &rcGuest); 3090 if (RT_FAILURE(rc)) 3091 { 3092 if (GuestProcess::i_isGuestError(rc)) 3093 { 3094 hrc = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %s"), 3095 GuestDirectory::i_guestErrorToString(rcGuest).c_str()); 3096 } 3089 int vrc = i_directoryCreate(aPath, (uint32_t)aMode, fFlags, &rcGuest); 3090 if (RT_FAILURE(vrc)) 3091 { 3092 if (GuestProcess::i_isGuestError(vrc)) 3093 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, 3094 tr("Directory creation failed: %s"), GuestDirectory::i_guestErrorToString(rcGuest).c_str()); 3097 3095 else 3098 3096 { 3099 switch ( rc)3097 switch (vrc) 3100 3098 { 3101 3099 case VERR_INVALID_PARAMETER: 3102 hrc = setError (VBOX_E_IPRT_ERROR, tr("Directory creation failed: Invalid parameters given"));3100 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Directory creation failed: Invalid parameters given")); 3103 3101 break; 3104 3102 3105 3103 case VERR_BROKEN_PIPE: 3106 hrc = setError (VBOX_E_IPRT_ERROR, tr("Directory creation failed: Unexpectedly aborted"));3104 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Directory creation failed: Unexpectedly aborted")); 3107 3105 break; 3108 3106 3109 3107 default: 3110 hrc = setError (VBOX_E_IPRT_ERROR, tr("Directory creation failed: %Rrc"),rc);3108 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Directory creation failed: %Rrc"), vrc); 3111 3109 break; 3112 3110 } … … 3137 3135 3138 3136 int rcGuest; 3139 int rc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, &rcGuest);3140 if (!RT_SUCCESS( rc))3141 { 3142 switch ( rc)3137 int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, &rcGuest); 3138 if (!RT_SUCCESS(vrc)) 3139 { 3140 switch (vrc) 3143 3141 { 3144 3142 case VERR_GSTCTL_GUEST_ERROR: … … 3147 3145 3148 3146 default: 3149 hrc = setError (VBOX_E_IPRT_ERROR, tr("Temporary directory creation \"%s\" with template \"%s\" failed: %Rrc"),3150 aPath.c_str(), aTemplateName.c_str(),rc);3147 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Temporary directory creation \"%s\" with template \"%s\" failed: %Rrc"), 3148 aPath.c_str(), aTemplateName.c_str(), vrc); 3151 3149 break; 3152 3150 } … … 3171 3169 3172 3170 GuestFsObjData objData; int rcGuest; 3173 int rc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);3174 if (RT_SUCCESS( rc))3171 int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); 3172 if (RT_SUCCESS(vrc)) 3175 3173 *aExists = objData.mType == FsObjType_Directory; 3176 3174 else 3177 3175 { 3178 switch ( rc)3176 switch (vrc) 3179 3177 { 3180 3178 case VERR_GSTCTL_GUEST_ERROR: … … 3186 3184 break; 3187 3185 default: 3188 hrc = setError (VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %s"),3189 3186 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Querying directory existence \"%s\" failed: %s"), 3187 aPath.c_str(), GuestProcess::i_guestErrorToString(rcGuest).c_str()); 3190 3188 break; 3191 3189 } … … 3194 3192 3195 3193 default: 3196 hrc = setError (VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %Rrc"),3197 aPath.c_str(),rc);3194 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Querying directory existence \"%s\" failed: %Rrc"), 3195 aPath.c_str(), vrc); 3198 3196 break; 3199 3197 } … … 3236 3234 3237 3235 ComObjPtr <GuestDirectory> pDirectory; int rcGuest; 3238 int rc = i_directoryOpen(openInfo, pDirectory, &rcGuest);3239 if (RT_SUCCESS( rc))3236 int vrc = i_directoryOpen(openInfo, pDirectory, &rcGuest); 3237 if (RT_SUCCESS(vrc)) 3240 3238 { 3241 3239 /* Return directory object to the caller. */ … … 3244 3242 else 3245 3243 { 3246 switch ( rc)3244 switch (vrc) 3247 3245 { 3248 3246 case VERR_INVALID_PARAMETER: 3249 hrc = setError (VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed; invalid parameters given"),3250 3247 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening directory \"%s\" failed; invalid parameters given"), 3248 aPath.c_str()); 3251 3249 break; 3252 3250 … … 3256 3254 3257 3255 default: 3258 hrc = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed: %Rrc"), 3259 aPath.c_str(),rc); 3256 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening directory \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 3260 3257 break; 3261 3258 } … … 3289 3286 { 3290 3287 case VERR_NOT_SUPPORTED: 3291 hrc = setError (VBOX_E_IPRT_ERROR,3292 tr("Handling removing guest directories not supported by installed Guest Additions"));3288 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 3289 tr("Handling removing guest directories not supported by installed Guest Additions")); 3293 3290 break; 3294 3291 … … 3298 3295 3299 3296 default: 3300 hrc = setError(VBOX_E_IPRT_ERROR, tr("Removing guest directory \"%s\" failed: %Rrc"), 3301 aPath.c_str(), vrc); 3297 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Removing guest directory \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 3302 3298 break; 3303 3299 } … … 3354 3350 { 3355 3351 case VERR_NOT_SUPPORTED: 3356 hrc = setError (VBOX_E_IPRT_ERROR,3357 tr("Handling removing guest directories recursively not supported by installed Guest Additions"));3352 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 3353 tr("Handling removing guest directories recursively not supported by installed Guest Additions")); 3358 3354 break; 3359 3355 … … 3363 3359 3364 3360 default: 3365 hrc = setError (VBOX_E_IPRT_ERROR, tr("Recursively removing guest directory \"%s\" failed: %Rrc"),3366 3361 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Recursively removing guest directory \"%s\" failed: %Rrc"), 3362 aPath.c_str(), vrc); 3367 3363 break; 3368 3364 } … … 3550 3546 3551 3547 default: 3552 hrc = setError (VBOX_E_IPRT_ERROR, tr("Querying file information for \"%s\" failed: %Rrc"),3553 3548 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Querying file information for \"%s\" failed: %Rrc"), 3549 aPath.c_str(), vrc); 3554 3550 break; 3555 3551 } … … 3662 3658 { 3663 3659 case VERR_NOT_SUPPORTED: 3664 hrc = setError (VBOX_E_IPRT_ERROR,3665 tr("Handling guest files not supported by installed Guest Additions"));3660 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 3661 tr("Handling guest files not supported by installed Guest Additions")); 3666 3662 break; 3667 3663 … … 3671 3667 3672 3668 default: 3673 hrc = setError(VBOX_E_IPRT_ERROR, tr("Opening guest file \"%s\" failed: %Rrc"), 3674 aPath.c_str(), vrc); 3669 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening guest file \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 3675 3670 break; 3676 3671 } … … 3701 3696 { 3702 3697 if (GuestProcess::i_isGuestError(vrc)) 3703 {3704 3698 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3705 }3706 3699 else 3707 hrc = setError (VBOX_E_IPRT_ERROR, tr("Querying file size failed: %Rrc"), vrc);3700 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Querying file size failed: %Rrc"), vrc); 3708 3701 } 3709 3702 … … 3787 3780 { 3788 3781 if (GuestProcess::i_isGuestError(vrc)) 3789 {3790 3782 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3791 }3792 3783 else 3793 3784 hrc = setErrorVrc(vrc, tr("Querying file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc); … … 3816 3807 { 3817 3808 if (GuestProcess::i_isGuestError(vrc)) 3818 {3819 3809 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3820 }3821 3810 else 3822 hrc = setError (VBOX_E_IPRT_ERROR, tr("Removing file \"%s\" failed: %Rrc"), aPath.c_str(), vrc);3811 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Removing file \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 3823 3812 } 3824 3813 … … 3868 3857 { 3869 3858 case VERR_NOT_SUPPORTED: 3870 hrc = setError (VBOX_E_IPRT_ERROR,3871 tr("Handling renaming guest directories not supported by installed Guest Additions"));3859 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 3860 tr("Handling renaming guest directories not supported by installed Guest Additions")); 3872 3861 break; 3873 3862 3874 3863 case VERR_GSTCTL_GUEST_ERROR: 3875 hrc = setError(VBOX_E_IPRT_ERROR, 3876 tr("Renaming guest directory failed: %Rrc"), rcGuest); 3864 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, rcGuest, tr("Renaming guest directory failed: %Rrc"), rcGuest); 3877 3865 break; 3878 3866 3879 3867 default: 3880 hrc = setError (VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"),3881 3868 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Renaming guest directory \"%s\" failed: %Rrc"), 3869 aSource.c_str(), vrc); 3882 3870 break; 3883 3871 } … … 4101 4089 { 4102 4090 const char *pszSessionName = mData.mSession.mName.c_str(); 4103 hrc = setError (VBOX_E_IPRT_ERROR,4104 tr("Waiting for guest session \"%s\" failed: %Rrc"),4105 pszSessionName ? pszSessionName : tr("Unnamed"), vrc);4091 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 4092 tr("Waiting for guest session \"%s\" failed: %Rrc"), 4093 pszSessionName ? pszSessionName : tr("Unnamed"), vrc); 4106 4094 break; 4107 4095 } -
trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
r69500 r73003 215 215 216 216 if (RT_FAILURE(vrc)) 217 return setError (VBOX_E_IPRT_ERROR,218 tr("Could not send all scan codes to the virtual keyboard (%Rrc)"),219 vrc);217 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 218 tr("Could not send all scan codes to the virtual keyboard (%Rrc)"), 219 vrc); 220 220 221 221 return S_OK; -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r72328 r73003 215 215 int vrc = EMR3SetExecutionPolicy(ptrVM.rawUVM(), enmPolicy, fEnforce != FALSE); 216 216 if (RT_FAILURE(vrc)) 217 hrc = setError (VBOX_E_VM_ERROR, tr("EMR3SetExecutionPolicy failed with %Rrc"), vrc);217 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("EMR3SetExecutionPolicy failed with %Rrc"), vrc); 218 218 } 219 219 } … … 338 338 int vrc = PATMR3AllowPatching(ptrVM.rawUVM(), RT_BOOL(aPATMEnabled)); 339 339 if (RT_FAILURE(vrc)) 340 return setError (VBOX_E_VM_ERROR, tr("PATMR3AllowPatching returned %Rrc"), vrc);340 return setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("PATMR3AllowPatching returned %Rrc"), vrc); 341 341 342 342 #else /* !VBOX_WITH_RAW_MODE */ 343 343 if (aPATMEnabled) 344 return setError (VBOX_E_VM_ERROR, tr("PATM not present"), VERR_NOT_SUPPORTED);344 return setErrorBoth(VBOX_E_VM_ERROR, VERR_RAW_MODE_NOT_SUPPORTED, tr("PATM not present"), VERR_NOT_SUPPORTED); 345 345 #endif /* !VBOX_WITH_RAW_MODE */ 346 346 return S_OK; … … 395 395 int vrc = CSAMR3SetScanningEnabled(ptrVM.rawUVM(), aCSAMEnabled != FALSE); 396 396 if (RT_FAILURE(vrc)) 397 return setError (VBOX_E_VM_ERROR, tr("CSAMR3SetScanningEnabled returned %Rrc"), vrc);397 return setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("CSAMR3SetScanningEnabled returned %Rrc"), vrc); 398 398 399 399 #else /* !VBOX_WITH_RAW_MODE */ 400 400 if (aCSAMEnabled) 401 return setError (VBOX_E_VM_ERROR, tr("CASM not present"), VERR_NOT_SUPPORTED);401 return setErrorBoth(VBOX_E_VM_ERROR, VERR_RAW_MODE_NOT_SUPPORTED, tr("CASM not present")); 402 402 #endif /* !VBOX_WITH_RAW_MODE */ 403 403 return S_OK; … … 490 490 } 491 491 *pstrSettings = ""; 492 AssertReturn(vrc == VERR_BUFFER_OVERFLOW, setError(VBOX_E_IPRT_ERROR, tr("%s returned %Rrc"), pszLogGetStr, vrc)); 492 AssertReturn(vrc == VERR_BUFFER_OVERFLOW, 493 setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("%s returned %Rrc"), pszLogGetStr, vrc)); 493 494 } 494 495 else … … 669 670 } 670 671 else 671 hrc = setError (VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc);672 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); 672 673 } 673 674 return hrc; … … 700 701 } 701 702 else 702 hrc = setError (VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc);703 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc); 703 704 } 704 705 return hrc; … … 771 772 int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), aVirtualTimeRate); 772 773 if (RT_FAILURE(vrc)) 773 hrc = setError (VBOX_E_VM_ERROR, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), aVirtualTimeRate, vrc);774 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), aVirtualTimeRate, vrc); 774 775 } 775 776 } … … 844 845 hrc = S_OK; 845 846 else 846 hrc = setError (E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc);847 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3CoreWrite failed with %Rrc"), vrc); 847 848 } 848 849 … … 1010 1011 } 1011 1012 else 1012 hrc = setError (VBOX_E_VM_ERROR, tr("DBGFR3Info failed with %Rrc"), vrc);1013 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3Info failed with %Rrc"), vrc); 1013 1014 MachineDebuggerInfoDelete(&Hlp); 1014 1015 } … … 1030 1031 hrc = S_OK; 1031 1032 else 1032 hrc = setError (E_FAIL, tr("DBGFR3InjectNMI failed with %Rrc"), vrc);1033 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3InjectNMI failed with %Rrc"), vrc); 1033 1034 } 1034 1035 return hrc; … … 1047 1048 hrc = S_OK; 1048 1049 else 1049 hrc = setError (E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc);1050 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc); 1050 1051 } 1051 1052 return hrc; … … 1064 1065 hrc = S_OK; 1065 1066 else 1066 hrc = setError (E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc);1067 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc); 1067 1068 } 1068 1069 return hrc; … … 1081 1082 hrc = S_OK; 1082 1083 else 1083 hrc = setError (E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc);1084 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc); 1084 1085 } 1085 1086 return hrc; … … 1223 1224 } 1224 1225 else 1225 hrc = setError (VBOX_E_VM_ERROR, tr("DBGFR3OSDetect failed with %Rrc"), vrc);1226 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("DBGFR3OSDetect failed with %Rrc"), vrc); 1226 1227 } 1227 1228 return hrc; … … 1327 1328 } 1328 1329 else if (vrc == VERR_DBGF_REGISTER_NOT_FOUND) 1329 hrc = setError (E_FAIL, tr("Register '%s' was not found"), aName.c_str());1330 hrc = setErrorBoth(E_FAIL, vrc, tr("Register '%s' was not found"), aName.c_str()); 1330 1331 else if (vrc == VERR_INVALID_CPU_ID) 1331 hrc = setError (E_FAIL, tr("Invalid CPU ID: %u"), aCpuId);1332 hrc = setErrorBoth(E_FAIL, vrc, tr("Invalid CPU ID: %u"), aCpuId); 1332 1333 else 1333 hrc = setError (VBOX_E_VM_ERROR,1334 tr("DBGFR3RegNmQuery failed with rc=%Rrc querying register '%s' with default cpu set to %u"),1335 vrc, aName.c_str(), aCpuId);1334 hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, 1335 tr("DBGFR3RegNmQuery failed with rc=%Rrc querying register '%s' with default cpu set to %u"), 1336 vrc, aName.c_str(), aCpuId); 1336 1337 } 1337 1338 … … 1386 1387 } 1387 1388 else 1388 hrc = setError (E_FAIL, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc);1389 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc); 1389 1390 1390 1391 RTMemFree(paRegs); … … 1394 1395 } 1395 1396 else 1396 hrc = setError (E_FAIL, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc);1397 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc); 1397 1398 } 1398 1399 return hrc; … … 1537 1538 } 1538 1539 else 1539 hrc = setError (E_FAIL, tr("DBGFR3StackWalkBegin failed with %Rrc"), vrc);1540 hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3StackWalkBegin failed with %Rrc"), vrc); 1540 1541 1541 1542 /* … … 1549 1550 } 1550 1551 else 1551 hrc = setError (E_FAIL, tr("Suspending the VM failed with %Rrc\n"), vrc);1552 hrc = setErrorBoth(E_FAIL, vrc, tr("Suspending the VM failed with %Rrc\n"), vrc); 1552 1553 } 1553 1554 -
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r69500 r73003 504 504 505 505 if (RT_FAILURE(vrc)) 506 return setError (VBOX_E_IPRT_ERROR,507 tr("Could not send the mouse event to the virtual mouse (%Rrc)"),508 vrc);506 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 507 tr("Could not send the mouse event to the virtual mouse (%Rrc)"), 508 vrc); 509 509 mfLastButtons = fButtons; 510 510 } … … 547 547 dw, fButtons); 548 548 if (RT_FAILURE(vrc)) 549 return setError (VBOX_E_IPRT_ERROR,550 tr("Could not send the mouse event to the virtual mouse (%Rrc)"),551 vrc);549 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 550 tr("Could not send the mouse event to the virtual mouse (%Rrc)"), 551 vrc); 552 552 mfLastButtons = fButtons; 553 553 … … 582 582 int vrc = pUpPort->pfnPutEventMultiTouch(pUpPort, cContacts, pau64Contacts, u32ScanTime); 583 583 if (RT_FAILURE(vrc)) 584 hrc = setError (VBOX_E_IPRT_ERROR,585 tr("Could not send the multi-touch event to the virtual device (%Rrc)"),586 vrc);584 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 585 tr("Could not send the multi-touch event to the virtual device (%Rrc)"), 586 vrc); 587 587 } 588 588 else … … 613 613 x, y); 614 614 if (RT_FAILURE(vrc)) 615 return setError (VBOX_E_IPRT_ERROR,616 tr("Could not send the mouse event to the virtual mouse (%Rrc)"),617 vrc);615 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 616 tr("Could not send the mouse event to the virtual mouse (%Rrc)"), 617 vrc); 618 618 } 619 619 return S_OK; -
trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
r71179 r73003 145 145 { 146 146 mData.m_SemEvWatcher = NIL_RTSEMEVENT; 147 AssertRCStmt(vrc, throw setError (VBOX_E_IPRT_ERROR, tr("Failed to create semaphore (rc=%Rrc)"), vrc));147 AssertRCStmt(vrc, throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to create semaphore (rc=%Rrc)"), vrc)); 148 148 } 149 149 … … 154 154 RTSemEventDestroy(mData.m_SemEvWatcher); 155 155 mData.m_SemEvWatcher = NIL_RTSEMEVENT; 156 AssertRCStmt(vrc, throw setError (VBOX_E_IPRT_ERROR, tr("Failed to create watcher thread (rc=%Rrc)"), vrc));156 AssertRCStmt(vrc, throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to create watcher thread (rc=%Rrc)"), vrc)); 157 157 } 158 158 } -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r72476 r73003 490 490 throw setError(VBOX_E_NOT_SUPPORTED, 491 491 tr("Cannot handle medium attachment: channel is %d, device is %d"), lChannel, lDevice); 492 break;492 break; 493 493 494 494 case StorageBus_SATA: 495 495 lChannelVsys = lChannel; // should be between 0 and 29 496 496 lControllerVsys = lSATAControllerIndex; 497 break;497 break; 498 498 499 499 case StorageBus_SCSI: … … 501 501 lChannelVsys = lChannel; // should be between 0 and 15 502 502 lControllerVsys = lSCSIControllerIndex; 503 break;503 break; 504 504 505 505 case StorageBus_Floppy: 506 506 lChannelVsys = 0; 507 507 lControllerVsys = 0; 508 break;508 break; 509 509 510 510 default: … … 512 512 tr("Cannot handle medium attachment: storageBus is %d, channel is %d, device is %d"), 513 513 storageBus, lChannel, lDevice); 514 break;515 514 } 516 515 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r72919 r73003 1843 1843 vrc = RTCrX509CertPathsSetTrustedStore(hCertPaths, hTrustedCerts); 1844 1844 if (RT_FAILURE(vrc)) 1845 hrc2 = setError (E_FAIL, tr("RTCrX509CertPathsSetTrustedStore failed (%Rrc)"), vrc);1845 hrc2 = setErrorBoth(E_FAIL, vrc, tr("RTCrX509CertPathsSetTrustedStore failed (%Rrc)"), vrc); 1846 1846 RTCrStoreRelease(hTrustedCerts); 1847 1847 } 1848 1848 else 1849 hrc2 = setError (E_FAIL,1850 tr("Failed to query trusted CAs and Certificates from the system and for the current user (%Rrc, %s)"),1851 vrc, StaticErrInfo.Core.pszMsg);1849 hrc2 = setErrorBoth(E_FAIL, vrc, 1850 tr("Failed to query trusted CAs and Certificates from the system and for the current user (%Rrc, %s)"), 1851 vrc, StaticErrInfo.Core.pszMsg); 1852 1852 1853 1853 /* Add untrusted intermediate certificates. */ … … 1913 1913 } 1914 1914 else 1915 hrc2 = setError (E_FAIL, tr("Certificate path validation failed (%Rrc, %s)"),1916 vrc, StaticErrInfo.Core.pszMsg);1915 hrc2 = setErrorBoth(E_FAIL, vrc, tr("Certificate path validation failed (%Rrc, %s)"), 1916 vrc, StaticErrInfo.Core.pszMsg); 1917 1917 } 1918 1918 else 1919 hrc2 = setError (E_FAIL, tr("Certificate path building failed (%Rrc, %s)"),1920 vrc, StaticErrInfo.Core.pszMsg);1919 hrc2 = setErrorBoth(E_FAIL, vrc, tr("Certificate path building failed (%Rrc, %s)"), 1920 vrc, StaticErrInfo.Core.pszMsg); 1921 1921 } 1922 1922 RTCrX509CertPathsRelease(hCertPaths); … … 2239 2239 NULL /*pszAttr*/, szDigest, fType); 2240 2240 if (RT_FAILURE(vrc)) 2241 return setError (VBOX_E_IPRT_ERROR, tr("Error fudging missing OVF digest in manifest: %Rrc"), vrc);2241 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Error fudging missing OVF digest in manifest: %Rrc"), vrc); 2242 2242 } 2243 2243 -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r69500 r73003 258 258 { 259 259 RTNETADDRIPV4 IPAddress, NetworkMask, LowerIP, UpperIP; 260 int rc; 261 262 rc = RTNetStrToIPv4Addr(aIPAddress.c_str(), &IPAddress); 263 if (RT_FAILURE(rc)) 264 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 265 "Invalid server address"); 266 267 rc = RTNetStrToIPv4Addr(aNetworkMask.c_str(), &NetworkMask); 268 if (RT_FAILURE(rc)) 269 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 270 "Invalid netmask"); 271 272 rc = RTNetStrToIPv4Addr(aLowerIP.c_str(), &LowerIP); 273 if (RT_FAILURE(rc)) 274 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 275 "Invalid range lower address"); 276 277 rc = RTNetStrToIPv4Addr(aUpperIP.c_str(), &UpperIP); 278 if (RT_FAILURE(rc)) 279 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 280 "Invalid range upper address"); 260 261 int vrc = RTNetStrToIPv4Addr(aIPAddress.c_str(), &IPAddress); 262 if (RT_FAILURE(vrc)) 263 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid server address"); 264 265 vrc = RTNetStrToIPv4Addr(aNetworkMask.c_str(), &NetworkMask); 266 if (RT_FAILURE(vrc)) 267 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid netmask"); 268 269 vrc = RTNetStrToIPv4Addr(aLowerIP.c_str(), &LowerIP); 270 if (RT_FAILURE(vrc)) 271 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid range lower address"); 272 273 vrc = RTNetStrToIPv4Addr(aUpperIP.c_str(), &UpperIP); 274 if (RT_FAILURE(vrc)) 275 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid range upper address"); 281 276 282 277 /* … … 284 279 * here or address/prefix for aIPAddress? 285 280 */ 286 rc = RTNetMaskToPrefixIPv4(&NetworkMask, NULL); 287 if (RT_FAILURE(rc)) 288 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 289 "Invalid netmask"); 281 vrc = RTNetMaskToPrefixIPv4(&NetworkMask, NULL); 282 if (RT_FAILURE(vrc)) 283 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid netmask"); 290 284 291 285 /* It's more convenient to convert to host order once */ … … 301 295 || (IPAddress.u & ~NetworkMask.u) == 0 302 296 || ((IPAddress.u & ~NetworkMask.u) | NetworkMask.u) == UINT32_C(0xffffffff)) 303 { 304 return mVirtualBox->setError(E_INVALIDARG, 305 "Invalid server address"); 306 } 297 return mVirtualBox->setError(E_INVALIDARG, "Invalid server address"); 307 298 308 299 if ( (LowerIP.u & UINT32_C(0xe0000000)) == UINT32_C(0xe0000000) … … 310 301 || (LowerIP.u & ~NetworkMask.u) == 0 311 302 || ((LowerIP.u & ~NetworkMask.u) | NetworkMask.u) == UINT32_C(0xffffffff)) 312 { 313 return mVirtualBox->setError(E_INVALIDARG, 314 "Invalid range lower address"); 315 } 303 return mVirtualBox->setError(E_INVALIDARG, "Invalid range lower address"); 316 304 317 305 if ( (UpperIP.u & UINT32_C(0xe0000000)) == UINT32_C(0xe0000000) … … 319 307 || (UpperIP.u & ~NetworkMask.u) == 0 320 308 || ((UpperIP.u & ~NetworkMask.u) | NetworkMask.u) == UINT32_C(0xffffffff)) 321 { 322 return mVirtualBox->setError(E_INVALIDARG, 323 "Invalid range upper address"); 324 } 309 return mVirtualBox->setError(E_INVALIDARG, "Invalid range upper address"); 325 310 326 311 /* The range should be valid ... */ 327 312 if (LowerIP.u > UpperIP.u) 328 return mVirtualBox->setError(E_INVALIDARG, 329 "Invalid range bounds"); 313 return mVirtualBox->setError(E_INVALIDARG, "Invalid range bounds"); 330 314 331 315 /* ... and shouldn't contain the server's address */ 332 316 if (LowerIP.u <= IPAddress.u && IPAddress.u <= UpperIP.u) 333 return mVirtualBox->setError(E_INVALIDARG, 334 "Server address within range bounds"); 317 return mVirtualBox->setError(E_INVALIDARG, "Server address within range bounds"); 335 318 336 319 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 416 399 { 417 400 uint8_t u8Code; 401 char *pszNext; 402 int vrc = RTStrToUInt8Ex(aValue.c_str(), &pszNext, 10, &u8Code); 403 if (!RT_SUCCESS(vrc)) 404 return VERR_PARSE_ERROR; 405 418 406 uint32_t u32Enc; 419 char *pszNext;420 int rc;421 422 rc = RTStrToUInt8Ex(aValue.c_str(), &pszNext, 10, &u8Code);423 if (!RT_SUCCESS(rc))424 return VERR_PARSE_ERROR;425 426 407 switch (*pszNext) 427 408 { … … 440 421 case '@': 441 422 { 442 rc = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &u32Enc);443 if (!RT_SUCCESS( rc))423 vrc = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &u32Enc); 424 if (!RT_SUCCESS(vrc)) 444 425 return VERR_PARSE_ERROR; 445 426 if (*pszNext != '=') -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r72980 r73003 474 474 mCaptureFilename = aCaptureFilename; 475 475 alock.release(); 476 int rc = mUSBProxyBackend->captureDevice(this);477 if (RT_FAILURE( rc))476 int vrc = mUSBProxyBackend->captureDevice(this); 477 if (RT_FAILURE(vrc)) 478 478 { 479 479 alock.acquire(); 480 480 i_failTransition(kHostUSBDeviceState_Invalid); 481 481 mMachine.setNull(); 482 if ( rc == VERR_SHARING_VIOLATION)483 return setError (E_FAIL,484 tr("USB device '%s' with UUID {%RTuuid} is in use by someone else"),485 mName, mId.raw());482 if (vrc == VERR_SHARING_VIOLATION) 483 return setErrorBoth(E_FAIL, vrc, 484 tr("USB device '%s' with UUID {%RTuuid} is in use by someone else"), 485 mName, mId.raw()); 486 486 return E_FAIL; 487 487 } -
trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
r69500 r73003 184 184 PFNVBOXHOSTWEBCAMLIST pfn = NULL; 185 185 RTLDRMOD hmod = NIL_RTLDRMOD; 186 int rc = loadHostWebcamLibrary(strLibrary.c_str(), &hmod, &pfn);187 188 LogRel(("Load [%s] rc %Rrc\n", strLibrary.c_str(),rc));189 190 if (RT_SUCCESS( rc))186 int vrc = loadHostWebcamLibrary(strLibrary.c_str(), &hmod, &pfn); 187 188 LogRel(("Load [%s] vrc=%Rrc\n", strLibrary.c_str(), vrc)); 189 190 if (RT_SUCCESS(vrc)) 191 191 { 192 192 uint64_t u64Result = S_OK; 193 rc = pfn(hostWebcamAdd, pList, &u64Result);194 Log(("VBoxHostWebcamList rc %Rrc, result 0x%08X\n",rc, u64Result));195 if (RT_FAILURE( rc))193 vrc = pfn(hostWebcamAdd, pList, &u64Result); 194 Log(("VBoxHostWebcamList vrc %Rrc, result 0x%08X\n", vrc, u64Result)); 195 if (RT_FAILURE(vrc)) 196 196 { 197 197 hr = (HRESULT)u64Result; … … 204 204 if (SUCCEEDED(hr)) 205 205 { 206 if (RT_FAILURE(rc)) 207 hr = pVirtualBox->setError(VBOX_E_IPRT_ERROR, 208 "Failed to get webcam list: %Rrc", rc); 206 if (RT_FAILURE(vrc)) 207 hr = pVirtualBox->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, "Failed to get webcam list: %Rrc", vrc); 209 208 } 210 209 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r72919 r73003 641 641 int vrc1 = mParent->i_calculateFullPath(strConfigFile, mData->m_strConfigFileFull); 642 642 if (RT_FAILURE(vrc1)) 643 return setError (VBOX_E_FILE_ERROR,644 tr("Invalid machine settings file name '%s' (%Rrc)"),645 strConfigFile.c_str(),646 vrc1);643 return setErrorBoth(VBOX_E_FILE_ERROR, vrc1, 644 tr("Invalid machine settings file name '%s' (%Rrc)"), 645 strConfigFile.c_str(), 646 vrc1); 647 647 648 648 LogFlowThisFuncLeave(); … … 680 680 int vrc2 = RTFileDelete(mData->m_strConfigFileFull.c_str()); 681 681 if (RT_FAILURE(vrc2)) 682 rc = setError (VBOX_E_FILE_ERROR,683 tr("Could not delete the existing settings file '%s' (%Rrc)"),684 mData->m_strConfigFileFull.c_str(), vrc2);682 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc2, 683 tr("Could not delete the existing settings file '%s' (%Rrc)"), 684 mData->m_strConfigFileFull.c_str(), vrc2); 685 685 } 686 686 } … … 688 688 && vrc != VERR_PATH_NOT_FOUND 689 689 ) 690 rc = setError (VBOX_E_FILE_ERROR,691 tr("Invalid machine settings file name '%s' (%Rrc)"),692 mData->m_strConfigFileFull.c_str(),693 vrc);690 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, 691 tr("Invalid machine settings file name '%s' (%Rrc)"), 692 mData->m_strConfigFileFull.c_str(), 693 vrc); 694 694 return rc; 695 695 } … … 2664 2664 strSnapshotFolder); 2665 2665 if (RT_FAILURE(vrc)) 2666 return setError (E_FAIL,2667 tr("Invalid snapshot folder '%s' (%Rrc)"),2668 strSnapshotFolder.c_str(), vrc);2666 return setErrorBoth(E_FAIL, vrc, 2667 tr("Invalid snapshot folder '%s' (%Rrc)"), 2668 strSnapshotFolder.c_str(), vrc); 2669 2669 2670 2670 i_setModified(IsModified_MachineData); … … 4866 4866 case DeviceType_DVD: 4867 4867 case DeviceType_Floppy: 4868 break;4868 break; 4869 4869 4870 4870 default: … … 5493 5493 int vrc = RTFileDelete(strFile.c_str()); 5494 5494 if (RT_FAILURE(vrc)) 5495 throw setError (VBOX_E_IPRT_ERROR,5496 tr("Could not delete file '%s' (%Rrc)"), strFile.c_str(), vrc);5495 throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 5496 tr("Could not delete file '%s' (%Rrc)"), strFile.c_str(), vrc); 5497 5497 } 5498 5498 … … 6520 6520 *aEnabled = TRUE; 6521 6521 #endif 6522 return setError (VBOX_E_IPRT_ERROR,6523 tr("Saved guest size is not available (%Rrc)"),6524 vrc);6522 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6523 tr("Saved guest size is not available (%Rrc)"), 6524 vrc); 6525 6525 } 6526 6526 … … 6557 6557 6558 6558 if (RT_FAILURE(vrc)) 6559 return setError (VBOX_E_IPRT_ERROR,6560 tr("Saved thumbnail data is not available (%Rrc)"),6561 vrc);6559 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6560 tr("Saved thumbnail data is not available (%Rrc)"), 6561 vrc); 6562 6562 6563 6563 HRESULT hr = S_OK; … … 6615 6615 } 6616 6616 else 6617 hr = setError (VBOX_E_IPRT_ERROR,6618 tr("Could not convert saved thumbnail to PNG (%Rrc)"),6619 vrc);6617 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6618 tr("Could not convert saved thumbnail to PNG (%Rrc)"), 6619 vrc); 6620 6620 6621 6621 RTMemFree(pu8PNG); … … 6646 6646 6647 6647 if (RT_FAILURE(vrc)) 6648 return setError (VBOX_E_IPRT_ERROR,6649 tr("Saved screenshot data is not available (%Rrc)"),6650 vrc);6648 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6649 tr("Saved screenshot data is not available (%Rrc)"), 6650 vrc); 6651 6651 6652 6652 *aWidth = u32Width; … … 6682 6682 6683 6683 if (RT_FAILURE(vrc)) 6684 return setError (VBOX_E_IPRT_ERROR,6685 tr("Saved screenshot thumbnail data is not available (%Rrc)"),6686 vrc);6684 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6685 tr("Saved screenshot thumbnail data is not available (%Rrc)"), 6686 vrc); 6687 6687 6688 6688 *aWidth = u32Width; … … 6828 6828 aData.resize(cbData); 6829 6829 else 6830 rc = setError(VBOX_E_IPRT_ERROR, 6831 tr("Could not read log file '%s' (%Rrc)"), 6830 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6831 tr("Could not read log file '%s' (%Rrc)"), 6832 log.c_str(), vrc); 6833 RTFileClose(LogFile); 6834 } 6835 else 6836 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6837 tr("Could not open log file '%s' (%Rrc)"), 6832 6838 log.c_str(), vrc); 6833 RTFileClose(LogFile);6834 }6835 else6836 rc = setError(VBOX_E_IPRT_ERROR,6837 tr("Could not open log file '%s' (%Rrc)"),6838 log.c_str(), vrc);6839 6839 6840 6840 if (FAILED(rc)) … … 7950 7950 7951 7951 if (RT_FAILURE(vrc)) 7952 return setError (VBOX_E_IPRT_ERROR,7953 tr("Could not launch a process for the machine '%s' (%Rrc)"),7954 mUserData->s.strName.c_str(), vrc);7952 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 7953 tr("Could not launch a process for the machine '%s' (%Rrc)"), 7954 mUserData->s.strName.c_str(), vrc); 7955 7955 7956 7956 LogFlowThisFunc(("launched.pid=%d(0x%x)\n", pid, pid)); … … 8150 8150 i_getName().c_str(), status.iStatus, strExtraInfo.c_str()); 8151 8151 else 8152 rc = setError (E_FAIL,8153 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"),8154 i_getName().c_str(), vrc, strExtraInfo.c_str());8152 rc = setErrorBoth(E_FAIL, vrc, 8153 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"), 8154 i_getName().c_str(), vrc, strExtraInfo.c_str()); 8155 8155 } 8156 8156 … … 8856 8856 int vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull); 8857 8857 if (RT_FAILURE(vrc)) 8858 return setError (E_FAIL,8859 tr("Invalid saved state file path '%s' (%Rrc)"),8860 config.strStateFile.c_str(),8861 vrc);8858 return setErrorBoth(E_FAIL, vrc, 8859 tr("Invalid saved state file path '%s' (%Rrc)"), 8860 config.strStateFile.c_str(), 8861 vrc); 8862 8862 mSSData->strStateFilePath = stateFilePathFull; 8863 8863 } … … 8966 8966 int vrc = i_calculateFullPath(strStateFile, strStateFile); 8967 8967 if (RT_FAILURE(vrc)) 8968 return setError (E_FAIL,8969 tr("Invalid saved state file path '%s' (%Rrc)"),8970 strStateFile.c_str(),8971 vrc);8968 return setErrorBoth(E_FAIL, vrc, 8969 tr("Invalid saved state file path '%s' (%Rrc)"), 8970 strStateFile.c_str(), 8971 vrc); 8972 8972 } 8973 8973 … … 9951 9951 if (RT_FAILURE(vrc)) 9952 9952 { 9953 rc = setError (E_FAIL,9954 tr("Could not rename the directory '%s' to '%s' to save the settings file (%Rrc)"),9955 configDir.c_str(),9956 newConfigDir.c_str(),9957 vrc);9953 rc = setErrorBoth(E_FAIL, vrc, 9954 tr("Could not rename the directory '%s' to '%s' to save the settings file (%Rrc)"), 9955 configDir.c_str(), 9956 newConfigDir.c_str(), 9957 vrc); 9958 9958 break; 9959 9959 } … … 9989 9989 if (RT_FAILURE(vrc)) 9990 9990 { 9991 rc = setError (E_FAIL,9992 tr("Could not rename the settings file '%s' to '%s' (%Rrc)"),9993 configFile.c_str(),9994 newConfigFile.c_str(),9995 vrc);9991 rc = setErrorBoth(E_FAIL, vrc, 9992 tr("Could not rename the settings file '%s' to '%s' (%Rrc)"), 9993 configFile.c_str(), 9994 newConfigFile.c_str(), 9995 vrc); 9996 9996 break; 9997 9997 } … … 10063 10063 if (RT_FAILURE(vrc)) 10064 10064 { 10065 return setError (E_FAIL,10066 tr("Could not create a directory '%s' to save the settings file (%Rrc)"),10067 path.c_str(),10068 vrc);10065 return setErrorBoth(E_FAIL, vrc, 10066 tr("Could not create a directory '%s' to save the settings file (%Rrc)"), 10067 path.c_str(), 10068 vrc); 10069 10069 } 10070 10070 } … … 10076 10076 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE); 10077 10077 if (RT_FAILURE(vrc)) 10078 return setError (E_FAIL,10079 tr("Could not create the settings file '%s' (%Rrc)"),10080 path.c_str(),10081 vrc);10078 return setErrorBoth(E_FAIL, vrc, 10079 tr("Could not create the settings file '%s' (%Rrc)"), 10080 path.c_str(), 10081 vrc); 10082 10082 RTFileClose(f); 10083 10083 } … … 13274 13274 int vrc = i_calculateFullPath(aSavedStateFile, stateFilePathFull); 13275 13275 if (RT_FAILURE(vrc)) 13276 return setError (VBOX_E_FILE_ERROR,13277 tr("Invalid saved state file path '%s' (%Rrc)"),13278 aSavedStateFile.c_str(),13279 vrc);13276 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, 13277 tr("Invalid saved state file path '%s' (%Rrc)"), 13278 aSavedStateFile.c_str(), 13279 vrc); 13280 13280 13281 13281 mSSData->strStateFilePath = stateFilePathFull; … … 13927 13927 Utf8Str filename = authLibrary; 13928 13928 13929 int rc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 13930 if (RT_FAILURE(rc)) 13931 { 13932 hr = setError(E_FAIL, 13933 tr("Could not load the external authentication library '%s' (%Rrc)"), 13934 filename.c_str(), rc); 13935 } 13929 int vrc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 13930 if (RT_FAILURE(vrc)) 13931 hr = setErrorBoth(E_FAIL, vrc, 13932 tr("Could not load the external authentication library '%s' (%Rrc)"), 13933 filename.c_str(), vrc); 13936 13934 } 13937 13935 -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r72973 r73003 221 221 int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize); 222 222 if (RT_FAILURE(vrc)) 223 return p->setError (VBOX_E_IPRT_ERROR, p->tr("Could not query file size of '%s' (%Rrc)"),224 sst.strSaveStateFile.c_str(), vrc);225 /* same rule as above: count both the data which needs to223 return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"), 224 sst.strSaveStateFile.c_str(), vrc); 225 /* same rule as above: count both the data which needs to 226 226 * be read and written */ 227 227 sst.uWeight = (ULONG)(2 * (cbSize + _1M - 1) / _1M); … … 965 965 966 966 if (RT_FAILURE(vrc)) 967 p->setError (VBOX_E_IPRT_ERROR, "Could not create machine clone thread (%Rrc)", vrc);967 p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, "Could not create machine clone thread (%Rrc)", vrc); 968 968 } 969 969 catch (HRESULT rc2) … … 1393 1393 int vrc = RTDirCreateFullPath(strTrgSnapshotFolder.c_str(), 0700); 1394 1394 if (RT_FAILURE(vrc)) 1395 throw p->setError (VBOX_E_IPRT_ERROR,1396 p->tr("Could not create snapshots folder '%s' (%Rrc)"),1397 strTrgSnapshotFolder.c_str(), vrc);1395 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1396 p->tr("Could not create snapshots folder '%s' (%Rrc)"), 1397 strTrgSnapshotFolder.c_str(), vrc); 1398 1398 } 1399 1399 /* Clone all save state files. */ … … 1414 1414 MachineCloneVMPrivate::copyStateFileProgress, &d->pProgress); 1415 1415 if (RT_FAILURE(vrc)) 1416 throw p->setError (VBOX_E_IPRT_ERROR,1417 p->tr("Could not copy state file '%s' to '%s' (%Rrc)"),1418 1416 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1417 p->tr("Could not copy state file '%s' to '%s' (%Rrc)"), 1418 sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), vrc); 1419 1419 newFiles.append(strTrgSaveState); 1420 1420 } … … 1507 1507 vrc = RTFileDelete(newFiles.at(i).c_str()); 1508 1508 if (RT_FAILURE(vrc)) 1509 mrc = p->setError(VBOX_E_IPRT_ERROR, p->tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc); 1509 mrc = p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1510 p->tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc); 1510 1511 } 1511 1512 /* Delete all already created medias. (Reverse, cause there could be -
trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
r72841 r73003 185 185 strTargetFolder.c_str()); 186 186 errorsList.push_back(ErrorInfoItem(E_FAIL, errorDesc.c_str())); 187 rc = m_pMachine->setError (E_FAIL, m_pMachine->tr(errorDesc.c_str()));187 rc = m_pMachine->setErrorBoth(E_FAIL, vrc, m_pMachine->tr(errorDesc.c_str())); 188 188 throw rc; 189 189 } … … 204 204 "the destination folder.", strTargetFolder.c_str()); 205 205 errorsList.push_back(ErrorInfoItem(HRESULT(vrc), errorDesc.c_str())); 206 rc = m_pMachine->setError(vrc, m_pMachine->tr(errorDesc.c_str())); 207 206 rc = m_pMachine->setErrorBoth(VBOX_E_FILE_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 208 207 } 209 208 … … 493 492 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 494 493 495 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));494 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str())); 496 495 } 497 496 } … … 658 657 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 659 658 660 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));659 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 661 660 } 662 661 } … … 682 681 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 683 682 684 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));683 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 685 684 } 686 685 … … 731 730 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 732 731 733 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));732 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 734 733 } 735 734 LogRelFunc(("Created a home machine folder %s\n", strTargetSettingsFilePath.c_str())); … … 755 754 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 756 755 757 throw machine->setError (VBOX_E_IPRT_ERROR, machine->tr(errorDesc.c_str()));756 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 758 757 } 759 758 … … 789 788 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 790 789 791 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));790 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 792 791 } 793 792 LogRelFunc(("Created a log machine folder %s\n", strTargetLogFolderPath.c_str())); … … 807 806 /* Move to next sub-operation. */ 808 807 rc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(machine->tr("Copying the log file '%s' ..."), 809 RTPathFilename(strFullSourceFilePath.c_str())).raw(), 1); 808 RTPathFilename(strFullSourceFilePath.c_str())).raw(), 809 1); 810 810 if (FAILED(rc)) throw rc; 811 811 812 812 int vrc = RTFileCopyEx(strFullSourceFilePath.c_str(), strFullTargetFilePath.c_str(), 0, 813 MachineMoveVM::copyFileProgress, &taskMoveVM->m_pProgress);813 MachineMoveVM::copyFileProgress, &taskMoveVM->m_pProgress); 814 814 if (RT_FAILURE(vrc)) 815 815 { … … 820 820 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 821 821 822 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));822 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 823 823 } 824 824 825 825 LogRelFunc(("The log file %s has been copied into the folder %s\n", strFullSourceFilePath.c_str(), 826 826 strFullTargetFilePath.stripFilename().c_str())); 827 827 828 828 /* save new file in case of restoring */ … … 1232 1232 1233 1233 vrc = RTDirClose(hDir); 1234 AssertRC(vrc); 1234 1235 } 1235 1236 else if (vrc == VERR_FILE_NOT_FOUND) … … 1238 1239 errorsList.push_back(ErrorInfoItem(VERR_FILE_NOT_FOUND, errorDesc.c_str())); 1239 1240 1240 m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str())); 1241 rc = vrc; 1241 rc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1242 1242 } 1243 1243 else … … 1246 1246 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1247 1247 1248 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str())); 1248 /** @todo r=bird: document this throwing business, please! Error handling is 1249 * a bit fishy here. See also */ 1250 throw m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1249 1251 } 1250 1252 … … 1270 1272 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1271 1273 1272 rc = m_pMachine->setError (VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));1274 rc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1273 1275 } 1274 1276 else … … 1317 1319 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1318 1320 1319 throw m_pMachine->setError (VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));1321 throw m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1320 1322 } 1321 1323 ++it; … … 1326 1328 else 1327 1329 { 1328 Utf8StrFmt errorDesc("Could not calculate the size of folder '%s' (%Rrc)", strRootFolder.c_str(), vrc); 1330 /** @todo r=bird: This only happens if RTDirOpen fails. So, I'm not sure 1331 * what you're going for here... See not about throwing in getFilesList(). */ 1332 Utf8StrFmt errorDesc("Could not calculate the size of folder '%s'", strRootFolder.c_str()); 1329 1333 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1330 1334 … … 1502 1506 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1503 1507 1504 return m_pMachine->setError (VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));1508 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1505 1509 } 1506 1510 /* same rule as above: count both the data which needs to -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r72999 r73003 3610 3610 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 3611 3611 if (RT_FAILURE(vrc)) 3612 throw setError (VBOX_E_NOT_SUPPORTED,3613 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),3614 i_vdError(vrc).c_str());3612 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 3613 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"), 3614 i_vdError(vrc).c_str()); 3615 3615 } 3616 3616 else … … 3633 3633 vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ | VD_FILTER_FLAGS_INFO, CryptoSettings.vdFilterIfaces); 3634 3634 if (RT_FAILURE(vrc)) 3635 throw setError (VBOX_E_INVALID_OBJECT_STATE,3636 tr("Failed to load the encryption filter: %s"),3637 i_vdError(vrc).c_str());3635 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, 3636 tr("Failed to load the encryption filter: %s"), 3637 i_vdError(vrc).c_str()); 3638 3638 3639 3639 it = pBase->m->mapProperties.find("CRYPT/KeyId"); … … 3686 3686 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 3687 3687 if (RT_FAILURE(vrc)) 3688 throw setError (VBOX_E_NOT_SUPPORTED,3689 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),3690 i_vdError(vrc).c_str());3688 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 3689 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"), 3690 i_vdError(vrc).c_str()); 3691 3691 } 3692 3692 else … … 3713 3713 tr("The given password is incorrect")); 3714 3714 else if (RT_FAILURE(vrc)) 3715 throw setError (VBOX_E_INVALID_OBJECT_STATE,3716 tr("Failed to load the encryption filter: %s"),3717 i_vdError(vrc).c_str());3715 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, 3716 tr("Failed to load the encryption filter: %s"), 3717 i_vdError(vrc).c_str()); 3718 3718 3719 3719 VDDestroy(pDisk); … … 6085 6085 catch (int aVRC) 6086 6086 { 6087 rc = setError (E_FAIL,6088 tr("Could not update medium UUID references to parent '%s' (%s)"),6089 m->strLocationFull.c_str(),6090 i_vdError(aVRC).c_str());6087 rc = setErrorBoth(E_FAIL, aVRC, 6088 tr("Could not update medium UUID references to parent '%s' (%s)"), 6089 m->strLocationFull.c_str(), 6090 i_vdError(aVRC).c_str()); 6091 6091 } 6092 6092 … … 7425 7425 { 7426 7426 if (vrc == VERR_ACCESS_DENIED) 7427 return setError (VBOX_E_FILE_ERROR,7428 tr("Permission problem accessing the file for the medium '%s' (%Rrc)"),7429 locationFull.c_str(), vrc);7427 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, 7428 tr("Permission problem accessing the file for the medium '%s' (%Rrc)"), 7429 locationFull.c_str(), vrc); 7430 7430 else if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND) 7431 return setError (VBOX_E_FILE_ERROR,7432 tr("Could not find file for the medium '%s' (%Rrc)"),7433 locationFull.c_str(), vrc);7431 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, 7432 tr("Could not find file for the medium '%s' (%Rrc)"), 7433 locationFull.c_str(), vrc); 7434 7434 else if (aFormat.isEmpty()) 7435 return setError (VBOX_E_IPRT_ERROR,7436 tr("Could not get the storage format of the medium '%s' (%Rrc)"),7437 locationFull.c_str(), vrc);7435 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 7436 tr("Could not get the storage format of the medium '%s' (%Rrc)"), 7437 locationFull.c_str(), vrc); 7438 7438 else 7439 7439 { … … 8046 8046 vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 8047 8047 if (RT_FAILURE(vrc)) 8048 throw setError (VBOX_E_NOT_SUPPORTED,8049 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),8050 i_vdError(vrc).c_str());8048 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 8049 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"), 8050 i_vdError(vrc).c_str()); 8051 8051 } 8052 8052 else … … 8087 8087 pKeyStore->releaseSecretKey(itKeyId->second); 8088 8088 if (vrc == VERR_VD_PASSWORD_INCORRECT) 8089 throw setError (VBOX_E_PASSWORD_INCORRECT, tr("The password to decrypt the image is incorrect"));8089 throw setErrorBoth(VBOX_E_PASSWORD_INCORRECT, vrc, tr("The password to decrypt the image is incorrect")); 8090 8090 if (RT_FAILURE(vrc)) 8091 throw setError (VBOX_E_INVALID_OBJECT_STATE, tr("Failed to load the decryption filter: %s"),8092 i_vdError(vrc).c_str());8091 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, tr("Failed to load the decryption filter: %s"), 8092 i_vdError(vrc).c_str()); 8093 8093 } 8094 8094 … … 8117 8117 pMedium->m->vdImageIfaces); 8118 8118 if (RT_FAILURE(vrc)) 8119 throw setError (VBOX_E_FILE_ERROR,8120 tr("Could not open the medium storage unit '%s'%s"),8121 pMedium->m->strLocationFull.c_str(),8122 i_vdError(vrc).c_str());8119 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8120 tr("Could not open the medium storage unit '%s'%s"), 8121 pMedium->m->strLocationFull.c_str(), 8122 i_vdError(vrc).c_str()); 8123 8123 } 8124 8124 … … 8405 8405 pMedium->m->vdImageIfaces); 8406 8406 if (RT_FAILURE(vrc)) 8407 throw setError (VBOX_E_FILE_ERROR,8408 tr("Could not open the medium storage unit '%s'%s"),8409 pMedium->m->strLocationFull.c_str(),8410 i_vdError(vrc).c_str());8407 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8408 tr("Could not open the medium storage unit '%s'%s"), 8409 pMedium->m->strLocationFull.c_str(), 8410 i_vdError(vrc).c_str()); 8411 8411 } 8412 8412 … … 8434 8434 { 8435 8435 if (vrc == VERR_VD_INVALID_TYPE) 8436 throw setError (VBOX_E_FILE_ERROR,8437 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"),8438 targetLocation.c_str(), i_vdError(vrc).c_str());8436 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8437 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"), 8438 targetLocation.c_str(), i_vdError(vrc).c_str()); 8439 8439 else 8440 throw setError (VBOX_E_FILE_ERROR,8441 tr("Could not create the differencing medium storage unit '%s'%s"),8442 targetLocation.c_str(), i_vdError(vrc).c_str());8440 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8441 tr("Could not create the differencing medium storage unit '%s'%s"), 8442 targetLocation.c_str(), i_vdError(vrc).c_str()); 8443 8443 } 8444 8444 … … 8687 8687 catch (int aVRC) 8688 8688 { 8689 rcTmp = setError (VBOX_E_FILE_ERROR,8690 tr("Could not merge the medium '%s' to '%s'%s"),8691 m->strLocationFull.c_str(),8692 pTarget->m->strLocationFull.c_str(),8693 i_vdError(aVRC).c_str());8689 rcTmp = setErrorBoth(VBOX_E_FILE_ERROR, aVRC, 8690 tr("Could not merge the medium '%s' to '%s'%s"), 8691 m->strLocationFull.c_str(), 8692 pTarget->m->strLocationFull.c_str(), 8693 i_vdError(aVRC).c_str()); 8694 8694 } 8695 8695 … … 8934 8934 pMedium->m->vdImageIfaces); 8935 8935 if (RT_FAILURE(vrc)) 8936 throw setError (VBOX_E_FILE_ERROR,8937 tr("Could not open the medium storage unit '%s'%s"),8938 pMedium->m->strLocationFull.c_str(),8939 i_vdError(vrc).c_str());8936 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8937 tr("Could not open the medium storage unit '%s'%s"), 8938 pMedium->m->strLocationFull.c_str(), 8939 i_vdError(vrc).c_str()); 8940 8940 } 8941 8941 … … 9004 9004 pMedium->m->vdImageIfaces); 9005 9005 if (RT_FAILURE(vrc)) 9006 throw setError (VBOX_E_FILE_ERROR,9007 tr("Could not open the medium storage unit '%s'%s"),9008 pMedium->m->strLocationFull.c_str(),9009 i_vdError(vrc).c_str());9006 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9007 tr("Could not open the medium storage unit '%s'%s"), 9008 pMedium->m->strLocationFull.c_str(), 9009 i_vdError(vrc).c_str()); 9010 9010 } 9011 9011 … … 9046 9046 } 9047 9047 if (RT_FAILURE(vrc)) 9048 throw setError (VBOX_E_FILE_ERROR,9049 tr("Could not create the clone medium '%s'%s"),9050 targetLocation.c_str(), i_vdError(vrc).c_str());9048 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9049 tr("Could not create the clone medium '%s'%s"), 9050 targetLocation.c_str(), i_vdError(vrc).c_str()); 9051 9051 9052 9052 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); … … 9245 9245 pMedium->m->vdImageIfaces); 9246 9246 if (RT_FAILURE(vrc)) 9247 throw setError (VBOX_E_FILE_ERROR,9248 tr("Could not open the medium storage unit '%s'%s"),9249 pMedium->m->strLocationFull.c_str(),9250 i_vdError(vrc).c_str());9247 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9248 tr("Could not open the medium storage unit '%s'%s"), 9249 pMedium->m->strLocationFull.c_str(), 9250 i_vdError(vrc).c_str()); 9251 9251 } 9252 9252 … … 9291 9291 NULL); 9292 9292 if (RT_FAILURE(vrc)) 9293 throw setError (VBOX_E_FILE_ERROR,9294 tr("Could not move medium '%s'%s"),9295 targetLocation.c_str(), i_vdError(vrc).c_str());9293 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9294 tr("Could not move medium '%s'%s"), 9295 targetLocation.c_str(), i_vdError(vrc).c_str()); 9296 9296 size = VDGetFileSize(hdd, VD_LAST_IMAGE); 9297 9297 logicalSize = VDGetSize(hdd, VD_LAST_IMAGE); … … 9383 9383 9384 9384 if (RT_FAILURE(vrc) && vrc != VERR_FILE_NOT_FOUND) 9385 throw setError (VBOX_E_FILE_ERROR,9386 tr("Could not delete the medium storage unit '%s'%s"),9387 location.c_str(), i_vdError(vrc).c_str());9385 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9386 tr("Could not delete the medium storage unit '%s'%s"), 9387 location.c_str(), i_vdError(vrc).c_str()); 9388 9388 9389 9389 } … … 9478 9478 pMedium->m->vdImageIfaces); 9479 9479 if (RT_FAILURE(vrc)) 9480 throw setError (VBOX_E_FILE_ERROR,9481 tr("Could not open the medium storage unit '%s'%s"),9482 pMedium->m->strLocationFull.c_str(),9483 i_vdError(vrc).c_str());9480 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9481 tr("Could not open the medium storage unit '%s'%s"), 9482 pMedium->m->strLocationFull.c_str(), 9483 i_vdError(vrc).c_str()); 9484 9484 9485 9485 /* Done when we hit the media which should be reset */ … … 9491 9491 vrc = VDClose(hdd, true /* fDelete */); 9492 9492 if (RT_FAILURE(vrc)) 9493 throw setError (VBOX_E_FILE_ERROR,9494 tr("Could not delete the medium storage unit '%s'%s"),9495 location.c_str(), i_vdError(vrc).c_str());9493 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9494 tr("Could not delete the medium storage unit '%s'%s"), 9495 location.c_str(), i_vdError(vrc).c_str()); 9496 9496 9497 9497 /* next, create it again */ … … 9502 9502 m->vdImageIfaces); 9503 9503 if (RT_FAILURE(vrc)) 9504 throw setError (VBOX_E_FILE_ERROR,9505 tr("Could not open the medium storage unit '%s'%s"),9506 parentLocation.c_str(), i_vdError(vrc).c_str());9504 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9505 tr("Could not open the medium storage unit '%s'%s"), 9506 parentLocation.c_str(), i_vdError(vrc).c_str()); 9507 9507 9508 9508 vrc = VDCreateDiff(hdd, … … 9520 9520 { 9521 9521 if (vrc == VERR_VD_INVALID_TYPE) 9522 throw setError (VBOX_E_FILE_ERROR,9523 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"),9524 location.c_str(), i_vdError(vrc).c_str());9522 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9523 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"), 9524 location.c_str(), i_vdError(vrc).c_str()); 9525 9525 else 9526 throw setError (VBOX_E_FILE_ERROR,9527 tr("Could not create the differencing medium storage unit '%s'%s"),9528 location.c_str(), i_vdError(vrc).c_str());9526 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9527 tr("Could not create the differencing medium storage unit '%s'%s"), 9528 location.c_str(), i_vdError(vrc).c_str()); 9529 9529 } 9530 9530 … … 9608 9608 pMedium->m->vdImageIfaces); 9609 9609 if (RT_FAILURE(vrc)) 9610 throw setError (VBOX_E_FILE_ERROR,9611 tr("Could not open the medium storage unit '%s'%s"),9612 pMedium->m->strLocationFull.c_str(),9613 i_vdError(vrc).c_str());9610 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9611 tr("Could not open the medium storage unit '%s'%s"), 9612 pMedium->m->strLocationFull.c_str(), 9613 i_vdError(vrc).c_str()); 9614 9614 } 9615 9615 … … 9625 9625 { 9626 9626 if (vrc == VERR_NOT_SUPPORTED) 9627 throw setError (VBOX_E_NOT_SUPPORTED,9628 tr("Compacting is not yet supported for medium '%s'"),9629 location.c_str());9627 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 9628 tr("Compacting is not yet supported for medium '%s'"), 9629 location.c_str()); 9630 9630 else if (vrc == VERR_NOT_IMPLEMENTED) 9631 throw setError (E_NOTIMPL,9632 tr("Compacting is not implemented, medium '%s'"),9633 location.c_str());9631 throw setErrorBoth(E_NOTIMPL, vrc, 9632 tr("Compacting is not implemented, medium '%s'"), 9633 location.c_str()); 9634 9634 else 9635 throw setError (VBOX_E_FILE_ERROR,9636 tr("Could not compact medium '%s'%s"),9637 location.c_str(),9638 i_vdError(vrc).c_str());9635 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9636 tr("Could not compact medium '%s'%s"), 9637 location.c_str(), 9638 i_vdError(vrc).c_str()); 9639 9639 } 9640 9640 } … … 9706 9706 pMedium->m->vdImageIfaces); 9707 9707 if (RT_FAILURE(vrc)) 9708 throw setError (VBOX_E_FILE_ERROR,9709 tr("Could not open the medium storage unit '%s'%s"),9710 pMedium->m->strLocationFull.c_str(),9711 i_vdError(vrc).c_str());9708 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9709 tr("Could not open the medium storage unit '%s'%s"), 9710 pMedium->m->strLocationFull.c_str(), 9711 i_vdError(vrc).c_str()); 9712 9712 } 9713 9713 … … 9724 9724 { 9725 9725 if (vrc == VERR_NOT_SUPPORTED) 9726 throw setError (VBOX_E_NOT_SUPPORTED,9727 tr("Resizing to new size %llu is not yet supported for medium '%s'"),9728 task.mSize, location.c_str());9726 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 9727 tr("Resizing to new size %llu is not yet supported for medium '%s'"), 9728 task.mSize, location.c_str()); 9729 9729 else if (vrc == VERR_NOT_IMPLEMENTED) 9730 throw setError (E_NOTIMPL,9731 tr("Resiting is not implemented, medium '%s'"),9732 location.c_str());9730 throw setErrorBoth(E_NOTIMPL, vrc, 9731 tr("Resiting is not implemented, medium '%s'"), 9732 location.c_str()); 9733 9733 else 9734 throw setError (VBOX_E_FILE_ERROR,9735 tr("Could not resize medium '%s'%s"),9736 location.c_str(),9737 i_vdError(vrc).c_str());9734 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9735 tr("Could not resize medium '%s'%s"), 9736 location.c_str(), 9737 i_vdError(vrc).c_str()); 9738 9738 } 9739 9739 size = VDGetFileSize(hdd, VD_LAST_IMAGE); … … 9828 9828 task.mVDImageIfaces); 9829 9829 if (RT_FAILURE(vrc)) 9830 throw setError (VBOX_E_FILE_ERROR,9831 tr("Could not open the medium storage unit '%s'%s"),9832 task.mFilename.c_str(),9833 i_vdError(vrc).c_str());9830 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9831 tr("Could not open the medium storage unit '%s'%s"), 9832 task.mFilename.c_str(), 9833 i_vdError(vrc).c_str()); 9834 9834 9835 9835 Utf8Str targetFormat(m->strFormat); … … 9896 9896 pMedium->m->vdImageIfaces); 9897 9897 if (RT_FAILURE(vrc)) 9898 throw setError (VBOX_E_FILE_ERROR,9899 tr("Could not open the medium storage unit '%s'%s"),9900 pMedium->m->strLocationFull.c_str(),9901 i_vdError(vrc).c_str());9898 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9899 tr("Could not open the medium storage unit '%s'%s"), 9900 pMedium->m->strLocationFull.c_str(), 9901 i_vdError(vrc).c_str()); 9902 9902 } 9903 9903 … … 9916 9916 task.mVDOperationIfaces); 9917 9917 if (RT_FAILURE(vrc)) 9918 throw setError (VBOX_E_FILE_ERROR,9919 tr("Could not create the imported medium '%s'%s"),9920 targetLocation.c_str(), i_vdError(vrc).c_str());9918 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9919 tr("Could not create the imported medium '%s'%s"), 9920 targetLocation.c_str(), i_vdError(vrc).c_str()); 9921 9921 9922 9922 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); … … 10094 10094 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 10095 10095 if (RT_FAILURE(vrc)) 10096 throw setError (VBOX_E_NOT_SUPPORTED,10097 tr("Encrypting the image failed because the encryption plugin could not be loaded (%s)"),10098 i_vdError(vrc).c_str());10096 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 10097 tr("Encrypting the image failed because the encryption plugin could not be loaded (%s)"), 10098 i_vdError(vrc).c_str()); 10099 10099 } 10100 10100 else … … 10172 10172 vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_WRITE, CryptoSettingsWrite.vdFilterIfaces); 10173 10173 if (RT_FAILURE(vrc)) 10174 throw setError (VBOX_E_INVALID_OBJECT_STATE,10175 tr("Failed to load the encryption filter: %s"),10176 i_vdError(vrc).c_str());10174 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, 10175 tr("Failed to load the encryption filter: %s"), 10176 i_vdError(vrc).c_str()); 10177 10177 } 10178 10178 else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty()) … … 10207 10207 pMedium->m->vdImageIfaces); 10208 10208 if (RT_FAILURE(vrc)) 10209 throw setError (VBOX_E_FILE_ERROR,10210 tr("Could not open the medium storage unit '%s'%s"),10211 pMedium->m->strLocationFull.c_str(),10212 i_vdError(vrc).c_str());10209 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 10210 tr("Could not open the medium storage unit '%s'%s"), 10211 pMedium->m->strLocationFull.c_str(), 10212 i_vdError(vrc).c_str()); 10213 10213 } 10214 10214 … … 10222 10222 vrc = VDPrepareWithFilters(pDisk, task.mVDOperationIfaces); 10223 10223 if (RT_FAILURE(vrc)) 10224 throw setError (VBOX_E_FILE_ERROR,10225 tr("Could not prepare disk images for encryption (%Rrc): %s"),10226 vrc, i_vdError(vrc).c_str());10224 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 10225 tr("Could not prepare disk images for encryption (%Rrc): %s"), 10226 vrc, i_vdError(vrc).c_str()); 10227 10227 10228 10228 thisLock.acquire(); -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r69500 r73003 1171 1171 int vrc = RTPathUserHome(szHome, sizeof(szHome)); 1172 1172 if (RT_FAILURE(vrc)) 1173 return setError (E_FAIL,1174 tr("Cannot determine user home directory (%Rrc)"),1175 vrc);1173 return setErrorBoth(E_FAIL, vrc, 1174 tr("Cannot determine user home directory (%Rrc)"), 1175 vrc); 1176 1176 strPath = szHome; 1177 1177 return S_OK; … … 1287 1287 m->strAutostartDatabasePath = aPath; 1288 1288 else 1289 rc = setError (E_FAIL,1290 tr("Cannot set the autostart database path (%Rrc)"),1291 vrc);1289 rc = setErrorBoth(E_FAIL, vrc, 1290 tr("Cannot set the autostart database path (%Rrc)"), 1291 vrc); 1292 1292 } 1293 1293 else … … 1297 1297 m->strAutostartDatabasePath = ""; 1298 1298 else 1299 rc = setError (E_FAIL,1300 tr("Deleting the autostart database path failed (%Rrc)"),1301 vrc);1299 rc = setErrorBoth(E_FAIL, vrc, 1300 tr("Deleting the autostart database path failed (%Rrc)"), 1301 vrc); 1302 1302 } 1303 1303 -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r72833 r73003 949 949 va_start(va, aText); 950 950 HRESULT rc = VirtualBoxBase::setErrorInternal(aResultCode, 951 952 953 954 955 951 COM_IIDOF(IHost), 952 "USBProxyService", 953 Utf8Str(aText, va), 954 false /* aWarning*/, 955 true /* aLogIt*/); 956 956 va_end(va); 957 957 return rc; -
trunk/src/VBox/Main/src-server/VFSExplorerImpl.cpp
r69753 r73003 319 319 } 320 320 else 321 rc = setError (VBOX_E_FILE_ERROR, tr ("Can't open directory '%s' (%Rrc)"), m->strPath.c_str(), vrc);321 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr ("Can't open directory '%s' (%Rrc)"), m->strPath.c_str(), vrc); 322 322 323 323 if (aTask->m_ptrProgress) … … 362 362 int vrc = RTPathJoin(szPath, sizeof(szPath), m->strPath.c_str(), (*it).c_str()); 363 363 if (RT_FAILURE(vrc)) 364 throw setError (E_FAIL, tr("Internal Error (%Rrc)"), vrc);364 throw setErrorBoth(E_FAIL, vrc, tr("Internal Error (%Rrc)"), vrc); 365 365 vrc = RTFileDelete(szPath); 366 366 if (RT_FAILURE(vrc)) 367 throw setError (VBOX_E_FILE_ERROR, tr("Can't delete file '%s' (%Rrc)"), szPath, vrc);367 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Can't delete file '%s' (%Rrc)"), szPath, vrc); 368 368 if (aTask->m_ptrProgress) 369 369 aTask->m_ptrProgress->SetCurrentOperationProgress((ULONG)(fPercentStep * (float)i)); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r72919 r73003 401 401 int vrc = com::GetVBoxUserHomeDirectory(szHomeDir, sizeof(szHomeDir)); 402 402 if (RT_FAILURE(vrc)) 403 throw setError (E_FAIL,404 tr("Could not create the VirtualBox home directory '%s' (%Rrc)"),405 szHomeDir, vrc);403 throw setErrorBoth(E_FAIL, vrc, 404 tr("Could not create the VirtualBox home directory '%s' (%Rrc)"), 405 szHomeDir, vrc); 406 406 407 407 unconst(m->strHomeDir) = szHomeDir; … … 2628 2628 if (RT_FAILURE(vrc)) 2629 2629 { 2630 rc = pTask->that->setError (E_FAIL, tr("Could not create the communication channel (%Rrc)"), vrc);2630 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not create the communication channel (%Rrc)"), vrc); 2631 2631 break; 2632 2632 } … … 2673 2673 * (pressing the Cancel button to close the Run As dialog) */ 2674 2674 if (vrc2 == VERR_CANCELLED) 2675 rc = pTask->that->setError (E_FAIL, tr("Operation canceled by the user"));2675 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Operation canceled by the user")); 2676 2676 else 2677 rc = pTask->that->setError (E_FAIL, tr("Could not launch a privileged process '%s' (%Rrc)"), exePath, vrc2);2677 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not launch a privileged process '%s' (%Rrc)"), exePath, vrc2); 2678 2678 break; 2679 2679 } … … 2685 2685 if (RT_FAILURE(vrc)) 2686 2686 { 2687 rc = pTask->that->setError (E_FAIL, tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc);2687 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc); 2688 2688 break; 2689 2689 } … … 2708 2708 if (SUCCEEDED(rc) && RT_FAILURE(vrc)) 2709 2709 { 2710 rc = pTask->that->setError (E_FAIL, tr("Could not operate the communication channel (%Rrc)"), vrc);2710 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not operate the communication channel (%Rrc)"), vrc); 2711 2711 break; 2712 2712 } … … 4856 4856 int vrc = RTDirCreateFullPath(strDir.c_str(), 0700); 4857 4857 if (RT_FAILURE(vrc)) 4858 return i_setErrorStatic (VBOX_E_IPRT_ERROR,4859 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),4860 strDir.c_str(),4861 vrc));4858 return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, vrc, 4859 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"), 4860 strDir.c_str(), 4861 vrc)); 4862 4862 } 4863 4863 else 4864 return i_setErrorStatic(VBOX_E_IPRT_ERROR, 4865 Utf8StrFmt(tr("Directory '%s' does not exist"), 4866 strDir.c_str())); 4864 return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, VERR_FILE_NOT_FOUND, 4865 Utf8StrFmt(tr("Directory '%s' does not exist"), strDir.c_str())); 4867 4866 } 4868 4867
Note:
See TracChangeset
for help on using the changeset viewer.