VirtualBox

Changeset 73003 in vbox for trunk/src


Ignore:
Timestamp:
Jul 9, 2018 11:09:32 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123555
Message:

Main: Use setErrorBoth when we've got a VBox status code handy. (The COM status codes aren't too specfic and this may help us decode error messages and provide an alternative to strstr for API clients. setErrorBoth isn't new, btw.)

Location:
trunk/src/VBox/Main
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r70766 r73003  
    257257
    258258    static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
     259    static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *pcsz, ...);
    259260    HRESULT i_setInvalidMachineStateError();
    260261
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r69783 r73003  
    352352                                 BOOL *aResult);
    353353
    354     static HRESULT i_setErrorStatic(HRESULT aResultCode,
    355                                     const Utf8Str &aText)
     354    static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const Utf8Str &aText)
    356355    {
    357         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     356        return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true, vrc);
    358357    }
    359358
  • trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp

    r69753 r73003  
    572572                    {
    573573                        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);
    575575                        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);
    577577                        break;
    578578                    }
     
    608608                                    }
    609609                                    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);
    613613                                }
    614614                                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);
    616616                                RTMemFree(pvFile);
    617617                            }
     
    620620                        }
    621621                        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);
    623623                        RTVfsIoStrmRelease(hVfsIos);
    624                             break;
     624                        break;
    625625                    }
    626626
     
    634634                hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s"), szError);
    635635        }
    636             else
     636        else
    637637            hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in '%s'"),
    638                                szName, m->strExtPackFile.c_str());
     638                           szName, m->strExtPackFile.c_str());
    639639    }
    640640    return hrc;
     
    872872                LogRel(("ExtPack pfnUninstall returned %Rrc for %s\n", vrc, m->Desc.strName.c_str()));
    873873                if (!a_fForcedRemoval)
    874                     hrc = setError(E_FAIL, tr("pfnUninstall returned %Rrc"), vrc);
     874                    hrc = setErrorBoth(E_FAIL, vrc, tr("pfnUninstall returned %Rrc"), vrc);
    875875            }
    876876        }
     
    18701870            }
    18711871            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());
    18741874            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);
    18761876        }
    18771877        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);
    18791879    }
    18801880    return hrc;
     
    21322132            else
    21332133                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);
    21352135        }
    21362136        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"));
    21392138    }
    21402139    catch (std::bad_alloc &)
     
    24152414    }
    24162415    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);
    24182417
    24192418    RTPipeClose(hPipeR);
     
    27412740                                                    "--forced",
    27422741                                                    (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);
    27452744                    }
    27462745                }
  • trunk/src/VBox/Main/src-all/ProgressImpl.cpp

    r69500 r73003  
    708708
    709709    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"));
    712711
    713712    *aResultCode = mResultCode;
     
    721720
    722721    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"));
    725723
    726724    mErrorInfo.queryInterfaceTo(aErrorInfo.asOutParam());
     
    791789
    792790    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"));
    795792    m_cMsTimeout = aTimeout;
    796793
     
    915912
    916913        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);
    920915    }
    921916
     
    977972
    978973        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);
    982975    }
    983976
     
    10761069
    10771070    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"));
    10801072
    10811073    if (!mCanceled)
  • trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp

    r69500 r73003  
    280280                              sizeof (hostPathFull));
    281281        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);
    285283
    286284        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());
    290286    }
    291287
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r72980 r73003  
    15861586
    15871587    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);
    15911591
    15921592    mSavedStateDataLoaded = true;
     
    18371837        Utf8Buf.jolt();
    18381838        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"));
    18401840        cchBuf = parm[2].u.uint32;
    18411841    }
    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"));
    18451844
    18461845    /*
     
    22142213        {
    22152214            delete task;
    2216             rc = setError(E_FAIL, "Could not create VMPowerDownTask object \n");
     2215            rc = setError(E_FAIL, "Could not create VMPowerDownTask object\n");
    22172216            break;
    22182217        }
     
    22722271    int vrc = VMR3Reset(ptrVM.rawUVM());
    22732272
    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);
    22782274
    22792275    LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc));
     
    23882384        }
    23892385        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);
    23922387    }
    23932388    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);
    23962391
    23972392    LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc));
     
    24992494    }
    25002495    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);
    25042497
    25052498    LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc));
     
    25692562    }
    25702563
    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);
    25752565
    25762566    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     
    26182608    }
    26192609
    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);
    26242613
    26252614    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     
    26412630       )
    26422631        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));
    26452634
    26462635    /* get the VM handle. */
     
    27042693    }
    27052694
    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);
    27102696
    27112697    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     
    27782764
    27792765            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]);
    27832767        }
    27842768
     
    28102794        && mMachineState != MachineState_Paused)
    28112795        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));
    28142798
    28152799    /* Get the VM handle. */
     
    28202804    /* Don't proceed unless we have a USB controller. */
    28212805    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"));
    28242807
    28252808    /* release the lock because the USB Proxy service may call us back
     
    28312814
    28322815#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"));
    28352817#endif  /* !VBOX_WITH_USB */
    28362818}
     
    28572839
    28582840    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());
    28622842
    28632843    /* Remove the device from the collection, it is re-added below for failures */
     
    28962876
    28972877#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"));
    29002879#endif  /* !VBOX_WITH_USB */
    29012880}
     
    29262905    }
    29272906
    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());
    29312908
    29322909#else   /* !VBOX_WITH_USB */
     
    29602937    }
    29612938
    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());
    29652940
    29662941#else   /* !VBOX_WITH_USB */
     
    29782953    if (mMachineState == MachineState_Saved)
    29792954        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"));
    29812956    if (   mMachineState != MachineState_PoweredOff
    29822957        && mMachineState != MachineState_Teleported
     
    29862961       )
    29872962        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));
    29902965
    29912966    ComObjPtr<SharedFolder> pSharedFolder;
     
    30483023    if (mMachineState == MachineState_Saved)
    30493024        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"));
    30513026    if (   mMachineState != MachineState_PoweredOff
    30523027        && mMachineState != MachineState_Teleported
     
    31113086    const uint8_t *pbKey = (const uint8_t *)aPassword.c_str();
    31123087
    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))
    31153090    {
    31163091        unsigned cDisksConfigured = 0;
     
    31203095        {
    31213096            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);
    31243099
    31253100            pKey->setUsers(cDisksConfigured);
     
    31373112
    31383113                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);
    31453118            }
    31463119        }
    31473120    }
    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"));
    31523125    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);
    31543127
    31553128    return hrc;
     
    31743147    {
    31753148        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)
    31783151        {
    31793152            AssertPtr(pKey);
     
    32153188
    32163189    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))
    32193192    {
    32203193        m_cDisksPwProvided -= pKey->getUsers();
    32213194        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());
    32283200    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);
    32313202
    32323203    return S_OK;
     
    32373208    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    32383209
    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)"));
    32443215
    32453216    m_cDisksPwProvided = 0;
     
    32613232                                  false /* aWarning */,
    32623233                                  true /* aLogIt */);
     3234    va_end(args);
     3235    return rc;
     3236}
     3237
     3238/*static*/
     3239HRESULT 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);
    32633250    va_end(args);
    32643251    return rc;
     
    33633350            if (pAlock)
    33643351                pAlock->release();
    3365             int rc = VMR3Suspend(pUVM, VMSUSPENDREASON_RECONFIG);
     3352            int vrc = VMR3Suspend(pUVM, VMSUSPENDREASON_RECONFIG);
    33663353            if (pAlock)
    33673354                pAlock->acquire();
    33683355            mVMStateChangeCallbackDisabled = false;
    3369             if (RT_FAILURE(rc))
     3356            if (RT_FAILURE(vrc))
    33703357                return setErrorInternal(VBOX_E_INVALID_VM_STATE,
    33713358                                        COM_IIDOF(IConsole),
    33723359                                        getStaticComponentName(),
    3373                                         Utf8StrFmt("Could suspend VM for medium change (%Rrc)", rc),
     3360                                        Utf8StrFmt("Could suspend VM for medium change (%Rrc)", vrc),
    33743361                                        false /*aWarning*/,
    3375                                         true /*aLogIt*/);
     3362                                        true /*aLogIt*/,
     3363                                        vrc);
    33763364            *pfResume = true;
    33773365            break;
     
    35233511
    35243512    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);
    35323515}
    35333516
     
    37013684
    37023685    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);
    37103688}
    37113689
     
    38763854
    38773855    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);
    38853858}
    38863859
     
    40814054                    }
    40824055                    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);
    40854057                    else
    40864058                        ComAssertRC(vrc);
     
    46674639            PPDMIBASE pIBase = NULL;
    46684640            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))
    46714643            {
    46724644                if (pIBase)
     
    46754647                    if (!pIMedium)
    46764648                        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)
    46784651                    {
    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;
    46944656                    }
     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++;
    46954665                }
    46964666                else
     
    47954765                }
    47964766                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);
    48004768
    48014769                RTMemSaferFree(pbKey, cbKey);
    48024770            }
    48034771            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);
    48064773        }
    48074774        else
     
    48964863        return S_OK;
    48974864
    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);
    49004866}
    49014867
     
    52225188                    m_aeSerialPortMode[ulSlot] = eHostMode;
    52235189                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);
    52265191            }
    52275192        }
     
    55495514                            {
    55505515                                Utf8Str errMsg = VRDPServerErrorToMsg(vrc);
    5551                                 rc = setError(E_FAIL, errMsg.c_str());
     5516                                rc = setErrorBoth(E_FAIL, vrc, errMsg.c_str());
    55525517                            }
    55535518                            else
     
    56295594    }
    56305595
    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);
    56355598
    56365599    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     
    56755638                vrc = mDisplay->i_videoRecStart();
    56765639                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);
    56785641            }
    56795642            else
     
    61206083        }
    61216084        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);
    61256086    }
    61266087    catch(std::bad_alloc & /*e*/)
     
    61796140    HRESULT hrc = S_OK;
    61806141    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);
    61826143    return hrc;
    61836144#endif /* VBOX_WITH_GUEST_PROPS */
     
    62106171    HRESULT hrc = S_OK;
    62116172    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);
    62136174    return hrc;
    62146175#endif /* VBOX_WITH_GUEST_PROPS */
     
    63796340
    63806341    if (RT_FAILURE(vrc))
    6381         return setError(E_FAIL, tr("%Rrc"), vrc);
     6342        return setErrorBoth(E_FAIL, vrc, tr("%Rrc"), vrc);
    63826343    if (FAILED(rc))
    63836344        return rc;
     
    64016362    vrc = pIMedium->pfnMerge(pIMedium, onlineMergeMediumProgress, aProgress);
    64026363    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);
    64046365
    64056366    alock.acquire();
     
    64256386
    64266387    if (RT_FAILURE(vrc))
    6427         return setError(E_FAIL, tr("%Rrc"), vrc);
     6388        return setErrorBoth(E_FAIL, vrc, tr("%Rrc"), vrc);
    64286389    if (FAILED(rc))
    64296390        return rc;
     
    65076468                                   pAttachment, mMachineState, &rc);
    65086469        if (RT_FAILURE(vrc))
    6509             throw setError(E_FAIL, tr("%Rrc"), vrc);
     6470            throw setErrorBoth(E_FAIL, vrc, tr("%Rrc"), vrc);
    65106471        if (FAILED(rc))
    65116472            throw rc;
     
    66026563    HRESULT hrc = S_OK;
    66036564    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);
    66056566    else if (   aReason == Reason_HostSuspend
    66066567             || aReason == Reason_HostBatteryLow)
     
    66956656    }
    66966657
    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);
    67016660
    67026661    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     
    67396698    {
    67406699        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));
    67436702    }
    67446703    bool fContinueAfterwards = mMachineState != MachineState_Saving;
     
    67616720            int vrc = RTDirCreateFullPath(dir.c_str(), 0700);
    67626721            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);
    67666724        }
    67676725    }
     
    67866744
    67876745        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);
    67896747        fPaused = true;
    67906748    }
     
    68126770            alock.acquire();
    68136771        }
    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);
    68166773    }
    68176774    Assert(fContinueAfterwards || !aLeftPaused);
     
    72047161    {
    72057162        /* 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"));
    72087164    }
    72097165
     
    72137169
    72147170        /* 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"));
    72177172    }
    72187173
     
    73647319                                    0 /* uHistoryFileSize */, RTErrInfoInitStatic(&ErrInfo));
    73657320    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);
    73677322
    73687323    /* If we've made any directory changes, flush the directory to increase
     
    74087363    {
    74097364        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));
    74137367
    74147368        /* Set up release logging as early as possible after the check if
     
    74727426            int vrc = SSMR3ValidateFile(Utf8Str(savedStateFile).c_str(), false /* fChecksumIt */);
    74737427            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);
    74777431        }
    74787432
     
    76537607                vrc = RTDirCreateFullPath(pszDumpDir, 0700);
    76547608                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);
    76577611            }
    76587612
    76597613            vrc = RTCoreDumperSetup(pszDumpDir, fCoreFlags);
    76607614            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));
    76647617        }
    76657618#endif
     
    77717724                    {
    77727725                        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"));
    77747727                    }
    77757728                    ComPtr<IVirtualBox> pVirtualBox;
     
    77827735                    {
    77837736                        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());
    77867738                    }
    77877739                    break;
     
    81038055            mpUVM = pUVM;
    81048056            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);
    81088058        }
    81098059
     
    81218071    }
    81228072    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);
    81288074
    81298075    /*
     
    82278173
    82288174    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());
    82328176
    82338177    return VBOX_E_FILE_ERROR;
     
    84448388    bool fMissing = false;
    84458389    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);
    84498391    if (!RTPathExists(hostPathFull))
    84508392        fMissing = true;
     
    85068448
    85078449    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);
    85118452
    85128453    if (fMissing)
     
    85608501    RTMemFree(pMapName);
    85618502    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);
    85658504
    85668505    return S_OK;
     
    91029041        {
    91039042            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)."));
    91059044                break;
    91069045            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"));
    91089047                break;
    91099048            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);
    91119050                break;
    91129051        }
     
    92779216     * Allocate a host interface device
    92789217     */
    9279     int rcVBox = RTFileOpen(&maTapFD[slot], "/dev/net/tun",
    9280                             RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT);
    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))
    92829221    {
    92839222        /*
     
    93039242            RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), str.c_str()); /** @todo bitch about names which are too long... */
    93049243            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)
    93079246            {
    93089247                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());
    93129249            }
    93139250        }
     
    93269263                 */
    93279264                maTAPDeviceName[slot] = tapDeviceName;
    9328                 rcVBox = VINF_SUCCESS;
     9265                vrc = VINF_SUCCESS;
    93299266            }
    93309267            else
     
    93339270
    93349271                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));
    93399275            }
    93409276        }
     
    93429278    else
    93439279    {
    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)
    93469282        {
    93479283            case VERR_ACCESS_DENIED:
    93489284                /* will be handled by our caller */
    9349                 rc = rcVBox;
     9285                rc = vrc;
    93509286                break;
    93519287            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);
    93559289                break;
    93569290        }
     
    93799313        memcpy(szTapdev + strlen(szTapdev), str.c_str(),
    93809314               sizeof(szTapdev) - strlen(szTapdev) - 1); /** @todo bitch about names which are too long... */
    9381     int rcVBox = RTFileOpen(&maTapFD[slot], szTapdev,
    9382                             RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT | RTFILE_O_NON_BLOCK);
    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))
    93859319        maTAPDeviceName[slot] = tapDeviceName;
    93869320    else
    93879321    {
    9388         switch (rcVBox)
     9322        switch (vrc)
    93899323        {
    93909324            case VERR_ACCESS_DENIED:
    93919325                /* will be handled by our caller */
    9392                 rc = rcVBox;
     9326                rc = vrc;
    93939327                break;
    93949328            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());
    93989330                break;
    93999331        }
     
    94039335# endif
    94049336    /* in case of failure, cleanup. */
    9405     if (RT_FAILURE(rcVBox) && SUCCEEDED(rc))
     9337    if (RT_FAILURE(vrc) && SUCCEEDED(rc))
    94069338    {
    94079339        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"));
    94109341    }
    94119342    LogFlowThisFunc(("rc=%Rhrc\n", rc));
     
    99509881            if (   RT_FAILURE(vrc)
    99519882                && 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());
    99539884        }
    99549885
     
    1027810209            /* Set the error message as the COM error.
    1027910210             * 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());
    1028110212        }
    1028210213    }
  • trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp

    r69500 r73003  
    238238    int vrc = teleporterTcpReadLine(pState, szMsg, sizeof(szMsg));
    239239    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);
    241241
    242242    if (!strcmp(szMsg, "ACK"))
     
    300300    int vrc = RTTcpSgWriteL(pState->mhSocket, 2, pszCommand, strlen(pszCommand), "\n", sizeof("\n") - 1);
    301301    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);
    303303    if (!fWaitForAck)
    304304        return S_OK;
     
    655655    int vrc = RTTcpClientConnect(pState->mstrHostname.c_str(), pState->muPort, &pState->mhSocket);
    656656    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);
    659659    vrc = RTTcpSetSendCoalescing(pState->mhSocket, false /*fEnable*/);
    660660    AssertRC(vrc);
     
    665665    vrc = RTTcpRead(pState->mhSocket, szLine, sizeof(g_szWelcome) - 1, NULL);
    666666    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);
    668668    if (strcmp(szLine, g_szWelcome))
    669669        return setError(E_FAIL, tr("Unexpected welcome %.*Rhxs"), sizeof(g_szWelcome) - 1, szLine);
     
    673673    vrc = RTTcpWrite(pState->mhSocket, pState->mstrPassword.c_str(), pState->mstrPassword.length());
    674674    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);
    676676
    677677    /* ACK */
     
    708708                return hrc;
    709709        }
    710         return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc);
     710        return setErrorBoth(E_FAIL, vrc, tr("VMR3Teleport -> %Rrc"), vrc);
    711711    }
    712712
     
    968968
    969969        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));
    973972    }
    974973
     
    10181017        ptrProgress->i_setCancelCallback(NULL, NULL);
    10191018        delete pState;
    1020         hrc = setError(E_FAIL, tr("RTThreadCreate -> %Rrc"), vrc);
     1019        hrc = setErrorBoth(E_FAIL, vrc, tr("RTThreadCreate -> %Rrc"), vrc);
    10211020    }
    10221021
     
    10991098    }
    11001099    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);
    11021101
    11031102    /*
     
    11621161                    else
    11631162                    {
    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);
    11651164                        LogRel(("Teleporter: Unexpected RTTcpServerListen rc: %Rrc\n", vrc));
    11661165                    }
     
    11761175        }
    11771176        else
    1178             hrc = setError(E_FAIL, "RTTimerLRStart -> %Rrc", vrc);
     1177            hrc = setErrorBoth(E_FAIL, vrc, "RTTimerLRStart -> %Rrc", vrc);
    11791178
    11801179        RTTimerLRDestroy(hTimerLR);
    11811180    }
    11821181    else
    1183         hrc = setError(E_FAIL, "RTTimerLRCreate -> %Rrc", vrc);
     1182        hrc = setErrorBoth(E_FAIL, vrc, "RTTimerLRCreate -> %Rrc", vrc);
    11841183    RTTcpServerDestroy(hServer);
    11851184
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r70496 r73003  
    32013201        Utf8Str filename = authLibrary;
    32023202
    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);
    32123208            return AuthResultAccessDenied;
    32133209        }
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r72980 r73003  
    23442344            }
    23452345            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);
    23502347            RTMemFree(pu8PNG);
    23512348        }
    23522349    }
    23532350    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"));
    23562352    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);
    23592354
    23602355    return rc;
     
    28172812     * dirty conversion work.
    28182813     */
    2819     int rcVBox = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7,
    2820                                   this, aScreenId, aAddress, aX, aY, aWidth, aHeight);
     2814    int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7,
     2815                               this, aScreenId, aAddress, aX, aY, aWidth, aHeight);
    28212816
    28222817    /*
     
    28252820     */
    28262821    HRESULT rc = S_OK;
    2827     if (rcVBox == VERR_NOT_SUPPORTED || rcVBox == VERR_NOT_IMPLEMENTED)
     2822    if (vrc == VERR_NOT_SUPPORTED || vrc == VERR_NOT_IMPLEMENTED)
    28282823    {
    28292824        /** @todo implement generic fallback for screen blitting. */
    28302825        rc = E_NOTIMPL;
    28312826    }
    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);
    28352829/// @todo
    28362830//    else
     
    29582952    alock.release();
    29592953
    2960     int rcVBox = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,
    2961                                     3, this, 0, true);
     2954    int vrc = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,
     2955                                 3, this, 0, true);
    29622956    alock.acquire();
    29632957
    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);
    29672960
    29682961    LogRelFlowFunc(("rc=%Rhrc\n", rc));
     
    29802973        return ptrVM.rc();
    29812974
    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);
    29872979
    29882980    LogRelFlowFunc(("rc=%Rhrc\n", rc));
  • trunk/src/VBox/Main/src-client/EmulatedUSBImpl.cpp

    r69500 r73003  
    213213    {
    214214        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);
    217216    }
    218217
     
    313312    {
    314313        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);
    317315    }
    318316
     
    332330    {
    333331        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);
    336333    }
    337334
  • trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp

    r72958 r73003  
    375375
    376376    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))
    379379    {
    380380        /* Return guest session to the caller. */
    381381        HRESULT hr2 = pSession.queryInterfaceTo(aGuestSession.asOutParam());
    382382        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))
    387387        /* Start (fork) the session asynchronously
    388388         * on the guest. */
    389         rc = pSession->i_startSessionAsync();
     389        vrc = pSession->i_startSessionAsync();
    390390
    391391    HRESULT hr = S_OK;
    392392
    393     if (RT_FAILURE(rc))
    394     {
    395         switch (rc)
     393    if (RT_FAILURE(vrc))
     394    {
     395        switch (vrc)
    396396        {
    397397            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);
    400400                break;
    401401
     
    403403
    404404            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);
    406406                break;
    407407        }
     
    470470        return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), fFlags);
    471471
    472     int rc = VINF_SUCCESS;
     472    int vrc = VINF_SUCCESS;
    473473
    474474    ProcessArguments aArgs;
     
    484484        catch(std::bad_alloc &)
    485485        {
    486             rc = VERR_NO_MEMORY;
     486            vrc = VERR_NO_MEMORY;
    487487        }
    488488    }
     
    501501
    502502    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)
    508508        {
    509509            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);
    512512                break;
    513513
     
    515515
    516516           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);
    518518                break;
    519519        }
     
    523523        Assert(!pSession.isNull());
    524524        int rcGuest;
    525         rc = pSession->i_startSession(&rcGuest);
    526         if (RT_FAILURE(rc))
     525        vrc = pSession->i_startSession(&rcGuest);
     526        if (RT_FAILURE(vrc))
    527527        {
    528528            /** @todo Handle rcGuest! */
    529529
    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);
    531531        }
    532532        else
     
    543543                catch(...)
    544544                {
    545                     hr = setError(VBOX_E_IPRT_ERROR, tr("Failed to create SessionTaskUpdateAdditions object "));
     545                    hr = setError(E_OUTOFMEMORY, tr("Failed to create SessionTaskUpdateAdditions object "));
    546546                    throw;
    547547                }
     
    552552                {
    553553                    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"));
    556555                    throw hr;
    557556                }
     
    566565                }
    567566                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 "));
    570568            }
    571569            catch(std::bad_alloc &)
  • trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp

    r71566 r73003  
    342342
    343343    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)
    348348        {
    349349            case VERR_GSTCTL_GUEST_ERROR:
     
    357357
    358358            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);
    362361                break;
    363362        }
     
    377376
    378377    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    {
     381AssertMsg(vrc != VWRN_GSTCTL_PROCESS_EXIT_CODE, ("Buggy status code handling! See futher down...\n"));
    382382        /* Return info object to the caller. */
    383383        hr = fsObjInfo.queryInterfaceTo(aObjInfo.asOutParam());
     
    385385    else
    386386    {
    387         switch (rc)
     387        switch (vrc)
    388388        {
    389389            case VERR_GSTCTL_GUEST_ERROR:
     
    391391                break;
    392392
     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 */
    393397            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());
    396400                break;
    397401
    398402            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());
    401405                break;
    402406
    403407            case VERR_NO_MORE_FILES:
    404408                /* 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());
    407411                break;
    408412
    409413            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);
    412416                break;
    413417        }
    414418    }
    415419
    416     LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
     420    LogFlowThisFunc(("Returning hr=%Rhrc / vrc=%Rrc\n", hr, vrc));
    417421    return hr;
    418422}
  • trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp

    r69500 r73003  
    400400    }
    401401    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);
    403403    /* Note: mDataBase.mfTransferIsPending will be set to false again by i_receiveDataThread. */
    404404
  • trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp

    r69500 r73003  
    514514        Msg.setNextUInt32(cbFormats);
    515515
    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))
    518518        {
    519519            GuestDnDResponse *pResp = GuestDnDInst()->response();
    520520            AssertPtr(pResp);
    521521
    522             rc = pResp->waitForGuestResponse();
    523             if (RT_SUCCESS(rc))
     522            vrc = pResp->waitForGuestResponse();
     523            if (RT_SUCCESS(vrc))
    524524            {
    525525                resAction = GuestDnD::toMainAction(pResp->defAction());
     
    532532                }
    533533                else
     534                    /** @todo r=bird: This isn't an IPRT error, is it?   */
    534535                    hr = setError(VBOX_E_IPRT_ERROR, tr("Guest returned invalid drop formats (%zu formats)"), lstFormats.size());
    535536            }
    536537            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);
    538539        }
    539540        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);
    541542    }
    542543    else
     
    674675    }
    675676    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);
    677678
    678679    LogFlowFunc(("Returning hr=%Rhrc\n", hr));
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r72980 r73003  
    12601260    /* Close file on guest. */
    12611261    int rcGuest;
    1262     int rc = i_closeFile(&rcGuest);
     1262    int vrc = i_closeFile(&rcGuest);
    12631263    /* On failure don't return here, instead do all the cleanup
    12641264     * work first and then return an error. */
    12651265
    12661266    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)
    12741274            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));
    12811279    return S_OK;
    12821280}
     
    13091307    {
    13101308        if (GuestProcess::i_isGuestError(vrc))
    1311         {
    13121309            hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    1313         }
    13141310        else
    13151311            hr = setErrorVrc(vrc, tr("Querying file information failed: %Rrc"), vrc);
     
    13381334    {
    13391335        if (GuestProcess::i_isGuestError(vrc))
    1340         {
    13411336            hr = GuestProcess::i_setErrorExternal(this, rcGuest);
    1342         }
    13431337        else
    13441338            hr = setErrorVrc(vrc, tr("Querying file size failed: %Rrc"), vrc);
     
    13761370        aData.resize(0);
    13771371
    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);
    13861374    }
    13871375
     
    14161404        aData.resize(0);
    14171405
    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);
    14261408    }
    14271409
     
    14541436        default:
    14551437            return setError(E_INVALIDARG, tr("Invalid seek type specified"));
    1456             break; /* Never reached. */
    14571438    }
    14581439
     
    14651446        *aNewOffset = RT_MIN(uNewOffset, (uint64_t)INT64_MAX);
    14661447    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);
    14771450
    14781451    LogFlowFuncLeaveRC(vrc);
     
    15051478    int vrc = i_writeData(aTimeoutMS, pvData, cbData, (uint32_t*)aWritten);
    15061479    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);
    15171482
    15181483    LogFlowFuncLeaveRC(vrc);
     
    15331498    int vrc = i_writeData(aTimeoutMS, pvData, cbData, (uint32_t*)aWritten);
    15341499    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);
    15451502
    15461503    LogFlowFuncLeaveRC(vrc);
  • trunk/src/VBox/Main/src-client/GuestImpl.cpp

    r69500 r73003  
    809809    if (Utf8Str(aDomain) == "@@disk")
    810810        return mParent->i_setDiskEncryptionKeys(aPassword);
    811     else if (Utf8Str(aDomain) == "@@mem")
     811    if (Utf8Str(aDomain) == "@@mem")
    812812    {
    813813        /** @todo */
    814814        return E_NOTIMPL;
    815815    }
    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?)"));
    841838}
    842839
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r72973 r73003  
    10001000    AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n"));
    10011001
    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());
    10031003}
    10041004
     
    17911791
    17921792            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);
    17961795                break;
    17971796        }
     
    18241823
    18251824            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);
    18291828                break;
    18301829
    18311830            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);
    18351833                break;
    18361834        }
     
    18801878
    18811879            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);
    18851882                break;
    18861883        }
     
    19241921
    19251922            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);
    19291925                break;
    19301926        }
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r72980 r73003  
    557557                {
    558558                    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"));
    560561                        break;
    561562
    562563                    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);
    564566                        break;
    565567                }
     
    568570
    569571            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);
    571573                break;
    572574        }
     
    593595                {
    594596                    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"));
    596599                        break;
    597600
    598601                    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);
    600604                        break;
    601605                }
     
    604608
    605609            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);
    607611                break;
    608612        }
     
    780784        }
    781785        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());
    784787
    785788    }
     
    852855        }
    853856        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());
    856858
    857859    }
     
    24852487    AssertMsg(RT_FAILURE(rcGuest), ("Guest rc does not indicate a failure when setting error\n"));
    24862488
    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());
    24882490}
    24892491
     
    28042806    /* Close session on guest. */
    28052807    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);
    28072809    /* On failure don't return here, instead do all the cleanup
    28082810     * work first and then return an error. */
     
    28102812    /* Remove ourselves from the session list. */
    28112813    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)
    28242826            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);
    28282828    }
    28292829
     
    30873087
    30883088    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());
    30973095        else
    30983096        {
    3099             switch (rc)
     3097            switch (vrc)
    31003098            {
    31013099                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"));
    31033101                    break;
    31043102
    31053103                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"));
    31073105                    break;
    31083106
    31093107                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);
    31113109                    break;
    31123110            }
     
    31373135
    31383136    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)
    31433141        {
    31443142            case VERR_GSTCTL_GUEST_ERROR:
     
    31473145
    31483146            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);
    31513149               break;
    31523150        }
     
    31713169
    31723170    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))
    31753173        *aExists = objData.mType == FsObjType_Directory;
    31763174    else
    31773175    {
    3178         switch (rc)
     3176        switch (vrc)
    31793177        {
    31803178            case VERR_GSTCTL_GUEST_ERROR:
     
    31863184                        break;
    31873185                    default:
    3188                         hrc = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %s"),
    3189                                                              aPath.c_str(), GuestProcess::i_guestErrorToString(rcGuest).c_str());
     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());
    31903188                        break;
    31913189                }
     
    31943192
    31953193            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);
    31983196               break;
    31993197        }
     
    32363234
    32373235    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))
    32403238    {
    32413239        /* Return directory object to the caller. */
     
    32443242    else
    32453243    {
    3246         switch (rc)
     3244        switch (vrc)
    32473245        {
    32483246            case VERR_INVALID_PARAMETER:
    3249                hrc = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed; invalid parameters given"),
    3250                                                     aPath.c_str());
     3247               hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening directory \"%s\" failed; invalid parameters given"),
     3248                                  aPath.c_str());
    32513249               break;
    32523250
     
    32563254
    32573255            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);
    32603257               break;
    32613258        }
     
    32893286        {
    32903287            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"));
    32933290                break;
    32943291
     
    32983295
    32993296            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);
    33023298                break;
    33033299        }
     
    33543350        {
    33553351            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"));
    33583354                break;
    33593355
     
    33633359
    33643360            default:
    3365                 hrc = setError(VBOX_E_IPRT_ERROR, tr("Recursively removing guest directory \"%s\" failed: %Rrc"),
    3366                                                      aPath.c_str(), vrc);
     3361                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Recursively removing guest directory \"%s\" failed: %Rrc"),
     3362                                   aPath.c_str(), vrc);
    33673363                break;
    33683364        }
     
    35503546
    35513547        default:
    3552             hrc = setError(VBOX_E_IPRT_ERROR, tr("Querying file information for \"%s\" failed: %Rrc"),
    3553                                                  aPath.c_str(), vrc);
     3548            hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Querying file information for \"%s\" failed: %Rrc"),
     3549                               aPath.c_str(), vrc);
    35543550            break;
    35553551    }
     
    36623658        {
    36633659            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"));
    36663662                break;
    36673663
     
    36713667
    36723668            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);
    36753670                break;
    36763671        }
     
    37013696    {
    37023697        if (GuestProcess::i_isGuestError(vrc))
    3703         {
    37043698            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
    3705         }
    37063699        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);
    37083701    }
    37093702
     
    37873780    {
    37883781        if (GuestProcess::i_isGuestError(vrc))
    3789         {
    37903782            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
    3791         }
    37923783        else
    37933784            hrc = setErrorVrc(vrc, tr("Querying file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc);
     
    38163807    {
    38173808        if (GuestProcess::i_isGuestError(vrc))
    3818         {
    38193809            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
    3820         }
    38213810        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);
    38233812    }
    38243813
     
    38683857        {
    38693858            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"));
    38723861                break;
    38733862
    38743863            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);
    38773865                break;
    38783866
    38793867            default:
    3880                 hrc = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"),
    3881                                                      aSource.c_str(), vrc);
     3868                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Renaming guest directory \"%s\" failed: %Rrc"),
     3869                                   aSource.c_str(), vrc);
    38823870                break;
    38833871        }
     
    41014089            {
    41024090                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);
    41064094                break;
    41074095            }
  • trunk/src/VBox/Main/src-client/KeyboardImpl.cpp

    r69500 r73003  
    215215
    216216    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);
    220220
    221221    return S_OK;
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r72328 r73003  
    215215                int vrc = EMR3SetExecutionPolicy(ptrVM.rawUVM(), enmPolicy, fEnforce != FALSE);
    216216                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);
    218218            }
    219219        }
     
    338338    int vrc = PATMR3AllowPatching(ptrVM.rawUVM(), RT_BOOL(aPATMEnabled));
    339339    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);
    341341
    342342#else  /* !VBOX_WITH_RAW_MODE */
    343343    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);
    345345#endif /* !VBOX_WITH_RAW_MODE */
    346346    return S_OK;
     
    395395    int vrc = CSAMR3SetScanningEnabled(ptrVM.rawUVM(), aCSAMEnabled != FALSE);
    396396    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);
    398398
    399399#else  /* !VBOX_WITH_RAW_MODE */
    400400    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"));
    402402#endif /* !VBOX_WITH_RAW_MODE */
    403403    return S_OK;
     
    490490            }
    491491            *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));
    493494        }
    494495        else
     
    669670        }
    670671        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);
    672673    }
    673674    return hrc;
     
    700701        }
    701702        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);
    703704    }
    704705    return hrc;
     
    771772            int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), aVirtualTimeRate);
    772773            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);
    774775        }
    775776    }
     
    844845            hrc = S_OK;
    845846        else
    846             hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc);
     847            hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3CoreWrite failed with %Rrc"), vrc);
    847848    }
    848849
     
    10101011            }
    10111012            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);
    10131014            MachineDebuggerInfoDelete(&Hlp);
    10141015        }
     
    10301031            hrc = S_OK;
    10311032        else
    1032             hrc = setError(E_FAIL, tr("DBGFR3InjectNMI failed with %Rrc"), vrc);
     1033            hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3InjectNMI failed with %Rrc"), vrc);
    10331034    }
    10341035    return hrc;
     
    10471048            hrc = S_OK;
    10481049        else
    1049             hrc = setError(E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc);
     1050            hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc);
    10501051    }
    10511052    return hrc;
     
    10641065            hrc = S_OK;
    10651066        else
    1066             hrc = setError(E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc);
     1067            hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc);
    10671068    }
    10681069    return hrc;
     
    10811082            hrc = S_OK;
    10821083        else
    1083             hrc = setError(E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc);
     1084            hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc);
    10841085    }
    10851086    return hrc;
     
    12231224        }
    12241225        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);
    12261227    }
    12271228    return hrc;
     
    13271328        }
    13281329        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());
    13301331        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);
    13321333        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);
    13361337    }
    13371338
     
    13861387                }
    13871388                else
    1388                     hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc);
     1389                    hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc);
    13891390
    13901391                RTMemFree(paRegs);
     
    13941395        }
    13951396        else
    1396             hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc);
     1397            hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc);
    13971398    }
    13981399    return hrc;
     
    15371538            }
    15381539            else
    1539                 hrc = setError(E_FAIL, tr("DBGFR3StackWalkBegin failed with %Rrc"), vrc);
     1540                hrc = setErrorBoth(E_FAIL, vrc, tr("DBGFR3StackWalkBegin failed with %Rrc"), vrc);
    15401541
    15411542            /*
     
    15491550        }
    15501551        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);
    15521553    }
    15531554
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r69500 r73003  
    504504
    505505        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);
    509509        mfLastButtons = fButtons;
    510510    }
     
    547547                                          dw, fButtons);
    548548        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);
    552552        mfLastButtons = fButtons;
    553553
     
    582582        int vrc = pUpPort->pfnPutEventMultiTouch(pUpPort, cContacts, pau64Contacts, u32ScanTime);
    583583        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);
    587587    }
    588588    else
     
    613613                                                   x, y);
    614614        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);
    618618    }
    619619    return S_OK;
  • trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp

    r71179 r73003  
    145145        {
    146146            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));
    148148        }
    149149
     
    154154            RTSemEventDestroy(mData.m_SemEvWatcher);
    155155            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));
    157157        }
    158158    }
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r72476 r73003  
    490490                        throw setError(VBOX_E_NOT_SUPPORTED,
    491491                                       tr("Cannot handle medium attachment: channel is %d, device is %d"), lChannel, lDevice);
    492                 break;
     492                    break;
    493493
    494494                case StorageBus_SATA:
    495495                    lChannelVsys = lChannel;        // should be between 0 and 29
    496496                    lControllerVsys = lSATAControllerIndex;
    497                 break;
     497                    break;
    498498
    499499                case StorageBus_SCSI:
     
    501501                    lChannelVsys = lChannel;        // should be between 0 and 15
    502502                    lControllerVsys = lSCSIControllerIndex;
    503                 break;
     503                    break;
    504504
    505505                case StorageBus_Floppy:
    506506                    lChannelVsys = 0;
    507507                    lControllerVsys = 0;
    508                 break;
     508                    break;
    509509
    510510                default:
     
    512512                                   tr("Cannot handle medium attachment: storageBus is %d, channel is %d, device is %d"),
    513513                                   storageBus, lChannel, lDevice);
    514                 break;
    515514            }
    516515
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r72919 r73003  
    18431843                    vrc = RTCrX509CertPathsSetTrustedStore(hCertPaths, hTrustedCerts);
    18441844                    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);
    18461846                    RTCrStoreRelease(hTrustedCerts);
    18471847                }
    18481848                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);
    18521852
    18531853                /* Add untrusted intermediate certificates. */
     
    19131913                        }
    19141914                        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);
    19171917                    }
    19181918                    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);
    19211921                }
    19221922                RTCrX509CertPathsRelease(hCertPaths);
     
    22392239                                             NULL /*pszAttr*/, szDigest, fType);
    22402240            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);
    22422242        }
    22432243
  • trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp

    r69500 r73003  
    258258{
    259259    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");
    281276
    282277    /*
     
    284279     * here or address/prefix for aIPAddress?
    285280     */
    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");
    290284
    291285    /* It's more convenient to convert to host order once */
     
    301295        || (IPAddress.u & ~NetworkMask.u) == 0
    302296        || ((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");
    307298
    308299    if (   (LowerIP.u & UINT32_C(0xe0000000)) == UINT32_C(0xe0000000)
     
    310301        || (LowerIP.u & ~NetworkMask.u) == 0
    311302        || ((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");
    316304
    317305    if (   (UpperIP.u & UINT32_C(0xe0000000)) == UINT32_C(0xe0000000)
     
    319307        || (UpperIP.u & ~NetworkMask.u) == 0
    320308        || ((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");
    325310
    326311    /* The range should be valid ... */
    327312    if (LowerIP.u > UpperIP.u)
    328         return mVirtualBox->setError(E_INVALIDARG,
    329                    "Invalid range bounds");
     313        return mVirtualBox->setError(E_INVALIDARG, "Invalid range bounds");
    330314
    331315    /* ... and shouldn't contain the server's address */
    332316    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");
    335318
    336319    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    416399    {
    417400        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
    418406        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 
    426407        switch (*pszNext)
    427408        {
     
    440421            case '@':
    441422            {
    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))
    444425                    return VERR_PARSE_ERROR;
    445426                if (*pszNext != '=')
  • trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp

    r72980 r73003  
    474474    mCaptureFilename = aCaptureFilename;
    475475    alock.release();
    476     int rc = mUSBProxyBackend->captureDevice(this);
    477     if (RT_FAILURE(rc))
     476    int vrc = mUSBProxyBackend->captureDevice(this);
     477    if (RT_FAILURE(vrc))
    478478    {
    479479        alock.acquire();
    480480        i_failTransition(kHostUSBDeviceState_Invalid);
    481481        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());
    486486        return E_FAIL;
    487487    }
  • trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp

    r69500 r73003  
    184184        PFNVBOXHOSTWEBCAMLIST pfn = NULL;
    185185        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))
    191191        {
    192192            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))
    196196            {
    197197                hr = (HRESULT)u64Result;
     
    204204        if (SUCCEEDED(hr))
    205205        {
    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);
    209208        }
    210209    }
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r72919 r73003  
    641641    int vrc1 = mParent->i_calculateFullPath(strConfigFile, mData->m_strConfigFileFull);
    642642    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);
    647647
    648648    LogFlowThisFuncLeave();
     
    680680            int vrc2 = RTFileDelete(mData->m_strConfigFileFull.c_str());
    681681            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);
    685685        }
    686686    }
     
    688688              && vrc != VERR_PATH_NOT_FOUND
    689689            )
    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);
    694694    return rc;
    695695}
     
    26642664                                strSnapshotFolder);
    26652665    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);
    26692669
    26702670    i_setModified(IsModified_MachineData);
     
    48664866            case DeviceType_DVD:
    48674867            case DeviceType_Floppy:
    4868             break;
     4868                break;
    48694869
    48704870            default:
     
    54935493            int vrc = RTFileDelete(strFile.c_str());
    54945494            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);
    54975497        }
    54985498
     
    65206520        *aEnabled = TRUE;
    65216521#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);
    65256525    }
    65266526
     
    65576557
    65586558    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);
    65626562
    65636563    HRESULT hr = S_OK;
     
    66156615            }
    66166616            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);
    66206620
    66216621            RTMemFree(pu8PNG);
     
    66466646
    66476647    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);
    66516651
    66526652    *aWidth = u32Width;
     
    66826682
    66836683    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);
    66876687
    66886688    *aWidth = u32Width;
     
    68286828            aData.resize(cbData);
    68296829        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)"),
    68326838                          log.c_str(), vrc);
    6833         RTFileClose(LogFile);
    6834     }
    6835     else
    6836         rc = setError(VBOX_E_IPRT_ERROR,
    6837                       tr("Could not open log file '%s' (%Rrc)"),
    6838                       log.c_str(), vrc);
    68396839
    68406840    if (FAILED(rc))
     
    79507950
    79517951    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);
    79557955
    79567956    LogFlowThisFunc(("launched.pid=%d(0x%x)\n", pid, pid));
     
    81508150                          i_getName().c_str(), status.iStatus, strExtraInfo.c_str());
    81518151        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());
    81558155    }
    81568156
     
    88568856        int vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull);
    88578857        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);
    88628862        mSSData->strStateFilePath = stateFilePathFull;
    88638863    }
     
    89668966        int vrc = i_calculateFullPath(strStateFile, strStateFile);
    89678967        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);
    89728972    }
    89738973
     
    99519951                    if (RT_FAILURE(vrc))
    99529952                    {
    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);
    99589958                        break;
    99599959                    }
     
    99899989                    if (RT_FAILURE(vrc))
    99909990                    {
    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);
    99969996                        break;
    99979997                    }
     
    1006310063            if (RT_FAILURE(vrc))
    1006410064            {
    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);
    1006910069            }
    1007010070        }
     
    1007610076                         RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE);
    1007710077        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);
    1008210082        RTFileClose(f);
    1008310083    }
     
    1327413274    int vrc = i_calculateFullPath(aSavedStateFile, stateFilePathFull);
    1327513275    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);
    1328013280
    1328113281    mSSData->strStateFilePath = stateFilePathFull;
     
    1392713927        Utf8Str filename = authLibrary;
    1392813928
    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);
    1393613934    }
    1393713935
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r72973 r73003  
    221221        int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize);
    222222        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 to
     223            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
    226226         * be read and written */
    227227        sst.uWeight = (ULONG)(2 * (cbSize + _1M - 1) / _1M);
     
    965965
    966966        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);
    968968    }
    969969    catch (HRESULT rc2)
     
    13931393            int vrc = RTDirCreateFullPath(strTrgSnapshotFolder.c_str(), 0700);
    13941394            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);
    13981398        }
    13991399        /* Clone all save state files. */
     
    14141414                                       MachineCloneVMPrivate::copyStateFileProgress, &d->pProgress);
    14151415                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                                             sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), vrc);
     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);
    14191419                newFiles.append(strTrgSaveState);
    14201420            }
     
    15071507            vrc = RTFileDelete(newFiles.at(i).c_str());
    15081508            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);
    15101511        }
    15111512        /* Delete all already created medias. (Reverse, cause there could be
  • trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp

    r72841 r73003  
    185185                                 strTargetFolder.c_str());
    186186            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()));
    188188            throw rc;
    189189        }
     
    204204                                     "the destination folder.", strTargetFolder.c_str());
    205205                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()));
    208207            }
    209208
     
    493492                errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    494493
    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()));
    496495            }
    497496        }
     
    658657                    taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    659658
    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()));
    661660                }
    662661            }
     
    682681                    taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    683682
    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()));
    685684                }
    686685
     
    731730                    taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    732731
    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()));
    734733                }
    735734                LogRelFunc(("Created a home machine folder %s\n", strTargetSettingsFilePath.c_str()));
     
    755754                taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    756755
    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()));
    758757            }
    759758
     
    789788                            taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    790789
    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()));
    792791                        }
    793792                        LogRelFunc(("Created a log machine folder %s\n", strTargetLogFolderPath.c_str()));
     
    807806                        /* Move to next sub-operation. */
    808807                        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);
    810810                        if (FAILED(rc)) throw rc;
    811811
    812812                        int vrc = RTFileCopyEx(strFullSourceFilePath.c_str(), strFullTargetFilePath.c_str(), 0,
    813                                        MachineMoveVM::copyFileProgress, &taskMoveVM->m_pProgress);
     813                                               MachineMoveVM::copyFileProgress, &taskMoveVM->m_pProgress);
    814814                        if (RT_FAILURE(vrc))
    815815                        {
     
    820820                            taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    821821
    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()));
    823823                        }
    824824
    825825                        LogRelFunc(("The log file %s has been copied into the folder %s\n", strFullSourceFilePath.c_str(),
    826                                          strFullTargetFilePath.stripFilename().c_str()));
     826                                    strFullTargetFilePath.stripFilename().c_str()));
    827827
    828828                        /* save new file in case of restoring */
     
    12321232
    12331233        vrc = RTDirClose(hDir);
     1234        AssertRC(vrc);
    12341235    }
    12351236    else if (vrc == VERR_FILE_NOT_FOUND)
     
    12381239        errorsList.push_back(ErrorInfoItem(VERR_FILE_NOT_FOUND, errorDesc.c_str()));
    12391240
    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()));
    12421242    }
    12431243    else
     
    12461246        errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    12471247
    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()));
    12491251    }
    12501252
     
    12701272                errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    12711273
    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()));
    12731275            }
    12741276            else
     
    13171319                    errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    13181320
    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()));
    13201322                }
    13211323                ++it;
     
    13261328        else
    13271329        {
    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());
    13291333            errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    13301334
     
    15021506            errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str()));
    15031507
    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()));
    15051509        }
    15061510        /* same rule as above: count both the data which needs to
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r72999 r73003  
    36103610                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
    36113611                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());
    36153615            }
    36163616            else
     
    36333633        vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ | VD_FILTER_FLAGS_INFO, CryptoSettings.vdFilterIfaces);
    36343634        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());
    36383638
    36393639        it = pBase->m->mapProperties.find("CRYPT/KeyId");
     
    36863686                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
    36873687                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());
    36913691            }
    36923692            else
     
    37133713                           tr("The given password is incorrect"));
    37143714        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());
    37183718
    37193719        VDDestroy(pDisk);
     
    60856085        catch (int aVRC)
    60866086        {
    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());
    60916091        }
    60926092
     
    74257425            {
    74267426                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);
    74307430                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);
    74347434                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);
    74387438                else
    74397439                {
     
    80468046                    vrc = VDPluginLoadFromFilename(strPlugin.c_str());
    80478047                    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());
    80518051                }
    80528052                else
     
    80878087            pKeyStore->releaseSecretKey(itKeyId->second);
    80888088            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"));
    80908090            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());
    80938093        }
    80948094
     
    81178117                         pMedium->m->vdImageIfaces);
    81188118            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());
    81238123        }
    81248124
     
    84058405                             pMedium->m->vdImageIfaces);
    84068406                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());
    84118411            }
    84128412
     
    84348434            {
    84358435                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());
    84398439                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());
    84438443            }
    84448444
     
    86878687        catch (int aVRC)
    86888688        {
    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());
    86948694        }
    86958695
     
    89348934                             pMedium->m->vdImageIfaces);
    89358935                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());
    89408940            }
    89418941
     
    90049004                                 pMedium->m->vdImageIfaces);
    90059005                    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());
    90109010                }
    90119011
     
    90469046                }
    90479047                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());
    90519051
    90529052                size = VDGetFileSize(targetHdd, VD_LAST_IMAGE);
     
    92459245                             pMedium->m->vdImageIfaces);
    92469246                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());
    92519251            }
    92529252
     
    92919291                             NULL);
    92929292                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());
    92969296                size = VDGetFileSize(hdd, VD_LAST_IMAGE);
    92979297                logicalSize = VDGetSize(hdd, VD_LAST_IMAGE);
     
    93839383
    93849384            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());
    93889388
    93899389        }
     
    94789478                             pMedium->m->vdImageIfaces);
    94799479                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());
    94849484
    94859485                /* Done when we hit the media which should be reset */
     
    94919491            vrc = VDClose(hdd, true /* fDelete */);
    94929492            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());
    94969496
    94979497            /* next, create it again */
     
    95029502                         m->vdImageIfaces);
    95039503            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());
    95079507
    95089508            vrc = VDCreateDiff(hdd,
     
    95209520            {
    95219521                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());
    95259525                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());
    95299529            }
    95309530
     
    96089608                             pMedium->m->vdImageIfaces);
    96099609                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());
    96149614            }
    96159615
     
    96259625            {
    96269626                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());
    96309630                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());
    96349634                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());
    96399639            }
    96409640        }
     
    97069706                             pMedium->m->vdImageIfaces);
    97079707                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());
    97129712            }
    97139713
     
    97249724            {
    97259725                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());
    97299729                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());
    97339733                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());
    97389738            }
    97399739            size = VDGetFileSize(hdd, VD_LAST_IMAGE);
     
    98289828                         task.mVDImageIfaces);
    98299829            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());
    98349834
    98359835            Utf8Str targetFormat(m->strFormat);
     
    98969896                                 pMedium->m->vdImageIfaces);
    98979897                    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());
    99029902                }
    99039903
     
    99169916                             task.mVDOperationIfaces);
    99179917                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());
    99219921
    99229922                size = VDGetFileSize(targetHdd, VD_LAST_IMAGE);
     
    1009410094                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
    1009510095                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());
    1009910099            }
    1010010100            else
     
    1017210172                vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_WRITE, CryptoSettingsWrite.vdFilterIfaces);
    1017310173                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());
    1017710177            }
    1017810178            else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty())
     
    1020710207                             pMedium->m->vdImageIfaces);
    1020810208                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());
    1021310213            }
    1021410214
     
    1022210222            vrc = VDPrepareWithFilters(pDisk, task.mVDOperationIfaces);
    1022310223            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());
    1022710227
    1022810228            thisLock.acquire();
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r69500 r73003  
    11711171    int vrc = RTPathUserHome(szHome, sizeof(szHome));
    11721172    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);
    11761176    strPath = szHome;
    11771177    return S_OK;
     
    12871287            m->strAutostartDatabasePath = aPath;
    12881288        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);
    12921292    }
    12931293    else
     
    12971297            m->strAutostartDatabasePath = "";
    12981298        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);
    13021302    }
    13031303
  • trunk/src/VBox/Main/src-server/USBProxyService.cpp

    r72833 r73003  
    949949    va_start(va, aText);
    950950    HRESULT rc = VirtualBoxBase::setErrorInternal(aResultCode,
    951                                                     COM_IIDOF(IHost),
    952                                                     "USBProxyService",
    953                                                     Utf8Str(aText, va),
    954                                                     false /* aWarning*/,
    955                                                     true /* aLogIt*/);
     951                                                  COM_IIDOF(IHost),
     952                                                  "USBProxyService",
     953                                                  Utf8Str(aText, va),
     954                                                  false /* aWarning*/,
     955                                                  true /* aLogIt*/);
    956956    va_end(va);
    957957    return rc;
  • trunk/src/VBox/Main/src-server/VFSExplorerImpl.cpp

    r69753 r73003  
    319319    }
    320320    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);
    322322
    323323    if (aTask->m_ptrProgress)
     
    362362            int vrc = RTPathJoin(szPath, sizeof(szPath), m->strPath.c_str(), (*it).c_str());
    363363            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);
    365365            vrc = RTFileDelete(szPath);
    366366            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);
    368368            if (aTask->m_ptrProgress)
    369369                aTask->m_ptrProgress->SetCurrentOperationProgress((ULONG)(fPercentStep * (float)i));
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r72919 r73003  
    401401            int vrc = com::GetVBoxUserHomeDirectory(szHomeDir, sizeof(szHomeDir));
    402402            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);
    406406
    407407            unconst(m->strHomeDir) = szHomeDir;
     
    26282628        if (RT_FAILURE(vrc))
    26292629        {
    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);
    26312631            break;
    26322632        }
     
    26732673                 * (pressing the Cancel button to close the Run As dialog) */
    26742674                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"));
    26762676                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);
    26782678                break;
    26792679            }
     
    26852685            if (RT_FAILURE(vrc))
    26862686            {
    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);
    26882688                break;
    26892689            }
     
    27082708        if (SUCCEEDED(rc) && RT_FAILURE(vrc))
    27092709        {
    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);
    27112711            break;
    27122712        }
     
    48564856            int vrc = RTDirCreateFullPath(strDir.c_str(), 0700);
    48574857            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));
    48624862        }
    48634863        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()));
    48674866    }
    48684867
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette