VirtualBox

Ignore:
Timestamp:
Jan 25, 2023 12:16:44 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155496
Message:

Main/src-server: rc -> hrc/vrc (partial). bugref:10223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r98289 r98291  
    39223922HRESULT Medium::reset(AutoCaller &autoCaller, ComPtr<IProgress> &aProgress)
    39233923{
    3924     HRESULT rc = S_OK;
     3924    HRESULT hrc = S_OK;
    39253925    ComObjPtr<Progress> pProgress;
    39263926    Medium::Task *pTask = NULL;
     
    39493949                           m->strLocationFull.c_str());
    39503950
    3951         rc = i_canClose();
    3952         if (FAILED(rc))
    3953             throw rc;
     3951        hrc = i_canClose();
     3952        if (FAILED(hrc))
     3953            throw hrc;
    39543954
    39553955        /* Build the medium lock list. */
    39563956        MediumLockList *pMediumLockList(new MediumLockList());
    39573957        multilock.release();
    3958         rc = i_createMediumLockList(true /* fFailIfInaccessible */,
    3959                                     this /* pToLockWrite */,
    3960                                     false /* fMediumLockWriteAll */,
    3961                                     NULL,
    3962                                     *pMediumLockList);
     3958        hrc = i_createMediumLockList(true /* fFailIfInaccessible */,
     3959                                     this /* pToLockWrite */,
     3960                                     false /* fMediumLockWriteAll */,
     3961                                     NULL,
     3962                                     *pMediumLockList);
    39633963        multilock.acquire();
    3964         if (FAILED(rc))
     3964        if (FAILED(hrc))
    39653965        {
    39663966            delete pMediumLockList;
    3967             throw rc;
     3967            throw hrc;
    39683968        }
    39693969
    39703970        multilock.release();
    3971         rc = pMediumLockList->Lock();
     3971        hrc = pMediumLockList->Lock();
    39723972        multilock.acquire();
    3973         if (FAILED(rc))
     3973        if (FAILED(hrc))
    39743974        {
    39753975            delete pMediumLockList;
    3976             throw setError(rc,
     3976            throw setError(hrc,
    39773977                           tr("Failed to lock media when resetting '%s'"),
    39783978                           i_getLocationFull().c_str());
     
    39803980
    39813981        pProgress.createObject();
    3982         rc = pProgress->init(m->pVirtualBox,
    3983                              static_cast<IMedium*>(this),
    3984                              BstrFmt(tr("Resetting differencing medium '%s'"), m->strLocationFull.c_str()).raw(),
    3985                              FALSE /* aCancelable */);
    3986         if (FAILED(rc))
    3987             throw rc;
     3982        hrc = pProgress->init(m->pVirtualBox,
     3983                              static_cast<IMedium*>(this),
     3984                              BstrFmt(tr("Resetting differencing medium '%s'"), m->strLocationFull.c_str()).raw(),
     3985                              FALSE /* aCancelable */);
     3986        if (FAILED(hrc))
     3987            throw hrc;
    39883988
    39893989        /* setup task object to carry out the operation asynchronously */
    39903990        pTask = new Medium::ResetTask(this, pProgress, pMediumLockList);
    3991         rc = pTask->hrc();
    3992         AssertComRC(rc);
    3993         if (FAILED(rc))
    3994             throw rc;
    3995     }
    3996     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    3997 
    3998     if (SUCCEEDED(rc))
    3999     {
    4000         rc = pTask->createThread();
     3991        hrc = pTask->hrc();
     3992        AssertComRC(hrc);
     3993        if (FAILED(hrc))
     3994            throw hrc;
     3995    }
     3996    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     3997
     3998    if (SUCCEEDED(hrc))
     3999    {
     4000        hrc = pTask->createThread();
    40014001        pTask = NULL;
    4002         if (SUCCEEDED(rc))
     4002        if (SUCCEEDED(hrc))
    40034003            pProgress.queryInterfaceTo(aProgress.asOutParam());
    40044004    }
     
    40064006        delete pTask;
    40074007
    4008     LogFlowThisFunc(("LEAVE, rc=%Rhrc\n", rc));
    4009 
    4010     return rc;
     4008    LogFlowThisFunc(("LEAVE, hrc=%Rhrc\n", hrc));
     4009
     4010    return hrc;
    40114011}
    40124012
     
    40154015                                 ComPtr<IProgress> &aProgress)
    40164016{
    4017     HRESULT rc = S_OK;
     4017    HRESULT hrc = S_OK;
    40184018    ComObjPtr<Progress> pProgress;
    40194019    Medium::Task *pTask = NULL;
     
    40454045        MediumLockList *pMediumLockList(new MediumLockList());
    40464046        alock.release();
    4047         rc = i_createMediumLockList(true /* fFailIfInaccessible */ ,
    4048                                     this /* pToLockWrite */,
    4049                                     true /* fMediumLockAllWrite */,
    4050                                     NULL,
    4051                                     *pMediumLockList);
     4047        hrc = i_createMediumLockList(true /* fFailIfInaccessible */ ,
     4048                                     this /* pToLockWrite */,
     4049                                     true /* fMediumLockAllWrite */,
     4050                                     NULL,
     4051                                     *pMediumLockList);
    40524052        alock.acquire();
    4053         if (FAILED(rc))
     4053        if (FAILED(hrc))
    40544054        {
    40554055            delete pMediumLockList;
    4056             throw rc;
     4056            throw hrc;
    40574057        }
    40584058
    40594059        alock.release();
    4060         rc = pMediumLockList->Lock();
     4060        hrc = pMediumLockList->Lock();
    40614061        alock.acquire();
    4062         if (FAILED(rc))
     4062        if (FAILED(hrc))
    40634063        {
    40644064            delete pMediumLockList;
    4065             throw setError(rc,
     4065            throw setError(hrc,
    40664066                           tr("Failed to lock media for encryption '%s'"),
    40674067                           i_getLocationFull().c_str());
     
    40864086            if (pMedium->m->backRefs.size() > 1)
    40874087            {
    4088                 rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    4089                               tr("Cannot encrypt medium '%s' because it is attached to %d virtual machines", "",
    4090                                  pMedium->m->backRefs.size()),
    4091                               pMedium->m->strLocationFull.c_str(), pMedium->m->backRefs.size());
     4088                hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     4089                               tr("Cannot encrypt medium '%s' because it is attached to %d virtual machines", "",
     4090                                  pMedium->m->backRefs.size()),
     4091                               pMedium->m->strLocationFull.c_str(), pMedium->m->backRefs.size());
    40924092                break;
    40934093            }
    40944094            else if (pMedium->i_getChildren().size() > 1)
    40954095            {
    4096                 rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    4097                               tr("Cannot encrypt medium '%s' because it has %d children", "", pMedium->i_getChildren().size()),
    4098                               pMedium->m->strLocationFull.c_str(), pMedium->i_getChildren().size());
     4096                hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     4097                               tr("Cannot encrypt medium '%s' because it has %d children", "", pMedium->i_getChildren().size()),
     4098                               pMedium->m->strLocationFull.c_str(), pMedium->i_getChildren().size());
    40994099                break;
    41004100            }
    41014101        }
    41024102
    4103         if (FAILED(rc))
     4103        if (FAILED(hrc))
    41044104        {
    41054105            delete pMediumLockList;
    4106             throw rc;
     4106            throw hrc;
    41074107        }
    41084108
     
    41134113
    41144114        pProgress.createObject();
    4115         rc = pProgress->init(m->pVirtualBox,
    4116                              static_cast <IMedium *>(this),
    4117                              BstrFmt("%s '%s'", pszAction, m->strLocationFull.c_str()).raw(),
    4118                              TRUE /* aCancelable */);
    4119         if (FAILED(rc))
     4115        hrc = pProgress->init(m->pVirtualBox,
     4116                              static_cast <IMedium *>(this),
     4117                              BstrFmt("%s '%s'", pszAction, m->strLocationFull.c_str()).raw(),
     4118                              TRUE /* aCancelable */);
     4119        if (FAILED(hrc))
    41204120        {
    41214121            delete pMediumLockList;
    4122             throw rc;
     4122            throw hrc;
    41234123        }
    41244124
     
    41264126        pTask = new Medium::EncryptTask(this, aNewPassword, aCurrentPassword,
    41274127                                        aCipher, aNewPasswordId, pProgress, pMediumLockList);
    4128         rc = pTask->hrc();
    4129         AssertComRC(rc);
    4130         if (FAILED(rc))
    4131             throw rc;
    4132     }
    4133     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    4134 
    4135     if (SUCCEEDED(rc))
    4136     {
    4137         rc = pTask->createThread();
     4128        hrc = pTask->hrc();
     4129        AssertComRC(hrc);
     4130        if (FAILED(hrc))
     4131            throw hrc;
     4132    }
     4133    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     4134
     4135    if (SUCCEEDED(hrc))
     4136    {
     4137        hrc = pTask->createThread();
    41384138        pTask = NULL;
    4139         if (SUCCEEDED(rc))
     4139        if (SUCCEEDED(hrc))
    41404140            pProgress.queryInterfaceTo(aProgress.asOutParam());
    41414141    }
     
    41434143        delete pTask;
    41444144
    4145     return rc;
     4145    return hrc;
    41464146}
    41474147
     
    41514151    RT_NOREF(aCipher, aPasswordId);
    41524152#endif
    4153     HRESULT rc = S_OK;
     4153    HRESULT hrc = S_OK;
    41544154
    41554155    try
     
    41594159        autoCaller.add();
    41604160        if (FAILED(autoCaller.hrc()))
    4161             throw rc;
     4161            throw hrc;
    41624162        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    41634163
     
    41734173            /* Load the plugin */
    41744174            Utf8Str strPlugin;
    4175             rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
    4176             if (SUCCEEDED(rc))
     4175            hrc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
     4176            if (SUCCEEDED(hrc))
    41774177            {
    41784178                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
     
    42204220# endif
    42214221    }
    4222     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    4223 
    4224     return rc;
     4222    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     4223
     4224    return hrc;
    42254225}
    42264226
    42274227HRESULT Medium::checkEncryptionPassword(const com::Utf8Str &aPassword)
    42284228{
    4229     HRESULT rc = S_OK;
     4229    HRESULT hrc = S_OK;
    42304230
    42314231    try
     
    42494249            /* Load the plugin */
    42504250            Utf8Str strPlugin;
    4251             rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
    4252             if (SUCCEEDED(rc))
     4251            hrc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
     4252            if (SUCCEEDED(hrc))
    42534253            {
    42544254                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
     
    42914291# endif
    42924292    }
    4293     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    4294 
    4295     return rc;
     4293    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     4294
     4295    return hrc;
    42964296}
    42974297
     
    52335233        /* Encrypt the plain secret. If that does not work (i.e. no or wrong settings key
    52345234         * specified), just use the encrypted secret (if there is any). */
    5235         int rc = m->pVirtualBox->i_encryptSetting(itPln->second, &strCiphertext);
    5236         if (RT_SUCCESS(rc))
     5235        int hrc = m->pVirtualBox->i_encryptSetting(itPln->second, &strCiphertext);
     5236        if (RT_SUCCESS(hrc))
    52375237            fHaveInitiatorSecretEncrypted = true;
    52385238    }
     
    53505350    if (FAILED(autoCaller.hrc())) return autoCaller.hrc();
    53515351
    5352     HRESULT rc = S_OK;
     5352    HRESULT hrc = S_OK;
    53535353
    53545354    /* paranoid sanity checking if the medium has a to-be parent medium */
     
    53755375        {
    53765376            alock.release();
    5377             rc = pMedium->i_queryInfo(false /* fSetImageId */, false /* fSetParentId */,
    5378                                       autoCaller);
     5377            hrc = pMedium->i_queryInfo(false /* fSetImageId */, false /* fSetParentId */, autoCaller);
    53795378            alock.acquire();
    5380             if (FAILED(rc)) return rc;
     5379            if (FAILED(hrc)) return hrc;
    53815380
    53825381            mediumState = pMedium->i_getState();
     
    53905389                // otherwise report an error
    53915390                Bstr error;
    5392                 rc = pMedium->COMGETTER(LastAccessError)(error.asOutParam());
    5393                 if (FAILED(rc)) return rc;
     5391                hrc = pMedium->COMGETTER(LastAccessError)(error.asOutParam());
     5392                if (FAILED(hrc)) return hrc;
    53945393
    53955394                /* collect multiple errors */
     
    54695468    if (FAILED(targetCaller.hrc())) return targetCaller.hrc();
    54705469
    5471     HRESULT rc = S_OK;
     5470    HRESULT hrc = S_OK;
    54725471    ComObjPtr<Progress> pProgress;
    54735472    Medium::Task *pTask = NULL;
     
    55195518            {
    55205519                pProgress.createObject();
    5521                 rc = pProgress->init(m->pVirtualBox,
    5522                                      static_cast<IMedium*>(this),
    5523                                      BstrFmt(tr("Creating differencing medium storage unit '%s'"),
    5524                                              aTarget->m->strLocationFull.c_str()).raw(),
    5525                                      TRUE /* aCancelable */);
    5526                 if (FAILED(rc))
    5527                     throw rc;
     5520                hrc = pProgress->init(m->pVirtualBox,
     5521                                      static_cast<IMedium*>(this),
     5522                                      BstrFmt(tr("Creating differencing medium storage unit '%s'"),
     5523                                              aTarget->m->strLocationFull.c_str()).raw(),
     5524                                      TRUE /* aCancelable */);
     5525                if (FAILED(hrc))
     5526                    throw hrc;
    55285527            }
    55295528        }
     
    55345533                                           aWait /* fKeepMediumLockList */,
    55355534                                           aNotify);
    5536         rc = pTask->hrc();
    5537         AssertComRC(rc);
    5538         if (FAILED(rc))
    5539              throw rc;
     5535        hrc = pTask->hrc();
     5536        AssertComRC(hrc);
     5537        if (FAILED(hrc))
     5538             throw hrc;
    55405539
    55415540        /* register a task (it will deregister itself when done) */
     
    55455544        aTarget->m->state = MediumState_Creating;
    55465545    }
    5547     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    5548 
    5549     if (SUCCEEDED(rc))
     5546    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     5547
     5548    if (SUCCEEDED(hrc))
    55505549    {
    55515550        if (aWait)
    55525551        {
    5553             rc = pTask->runNow();
     5552            hrc = pTask->runNow();
    55545553            delete pTask;
    55555554        }
    55565555        else
    5557             rc = pTask->createThread();
     5556            hrc = pTask->createThread();
    55585557        pTask = NULL;
    5559         if (SUCCEEDED(rc) && aProgress != NULL)
     5558        if (SUCCEEDED(hrc) && aProgress != NULL)
    55605559            *aProgress = pProgress;
    55615560    }
     
    55635562        delete pTask;
    55645563
    5565     return rc;
     5564    return hrc;
    55665565}
    55675566
     
    56735672
    56745673    // perform extra media-dependent close checks
    5675     HRESULT rc = i_canClose();
    5676     if (FAILED(rc)) return rc;
     5674    HRESULT hrc = i_canClose();
     5675    if (FAILED(hrc)) return hrc;
    56775676
    56785677    m->fClosing = true;
     
    56835682        // uninitialization (to keep the media registry consistent on
    56845683        // failure to do so)
    5685         rc = i_unregisterWithVirtualBox();
    5686         if (FAILED(rc)) return rc;
     5684        hrc = i_unregisterWithVirtualBox();
     5685        if (FAILED(hrc)) return hrc;
    56875686
    56885687        multilock.release();
     
    57105709    LogFlowFuncLeave();
    57115710
    5712     return rc;
     5711    return hrc;
    57135712}
    57145713
     
    57425741    AssertReturn(aProgress != NULL || aWait == true, E_FAIL);
    57435742
    5744     HRESULT rc = S_OK;
     5743    HRESULT hrc = S_OK;
    57455744    ComObjPtr<Progress> pProgress;
    57465745    Medium::Task *pTask = NULL;
     
    58275826        }
    58285827
    5829         rc = i_canClose();
    5830         if (FAILED(rc))
    5831             throw rc;
     5828        hrc = i_canClose();
     5829        if (FAILED(hrc))
     5830            throw hrc;
    58325831
    58335832        /* go to Deleting state, so that the medium is not actually locked */
    58345833        if (m->state != MediumState_Deleting)
    58355834        {
    5836             rc = i_markForDeletion();
    5837             if (FAILED(rc))
    5838                 throw rc;
     5835            hrc = i_markForDeletion();
     5836            if (FAILED(hrc))
     5837                throw hrc;
    58395838        }
    58405839
     
    58445843        autoCaller.release();
    58455844        treelock.release();
    5846         rc = i_createMediumLockList(true /* fFailIfInaccessible */,
    5847                                     this /* pToLockWrite */,
    5848                                     false /* fMediumLockWriteAll */,
    5849                                     NULL,
    5850                                     *pMediumLockList);
     5845        hrc = i_createMediumLockList(true /* fFailIfInaccessible */,
     5846                                     this /* pToLockWrite */,
     5847                                     false /* fMediumLockWriteAll */,
     5848                                     NULL,
     5849                                     *pMediumLockList);
    58515850        treelock.acquire();
    58525851        autoCaller.add();
    58535852        AssertComRCThrowRC(autoCaller.hrc());
    58545853        alock.acquire();
    5855         if (FAILED(rc))
     5854        if (FAILED(hrc))
    58565855        {
    58575856            delete pMediumLockList;
    5858             throw rc;
     5857            throw hrc;
    58595858        }
    58605859
     
    58625861        autoCaller.release();
    58635862        treelock.release();
    5864         rc = pMediumLockList->Lock();
     5863        hrc = pMediumLockList->Lock();
    58655864        treelock.acquire();
    58665865        autoCaller.add();
    58675866        AssertComRCThrowRC(autoCaller.hrc());
    58685867        alock.acquire();
    5869         if (FAILED(rc))
     5868        if (FAILED(hrc))
    58705869        {
    58715870            delete pMediumLockList;
    5872             throw setError(rc,
     5871            throw setError(hrc,
    58735872                           tr("Failed to lock media when deleting '%s'"),
    58745873                           i_getLocationFull().c_str());
     
    58795878         * which would have been broken if unregisterWithVirtualBox() failed
    58805879         * after we successfully deleted the storage) */
    5881         rc = i_unregisterWithVirtualBox();
    5882         if (FAILED(rc))
    5883             throw rc;
     5880        hrc = i_unregisterWithVirtualBox();
     5881        if (FAILED(hrc))
     5882            throw hrc;
    58845883        // no longer need lock
    58855884        alock.release();
     
    58975896            {
    58985897                pProgress.createObject();
    5899                 rc = pProgress->init(m->pVirtualBox,
    5900                                      static_cast<IMedium*>(this),
    5901                                      BstrFmt(tr("Deleting medium storage unit '%s'"), m->strLocationFull.c_str()).raw(),
    5902                                      FALSE /* aCancelable */);
    5903                 if (FAILED(rc))
    5904                     throw rc;
     5898                hrc = pProgress->init(m->pVirtualBox,
     5899                                      static_cast<IMedium*>(this),
     5900                                      BstrFmt(tr("Deleting medium storage unit '%s'"), m->strLocationFull.c_str()).raw(),
     5901                                      FALSE /* aCancelable */);
     5902                if (FAILED(hrc))
     5903                    throw hrc;
    59055904            }
    59065905        }
     
    59085907        /* setup task object to carry out the operation sync/async */
    59095908        pTask = new Medium::DeleteTask(this, pProgress, pMediumLockList, false, aNotify);
    5910         rc = pTask->hrc();
    5911         AssertComRC(rc);
    5912         if (FAILED(rc))
    5913             throw rc;
    5914     }
    5915     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    5916 
    5917     if (SUCCEEDED(rc))
     5909        hrc = pTask->hrc();
     5910        AssertComRC(hrc);
     5911        if (FAILED(hrc))
     5912            throw hrc;
     5913    }
     5914    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     5915
     5916    if (SUCCEEDED(hrc))
    59185917    {
    59195918        if (aWait)
    59205919        {
    5921             rc = pTask->runNow();
     5920            hrc = pTask->runNow();
    59225921            delete pTask;
    59235922        }
    59245923        else
    5925             rc = pTask->createThread();
     5924            hrc = pTask->createThread();
    59265925        pTask = NULL;
    5927         if (SUCCEEDED(rc) && aProgress != NULL)
     5926        if (SUCCEEDED(hrc) && aProgress != NULL)
    59285927            *aProgress = pProgress;
    59295928    }
     
    59435942    }
    59445943
    5945     return rc;
     5944    return hrc;
    59465945}
    59475946
     
    60436042    AssertReturn(pOther != this, E_FAIL);
    60446043
    6045     HRESULT rc = S_OK;
     6044    HRESULT hrc = S_OK;
    60466045    bool fThisParent = false; /**<< Flag whether this medium is the parent of pOther. */
    60476046
     
    61076106
    61086107            if (RT_FAILURE(vrc))
    6109                 rc = E_FAIL;
     6108                hrc = E_FAIL;
    61106109            else
    61116110            {
     
    61226121                uint32_t mediumCaps = MediumFormatCapabilities_CreateDynamic | MediumFormatCapabilities_File;
    61236122
    6124                 bool fDynamicOther =    pOther->i_getMediumFormat()->i_getCapabilities() & mediumCaps
    6125                                      && pOther->i_getVariant() & ~mediumVariants;
    6126                 bool fDynamicThis =    i_getMediumFormat()->i_getCapabilities() & mediumCaps
    6127                                     && i_getVariant() & ~mediumVariants;
    6128                 bool fMergeIntoThis =    (fDynamicThis && !fDynamicOther)
    6129                                       || (fDynamicThis == fDynamicOther && cbMediumThis > cbMediumOther);
     6123                bool fDynamicOther  = pOther->i_getMediumFormat()->i_getCapabilities() & mediumCaps
     6124                                   && pOther->i_getVariant() & ~mediumVariants;
     6125                bool fDynamicThis   = i_getMediumFormat()->i_getCapabilities() & mediumCaps
     6126                                   && i_getVariant() & ~mediumVariants;
     6127                bool fMergeIntoThis = (fDynamicThis && !fDynamicOther)
     6128                                   || (fDynamicThis == fDynamicOther && cbMediumThis > cbMediumOther);
    61306129                fMergeForward = fMergeIntoThis != fThisParent;
    61316130            }
    61326131        }
    61336132    }
    6134     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    6135 
    6136     return rc;
     6133    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     6134
     6135    return hrc;
    61376136}
    61386137
     
    61776176    AssertReturn(pTarget != this, E_FAIL);
    61786177
    6179     HRESULT rc = S_OK;
     6178    HRESULT hrc = S_OK;
    61806179    fMergeForward = false;
    61816180    pParentForTarget.setNull();
     
    62306229        treeLock.release();
    62316230        if (fMergeForward)
    6232             rc = pTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
    6233                                                  pTarget /* pToLockWrite */,
    6234                                                  false /* fMediumLockWriteAll */,
    6235                                                  NULL,
    6236                                                  *aMediumLockList);
     6231            hrc = pTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
     6232                                                  pTarget /* pToLockWrite */,
     6233                                                  false /* fMediumLockWriteAll */,
     6234                                                  NULL,
     6235                                                  *aMediumLockList);
    62376236        else
    6238             rc = i_createMediumLockList(true /* fFailIfInaccessible */,
    6239                                         pTarget /* pToLockWrite */,
    6240                                         false /* fMediumLockWriteAll */,
    6241                                         NULL,
    6242                                         *aMediumLockList);
     6237            hrc = i_createMediumLockList(true /* fFailIfInaccessible */,
     6238                                         pTarget /* pToLockWrite */,
     6239                                         false /* fMediumLockWriteAll */,
     6240                                         NULL,
     6241                                         *aMediumLockList);
    62436242        treeLock.acquire();
    62446243        autoCaller.add();
     
    62466245        targetCaller.add();
    62476246        AssertComRCThrowRC(targetCaller.hrc());
    6248         if (FAILED(rc))
    6249             throw rc;
     6247        if (FAILED(hrc))
     6248            throw hrc;
    62506249
    62516250        /* Sanity checking, must be after lock list creation as it depends on
     
    63476346            if (m->state == MediumState_Created)
    63486347            {
    6349                 rc = i_markForDeletion();
    6350                 if (FAILED(rc))
    6351                     throw rc;
     6348                hrc = i_markForDeletion();
     6349                if (FAILED(hrc))
     6350                    throw hrc;
    63526351            }
    63536352            else
     
    63916390                autoCaller.release();
    63926391                treeLock.release();
    6393                 rc = aChildrenToReparent->Lock();
     6392                hrc = aChildrenToReparent->Lock();
    63946393                treeLock.acquire();
    63956394                autoCaller.add();
     
    63976396                targetCaller.add();
    63986397                AssertComRCThrowRC(targetCaller.hrc());
    6399                 if (FAILED(rc))
    6400                     throw rc;
     6398                if (FAILED(hrc))
     6399                    throw hrc;
    64016400            }
    64026401        }
     
    64086407            if (pLast->m->state == MediumState_Created)
    64096408            {
    6410                 rc = pLast->i_markForDeletion();
    6411                 if (FAILED(rc))
    6412                     throw rc;
     6409                hrc = pLast->i_markForDeletion();
     6410                if (FAILED(hrc))
     6411                    throw hrc;
    64136412            }
    64146413            else
     
    64326431                if (mediumLock.GetMedium() == pTarget)
    64336432                {
    6434                     HRESULT rc2 = mediumLock.UpdateLock(true);
    6435                     AssertComRC(rc2);
     6433                    HRESULT hrc2 = mediumLock.UpdateLock(true);
     6434                    AssertComRC(hrc2);
    64366435                    break;
    64376436                }
     
    64446443            autoCaller.release();
    64456444            treeLock.release();
    6446             rc = aMediumLockList->Lock();
     6445            hrc = aMediumLockList->Lock();
    64476446            treeLock.acquire();
    64486447            autoCaller.add();
     
    64506449            targetCaller.add();
    64516450            AssertComRCThrowRC(targetCaller.hrc());
    6452             if (FAILED(rc))
     6451            if (FAILED(hrc))
    64536452            {
    64546453                AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
    6455                 throw setError(rc,
     6454                throw setError(hrc,
    64566455                               tr("Failed to lock media when merging to '%s'"),
    64576456                               pTarget->i_getLocationFull().c_str());
     
    64596458        }
    64606459    }
    6461     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    6462 
    6463     if (FAILED(rc))
     6460    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     6461
     6462    if (FAILED(hrc))
    64646463    {
    64656464        if (aMediumLockList)
     
    64756474    }
    64766475
    6477     return rc;
     6476    return hrc;
    64786477}
    64796478
     
    65756574    AssertComRCReturnRC(targetCaller.hrc());
    65766575
    6577     HRESULT rc = S_OK;
     6576    HRESULT hrc = S_OK;
    65786577    ComObjPtr<Progress> pProgress;
    65796578    Medium::Task *pTask = NULL;
     
    65986597
    65996598                pProgress.createObject();
    6600                 rc = pProgress->init(m->pVirtualBox,
    6601                                      static_cast<IMedium*>(this),
    6602                                      BstrFmt(tr("Merging medium '%s' to '%s'"),
    6603                                              i_getName().c_str(),
    6604                                              tgtName.c_str()).raw(),
    6605                                      TRUE, /* aCancelable */
    6606                                      2, /* Number of opearations */
    6607                                      BstrFmt(tr("Resizing medium '%s' before merge"),
    6608                                              tgtName.c_str()).raw()
    6609                                      );
    6610                 if (FAILED(rc))
    6611                     throw rc;
     6599                hrc = pProgress->init(m->pVirtualBox,
     6600                                      static_cast<IMedium*>(this),
     6601                                      BstrFmt(tr("Merging medium '%s' to '%s'"),
     6602                                              i_getName().c_str(),
     6603                                              tgtName.c_str()).raw(),
     6604                                      TRUE, /* aCancelable */
     6605                                      2, /* Number of opearations */
     6606                                      BstrFmt(tr("Resizing medium '%s' before merge"),
     6607                                              tgtName.c_str()).raw()
     6608                                      );
     6609                if (FAILED(hrc))
     6610                    throw hrc;
    66126611            }
    66136612        }
     
    66196618                                      aWait /* fKeepMediumLockList */,
    66206619                                      aNotify);
    6621         rc = pTask->hrc();
    6622         AssertComRC(rc);
    6623         if (FAILED(rc))
    6624             throw rc;
    6625     }
    6626     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    6627 
    6628     if (SUCCEEDED(rc))
     6620        hrc = pTask->hrc();
     6621        AssertComRC(hrc);
     6622        if (FAILED(hrc))
     6623            throw hrc;
     6624    }
     6625    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     6626
     6627    if (SUCCEEDED(hrc))
    66296628    {
    66306629        if (aWait)
    66316630        {
    6632             rc = pTask->runNow();
     6631            hrc = pTask->runNow();
    66336632            delete pTask;
    66346633        }
    66356634        else
    6636             rc = pTask->createThread();
     6635            hrc = pTask->createThread();
    66376636        pTask = NULL;
    6638         if (SUCCEEDED(rc) && aProgress != NULL)
     6637        if (SUCCEEDED(hrc) && aProgress != NULL)
    66396638            *aProgress = pProgress;
    66406639    }
     
    66426641        delete pTask;
    66436642
    6644     return rc;
     6643    return hrc;
    66456644}
    66466645
     
    66666665
    66676666    /* Revert media marked for deletion to previous state. */
    6668     HRESULT rc;
    66696667    MediumLockList::Base::const_iterator mediumListBegin =
    66706668        aMediumLockList->GetBegin();
     
    66816679        if (pMedium->m->state == MediumState_Deleting)
    66826680        {
    6683             rc = pMedium->i_unmarkForDeletion();
    6684             AssertComRC(rc);
     6681            HRESULT hrc = pMedium->i_unmarkForDeletion();
     6682            AssertComRC(hrc);
    66856683        }
    66866684        else if (   (   pMedium->m->state == MediumState_LockedWrite
     
    66886686                 && pMedium->m->preLockState == MediumState_Deleting)
    66896687        {
    6690             rc = pMedium->i_unmarkLockedForDeletion();
    6691             AssertComRC(rc);
     6688            HRESULT hrc = pMedium->i_unmarkLockedForDeletion();
     6689            AssertComRC(hrc);
    66926690        }
    66936691    }
     
    67506748    AssertComRCReturnRC(autoCaller.hrc());
    67516749
    6752     HRESULT rc = S_OK;
     6750    HRESULT hrc = S_OK;
    67536751    ComObjPtr<Progress> pProgress;
    67546752    Medium::Task *pTask = NULL;
     
    67676765
    67686766                pProgress.createObject();
    6769                 rc = pProgress->init(m->pVirtualBox,
    6770                                      static_cast <IMedium *>(this),
    6771                                      BstrFmt(tr("Resizing medium '%s'"), m->strLocationFull.c_str()).raw(),
    6772                                      TRUE /* aCancelable */);
    6773                 if (FAILED(rc))
    6774                     throw rc;
     6767                hrc = pProgress->init(m->pVirtualBox,
     6768                                      static_cast <IMedium *>(this),
     6769                                      BstrFmt(tr("Resizing medium '%s'"), m->strLocationFull.c_str()).raw(),
     6770                                      TRUE /* aCancelable */);
     6771                if (FAILED(hrc))
     6772                    throw hrc;
    67756773            }
    67766774        }
     
    67836781                                       aWait /* fKeepMediumLockList */,
    67846782                                       aNotify);
    6785         rc = pTask->hrc();
    6786         AssertComRC(rc);
    6787         if (FAILED(rc))
    6788             throw rc;
    6789     }
    6790     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    6791 
    6792     if (SUCCEEDED(rc))
     6783        hrc = pTask->hrc();
     6784        AssertComRC(hrc);
     6785        if (FAILED(hrc))
     6786            throw hrc;
     6787    }
     6788    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     6789
     6790    if (SUCCEEDED(hrc))
    67936791    {
    67946792        if (aWait)
    67956793        {
    6796             rc = pTask->runNow();
     6794            hrc = pTask->runNow();
    67976795            delete pTask;
    67986796        }
    67996797        else
    6800             rc = pTask->createThread();
     6798            hrc = pTask->createThread();
    68016799        pTask = NULL;
    6802         if (SUCCEEDED(rc) && aProgress != NULL)
     6800        if (SUCCEEDED(hrc) && aProgress != NULL)
    68036801            *aProgress = pProgress;
    68046802    }
     
    68066804        delete pTask;
    68076805
    6808     return rc;
     6806    return hrc;
    68096807}
    68106808
     
    68226820    Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
    68236821    MediumLockList mediumLockList;
    6824     HRESULT rc = i_createMediumLockList(true /* fFailIfInaccessible */,
    6825                                         NULL /* pToLockWrite */,
    6826                                         false /* fMediumLockWriteAll */,
    6827                                         this,
    6828                                         mediumLockList);
    6829     AssertComRCReturnRC(rc);
     6822    HRESULT hrc = i_createMediumLockList(true /* fFailIfInaccessible */,
     6823                                         NULL /* pToLockWrite */,
     6824                                         false /* fMediumLockWriteAll */,
     6825                                         this,
     6826                                         mediumLockList);
     6827    AssertComRCReturnRC(hrc);
    68306828
    68316829    try
     
    68846882            }
    68856883        }
    6886         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    6887         catch (int aVRC)
    6888         {
    6889             rc = setErrorBoth(E_FAIL, aVRC,
    6890                               tr("Could not update medium UUID references to parent '%s' (%s)"),
    6891                               m->strLocationFull.c_str(),
    6892                               i_vdError(aVRC).c_str());
     6884        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     6885        catch (int vrcXcpt)
     6886        {
     6887            hrc = setErrorBoth(E_FAIL, vrcXcpt,
     6888                               tr("Could not update medium UUID references to parent '%s' (%s)"),
     6889                               m->strLocationFull.c_str(),
     6890                               i_vdError(vrcXcpt).c_str());
    68936891        }
    68946892
    68956893        VDDestroy(hdd);
    68966894    }
    6897     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    6898 
    6899     return rc;
     6895    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     6896
     6897    return hrc;
    69006898}
    69016899
     
    71137111    if (FAILED(autoCaller.hrc())) return autoCaller.hrc();
    71147112
    7115     HRESULT rc = S_OK;
     7113    HRESULT hrc = S_OK;
    71167114    Medium::Task *pTask = NULL;
    71177115
     
    71377135        MediumLockList *pTargetMediumLockList(new MediumLockList());
    71387136        alock.release();
    7139         rc = i_createMediumLockList(true /* fFailIfInaccessible */,
    7140                                     this /* pToLockWrite */,
    7141                                     false /* fMediumLockWriteAll */,
    7142                                     aParent,
    7143                                     *pTargetMediumLockList);
     7137        hrc = i_createMediumLockList(true /* fFailIfInaccessible */,
     7138                                     this /* pToLockWrite */,
     7139                                     false /* fMediumLockWriteAll */,
     7140                                     aParent,
     7141                                     *pTargetMediumLockList);
    71447142        alock.acquire();
    7145         if (FAILED(rc))
     7143        if (FAILED(hrc))
    71467144        {
    71477145            delete pTargetMediumLockList;
    7148             throw rc;
     7146            throw hrc;
    71497147        }
    71507148
    71517149        alock.release();
    7152         rc = pTargetMediumLockList->Lock();
     7150        hrc = pTargetMediumLockList->Lock();
    71537151        alock.acquire();
    7154         if (FAILED(rc))
     7152        if (FAILED(hrc))
    71557153        {
    71567154            delete pTargetMediumLockList;
    7157             throw setError(rc,
     7155            throw setError(hrc,
    71587156                           tr("Failed to lock target media '%s'"),
    71597157                           i_getLocationFull().c_str());
     
    71637161        pTask = new Medium::ImportTask(this, aProgress, aFilename, aFormat, aVariant,
    71647162                                       aVfsIosSrc, aParent, pTargetMediumLockList, false, aNotify);
    7165         rc = pTask->hrc();
    7166         AssertComRC(rc);
    7167         if (FAILED(rc))
    7168             throw rc;
     7163        hrc = pTask->hrc();
     7164        AssertComRC(hrc);
     7165        if (FAILED(hrc))
     7166            throw hrc;
    71697167
    71707168        if (m->state == MediumState_NotCreated)
    71717169            m->state = MediumState_Creating;
    71727170    }
    7173     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    7174 
    7175     if (SUCCEEDED(rc))
    7176     {
    7177         rc = pTask->createThread();
     7171    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     7172
     7173    if (SUCCEEDED(hrc))
     7174    {
     7175        hrc = pTask->createThread();
    71787176        pTask = NULL;
    71797177    }
     
    71817179        delete pTask;
    71827180
    7183     return rc;
     7181    return hrc;
    71847182}
    71857183
     
    72177215    if (FAILED(autoCaller.hrc())) return autoCaller.hrc();
    72187216
    7219     HRESULT rc = S_OK;
     7217    HRESULT hrc = S_OK;
    72207218    ComObjPtr<Progress> pProgress;
    72217219    Medium::Task *pTask = NULL;
     
    72437241        MediumLockList *pSourceMediumLockList(new MediumLockList());
    72447242        alock.release();
    7245         rc = i_createMediumLockList(true /* fFailIfInaccessible */,
     7243        hrc = i_createMediumLockList(true /* fFailIfInaccessible */,
    72467244                                    NULL /* pToLockWrite */,
    72477245                                    false /* fMediumLockWriteAll */,
     
    72497247                                    *pSourceMediumLockList);
    72507248        alock.acquire();
    7251         if (FAILED(rc))
     7249        if (FAILED(hrc))
    72527250        {
    72537251            delete pSourceMediumLockList;
    7254             throw rc;
     7252            throw hrc;
    72557253        }
    72567254
     
    72587256        MediumLockList *pTargetMediumLockList(new MediumLockList());
    72597257        alock.release();
    7260         rc = aTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
    7261                                              aTarget /* pToLockWrite */,
    7262                                              false /* fMediumLockWriteAll */,
    7263                                              aParent,
    7264                                              *pTargetMediumLockList);
     7258        hrc = aTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
     7259                                              aTarget /* pToLockWrite */,
     7260                                              false /* fMediumLockWriteAll */,
     7261                                              aParent,
     7262                                              *pTargetMediumLockList);
    72657263        alock.acquire();
    7266         if (FAILED(rc))
     7264        if (FAILED(hrc))
    72677265        {
    72687266            delete pSourceMediumLockList;
    72697267            delete pTargetMediumLockList;
    7270             throw rc;
     7268            throw hrc;
    72717269        }
    72727270
    72737271        alock.release();
    7274         rc = pSourceMediumLockList->Lock();
     7272        hrc = pSourceMediumLockList->Lock();
    72757273        alock.acquire();
    7276         if (FAILED(rc))
     7274        if (FAILED(hrc))
    72777275        {
    72787276            delete pSourceMediumLockList;
    72797277            delete pTargetMediumLockList;
    7280             throw setError(rc,
     7278            throw setError(hrc,
    72817279                           tr("Failed to lock source media '%s'"),
    72827280                           i_getLocationFull().c_str());
    72837281        }
    72847282        alock.release();
    7285         rc = pTargetMediumLockList->Lock();
     7283        hrc = pTargetMediumLockList->Lock();
    72867284        alock.acquire();
    7287         if (FAILED(rc))
     7285        if (FAILED(hrc))
    72887286        {
    72897287            delete pSourceMediumLockList;
    72907288            delete pTargetMediumLockList;
    7291             throw setError(rc,
     7289            throw setError(hrc,
    72927290                           tr("Failed to lock target media '%s'"),
    72937291                           aTarget->i_getLocationFull().c_str());
     
    72957293
    72967294        pProgress.createObject();
    7297         rc = pProgress->init(m->pVirtualBox,
    7298                              static_cast <IMedium *>(this),
    7299                              BstrFmt(tr("Creating clone medium '%s'"), aTarget->m->strLocationFull.c_str()).raw(),
    7300                              TRUE /* aCancelable */);
    7301         if (FAILED(rc))
     7295        hrc = pProgress->init(m->pVirtualBox,
     7296                              static_cast <IMedium *>(this),
     7297                              BstrFmt(tr("Creating clone medium '%s'"), aTarget->m->strLocationFull.c_str()).raw(),
     7298                              TRUE /* aCancelable */);
     7299        if (FAILED(hrc))
    73027300        {
    73037301            delete pSourceMediumLockList;
    73047302            delete pTargetMediumLockList;
    7305             throw rc;
     7303            throw hrc;
    73067304        }
    73077305
     
    73117309                                      idxDstImageSame, pSourceMediumLockList,
    73127310                                      pTargetMediumLockList, false, false, aNotify);
    7313         rc = pTask->hrc();
    7314         AssertComRC(rc);
    7315         if (FAILED(rc))
    7316             throw rc;
     7311        hrc = pTask->hrc();
     7312        AssertComRC(hrc);
     7313        if (FAILED(hrc))
     7314            throw hrc;
    73177315
    73187316        if (aTarget->m->state == MediumState_NotCreated)
    73197317            aTarget->m->state = MediumState_Creating;
    73207318    }
    7321     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    7322 
    7323     if (SUCCEEDED(rc))
    7324     {
    7325         rc = pTask->createThread();
     7319    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     7320
     7321    if (SUCCEEDED(hrc))
     7322    {
     7323        hrc = pTask->createThread();
    73267324        pTask = NULL;
    7327         if (SUCCEEDED(rc))
     7325        if (SUCCEEDED(hrc))
    73287326            pProgress.queryInterfaceTo(aProgress);
    73297327    }
     
    73317329        delete pTask;
    73327330
    7333     return rc;
     7331    return hrc;
    73347332}
    73357333
     
    73987396HRESULT Medium::i_preparationForMoving(const Utf8Str &aLocation)
    73997397{
    7400     HRESULT rc = E_FAIL;
     7398    HRESULT hrc = E_FAIL;
    74017399
    74027400    if (i_getLocationFull() != aLocation)
     
    74047402        m->strNewLocationFull = aLocation;
    74057403        m->fMoveThisMedium = true;
    7406         rc = S_OK;
    7407     }
    7408 
    7409     return rc;
     7404        hrc = S_OK;
     7405    }
     7406
     7407    return hrc;
    74107408}
    74117409
     
    74717469        return E_FAIL;
    74727470
    7473     HRESULT rc = S_OK;
     7471    HRESULT hrc = S_OK;
    74747472
    74757473    int vrc = VINF_SUCCESS;
     
    75237521    ComPtr<IToken> pToken;
    75247522    if (uOpenFlags & (VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_SHAREABLE))
    7525         rc = LockRead(pToken.asOutParam());
     7523        hrc = LockRead(pToken.asOutParam());
    75267524    else
    7527         rc = LockWrite(pToken.asOutParam());
    7528     if (FAILED(rc)) return rc;
     7525        hrc = LockWrite(pToken.asOutParam());
     7526    if (FAILED(hrc)) return hrc;
    75297527
    75307528    /* Copies of the input state fields which are not read-only,
     
    77317729                    ComObjPtr<Medium> pParent;
    77327730                    if (RTUuidIsNull(&parentId))
    7733                         rc = VBOX_E_OBJECT_NOT_FOUND;
     7731                        hrc = VBOX_E_OBJECT_NOT_FOUND;
    77347732                    else
    7735                         rc = pVirtualBox->i_findHardDiskById(Guid(parentId), false /* aSetError */, &pParent);
    7736                     if (FAILED(rc))
     7733                        hrc = pVirtualBox->i_findHardDiskById(Guid(parentId), false /* aSetError */, &pParent);
     7734                    if (FAILED(hrc))
    77377735                    {
    77387736                        if (fSetImageId && !fSetParentId)
     
    77447742                             * API client wants to adjust a complete medium
    77457743                             * hierarchy one by one. */
    7746                             rc = S_OK;
     7744                            hrc = S_OK;
    77477745                            alock.acquire();
    77487746                            RTUuidClear(&parentId);
     
    78577855        catch (HRESULT hrcXcpt)
    78587856        {
    7859             rc = hrcXcpt;
     7857            hrc = hrcXcpt;
    78607858        }
    78617859
     
    78637861        if (RT_FAILURE(vrc))
    78647862        {
    7865             lastAccessError = Utf8StrFmt(tr("Could not update and close the medium '%s'%s"),
    7866                                          location.c_str(), i_vdError(vrc).c_str());
     7863            lastAccessError.printf(tr("Could not update and close the medium '%s'%s"),
     7864                                   location.c_str(), i_vdError(vrc).c_str());
    78677865            success = false;
    78687866            throw S_OK;
     
    78717869    catch (HRESULT hrcXcpt)
    78727870    {
    7873         rc = hrcXcpt;
     7871        hrc = hrcXcpt;
    78747872    }
    78757873
     
    78937891    {
    78947892        m->strLastAccessError = lastAccessError;
    7895         Log1WarningFunc(("'%s' is not accessible (error='%s', rc=%Rhrc, vrc=%Rrc)\n",
    7896                          location.c_str(), m->strLastAccessError.c_str(), rc, vrc));
     7893        Log1WarningFunc(("'%s' is not accessible (error='%s', hrc=%Rhrc, vrc=%Rrc)\n",
     7894                         location.c_str(), m->strLastAccessError.c_str(), hrc, vrc));
    78977895    }
    78987896
     
    79107908    pToken.setNull();
    79117909
    7912     if (FAILED(rc))
    7913         return rc;
     7910    if (FAILED(hrc))
     7911        return hrc;
    79147912
    79157913    /* If this is a base image which incorrectly has a parent UUID set,
     
    79237921        if (fRepairImageZeroParentUuid)
    79247922        {
    7925             rc = LockWrite(pToken.asOutParam());
    7926             if (FAILED(rc))
     7923            hrc = LockWrite(pToken.asOutParam());
     7924            if (FAILED(hrc))
    79277925                break;
    79287926
     
    79527950                catch (HRESULT hrcXcpt)
    79537951                {
    7954                     rc = hrcXcpt;
     7952                    hrc = hrcXcpt;
    79557953                }
    79567954
     
    79597957            catch (HRESULT hrcXcpt)
    79607958            {
    7961                 rc = hrcXcpt;
     7959                hrc = hrcXcpt;
    79627960            }
    79637961
    79647962            pToken->Abandon();
    79657963            pToken.setNull();
    7966             if (FAILED(rc))
     7964            if (FAILED(hrc))
    79677965                break;
    79687966        }
    79697967    } while(0);
    79707968
    7971     return rc;
     7969    return hrc;
    79727970}
    79737971
     
    80118009        i_deparent();
    80128010
    8013     HRESULT rc = m->pVirtualBox->i_unregisterMedium(this);
    8014     if (FAILED(rc))
     8011    HRESULT hrc = m->pVirtualBox->i_unregisterMedium(this);
     8012    if (FAILED(hrc))
    80158013    {
    80168014        if (pParentBackup)
     
    80218019    }
    80228020
    8023     return rc;
     8021    return hrc;
    80248022}
    80258023
     
    80558053HRESULT Medium::i_setStateError()
    80568054{
    8057     HRESULT rc = E_FAIL;
     8055    HRESULT hrc;
    80588056
    80598057    switch (m->state)
    80608058    {
    80618059        case MediumState_NotCreated:
    8062         {
    8063             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8064                           tr("Storage for the medium '%s' is not created"),
    8065                           m->strLocationFull.c_str());
     8060            hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8061                           tr("Storage for the medium '%s' is not created"),
     8062                           m->strLocationFull.c_str());
    80668063            break;
    8067         }
    80688064        case MediumState_Created:
    8069         {
    8070             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8071                           tr("Storage for the medium '%s' is already created"),
    8072                           m->strLocationFull.c_str());
     8065            hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8066                           tr("Storage for the medium '%s' is already created"),
     8067                           m->strLocationFull.c_str());
    80738068            break;
    8074         }
    80758069        case MediumState_LockedRead:
    8076         {
    8077             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8078                           tr("Medium '%s' is locked for reading by another task"),
    8079                           m->strLocationFull.c_str());
     8070            hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8071                           tr("Medium '%s' is locked for reading by another task"),
     8072                           m->strLocationFull.c_str());
    80808073            break;
    8081         }
    80828074        case MediumState_LockedWrite:
    8083         {
    8084             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8085                           tr("Medium '%s' is locked for writing by another task"),
    8086                           m->strLocationFull.c_str());
     8075            hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8076                           tr("Medium '%s' is locked for writing by another task"),
     8077                           m->strLocationFull.c_str());
    80878078            break;
    8088         }
    80898079        case MediumState_Inaccessible:
    8090         {
    80918080            /* be in sync with Console::powerUpThread() */
    80928081            if (!m->strLastAccessError.isEmpty())
    8093                 rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8094                               tr("Medium '%s' is not accessible. %s"),
    8095                               m->strLocationFull.c_str(), m->strLastAccessError.c_str());
     8082                hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8083                               tr("Medium '%s' is not accessible. %s"),
     8084                               m->strLocationFull.c_str(), m->strLastAccessError.c_str());
    80968085            else
    8097                 rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8098                               tr("Medium '%s' is not accessible"),
    8099                               m->strLocationFull.c_str());
     8086                hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8087                               tr("Medium '%s' is not accessible"),
     8088                               m->strLocationFull.c_str());
    81008089            break;
    8101         }
    81028090        case MediumState_Creating:
    8103         {
    8104             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8105                           tr("Storage for the medium '%s' is being created"),
    8106                           m->strLocationFull.c_str());
     8091            hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8092                           tr("Storage for the medium '%s' is being created"),
     8093                           m->strLocationFull.c_str());
    81078094            break;
    8108         }
    81098095        case MediumState_Deleting:
    8110         {
    8111             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
    8112                           tr("Storage for the medium '%s' is being deleted"),
    8113                           m->strLocationFull.c_str());
     8096            hrc = setError(VBOX_E_INVALID_OBJECT_STATE,
     8097                           tr("Storage for the medium '%s' is being deleted"),
     8098                           m->strLocationFull.c_str());
    81148099            break;
    8115         }
    81168100        default:
    8117         {
    81188101            AssertFailed();
     8102            hrc = E_FAIL;
    81198103            break;
    8120         }
    8121     }
    8122 
    8123     return rc;
     8104    }
     8105
     8106    return hrc;
    81248107}
    81258108
     
    82488231                                        tr("Could not get the storage format of the medium '%s' (%Rrc)"),
    82498232                                        locationFull.c_str(), vrc);
    8250                 HRESULT rc = i_setFormat(aFormat);
     8233                HRESULT hrc = i_setFormat(aFormat);
    82518234                /* setFormat() must not fail since we've just used the backend so
    82528235                         * the format object must be there */
    8253                 AssertComRCReturnRC(rc);
     8236                AssertComRCReturnRC(hrc);
    82548237            }
    82558238            else if (   enmType == VDTYPE_INVALID
     
    82698252                ComAssertRet(backendName != NULL && *backendName != '\0', E_FAIL);
    82708253
    8271                 HRESULT rc = i_setFormat(backendName);
     8254                HRESULT hrc = i_setFormat(backendName);
    82728255                RTStrFree(backendName);
    82738256
    82748257                /* setFormat() must not fail since we've just used the backend so
    82758258                 * the format object must be there */
    8276                 AssertComRCReturnRC(rc);
     8259                AssertComRCReturnRC(hrc);
    82778260            }
    82788261        }
     
    83998382        com::Utf8Str strKey;
    84008383
    8401         HRESULT rc = strFilter.assignEx(aName, 0, offSlash);
    8402         if (FAILED(rc))
     8384        HRESULT hrc = strFilter.assignEx(aName, 0, offSlash);
     8385        if (FAILED(hrc))
    84038386            return false;
    84048387
    8405         rc = strKey.assignEx(aName, offSlash + 1, aName.length() - offSlash - 1); /* Skip slash */
    8406         if (FAILED(rc))
     8388        hrc = strKey.assignEx(aName, offSlash + 1, aName.length() - offSlash - 1); /* Skip slash */
     8389        if (FAILED(hrc))
    84078390            return false;
    84088391
     
    84528435
    84538436    if (m->vdError.isEmpty())
    8454         error = Utf8StrFmt(" (%Rrc)", aVRC);
     8437        error.printf(" (%Rrc)", aVRC);
    84558438    else
    8456         error = Utf8StrFmt(".\n%s", m->vdError.c_str());
     8439        error.printf(".\n%s", m->vdError.c_str());
    84578440
    84588441    m->vdError.setNull();
     
    84708453 *
    84718454 * @param   pvUser          The opaque data passed on container creation.
    8472  * @param   rc              The VBox error code.
     8455 * @param   vrc             The VBox error code.
    84738456 * @param   SRC_POS         Use RT_SRC_POS.
    84748457 * @param   pszFormat       Error message format string.
     
    84768459 */
    84778460/*static*/
    8478 DECLCALLBACK(void) Medium::i_vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
     8461DECLCALLBACK(void) Medium::i_vdErrorCall(void *pvUser, int vrc, RT_SRC_POS_DECL,
    84798462                                         const char *pszFormat, va_list va)
    84808463{
     
    84848467    AssertReturnVoid(that != NULL);
    84858468
     8469    va_list vaCopy; /* For gcc */
     8470    va_copy(vaCopy, va);
    84868471    if (that->m->vdError.isEmpty())
    8487         that->m->vdError =
    8488             Utf8StrFmt("%s (%Rrc)", Utf8Str(pszFormat, va).c_str(), rc);
     8472        that->m->vdError.printf("%N (%Rrc)", pszFormat, &vaCopy, vrc);
    84898473    else
    8490         that->m->vdError =
    8491             Utf8StrFmt("%s.\n%s (%Rrc)", that->m->vdError.c_str(),
    8492                        Utf8Str(pszFormat, va).c_str(), rc);
     8474        that->m->vdError.appendPrintf(".\n%N (%Rrc)", pszFormat, &vaCopy, vrc);
     8475    va_end(vaCopy);
    84938476}
    84948477
     
    88918874     * to lock order violations, it probably causes lock order issues related
    88928875     * to the AutoCaller usage. */
    8893     HRESULT rc = S_OK;
     8876    HRESULT hrc = S_OK;
    88948877
    88958878    /* these parameters we need after creation */
     
    89338916            if (capabilities & MediumFormatCapabilities_File)
    89348917            {
    8935                 rc = VirtualBox::i_ensureFilePathExists(location, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
    8936                 if (FAILED(rc))
    8937                     throw rc;
     8918                hrc = VirtualBox::i_ensureFilePathExists(location, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
     8919                if (FAILED(hrc))
     8920                    throw hrc;
    89388921            }
    89398922
     
    89938976                variant = (MediumVariant_T)uImageFlags;
    89948977        }
    8995         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     8978        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    89968979
    89978980        VDDestroy(hdd);
    89988981    }
    8999     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    9000 
    9001     if (SUCCEEDED(rc))
     8982    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     8983
     8984    if (SUCCEEDED(hrc))
    90028985    {
    90038986        /* register with mVirtualBox as the last step and move to
     
    90068989        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    90078990        ComObjPtr<Medium> pMedium;
    9008         rc = m->pVirtualBox->i_registerMedium(this, &pMedium, treeLock);
     8991        hrc = m->pVirtualBox->i_registerMedium(this, &pMedium, treeLock);
    90098992        Assert(pMedium == NULL || this == pMedium);
    90108993    }
     
    90138996    AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
    90148997
    9015     if (SUCCEEDED(rc))
     8998    if (SUCCEEDED(hrc))
    90168999    {
    90179000        m->state = MediumState_Created;
     
    90399022    }
    90409023
    9041     if (task.NotifyAboutChanges() && SUCCEEDED(rc))
     9024    if (task.NotifyAboutChanges() && SUCCEEDED(hrc))
    90429025    {
    90439026        m->pVirtualBox->i_onMediumConfigChanged(this);
     
    90459028    }
    90469029
    9047     return rc;
     9030    return hrc;
    90489031}
    90499032
     
    91559138            if (capabilities & MediumFormatCapabilities_File)
    91569139            {
    9157                 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
    9158                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
    9159                 if (FAILED(rc))
    9160                     throw rc;
     9140                HRESULT hrc = VirtualBox::i_ensureFilePathExists(targetLocation,
     9141                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
     9142                if (FAILED(hrc))
     9143                    throw hrc;
    91619144            }
    91629145
     
    93559338                // just to switch internal state of the lock list to avoid errors during list deletion,
    93569339                // because all meduims in the list already locked by task.mpMediumLockList
    9357                 HRESULT rc = pMediumLockListForResize->Lock(true /* fSkipOverLockedMedia */);
    9358                 if (FAILED(rc))
     9340                HRESULT hrc = pMediumLockListForResize->Lock(true /* fSkipOverLockedMedia */);
     9341                if (FAILED(hrc))
    93599342                {
    93609343                    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    9361                     rc = setError(rc,
    9362                                   tr("Failed to lock the medium '%s' to resize before merge"),
    9363                                   targetName.c_str());
    93649344                    delete pMediumLockListForResize;
    9365                     throw rc;
     9345                    throw  setError(hrc,
     9346                                    tr("Failed to lock the medium '%s' to resize before merge"),
     9347                                    targetName.c_str());
    93669348                }
    93679349
    93689350                ComObjPtr<Progress> pProgress(task.GetProgressObject());
    9369                 rc = pTarget->i_resize(sourceSize, pMediumLockListForResize, &pProgress, true, false);
    9370                 if (FAILED(rc))
     9351                hrc = pTarget->i_resize(sourceSize, pMediumLockListForResize, &pProgress, true, false);
     9352                if (FAILED(hrc))
    93719353                {
    93729354                    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    9373                     rc = setError(rc,
    9374                                   tr("Failed to set size of '%s' to size of '%s'"),
    9375                                   targetName.c_str(), sourceName.c_str());
    93769355                    delete pMediumLockListForResize;
    9377                     throw rc;
     9356                    throw setError(hrc,
     9357                                   tr("Failed to set size of '%s' to size of '%s'"),
     9358                                   targetName.c_str(), sourceName.c_str());
    93789359                }
    93799360                delete pMediumLockListForResize;
     
    93829363            {
    93839364                AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    9384                 HRESULT rc = setError(VBOX_E_NOT_SUPPORTED,
    9385                                       tr("Sizes of '%s' and '%s' are different and medium format does not support resing"),
    9386                                       sourceName.c_str(), targetName.c_str());
    9387                 throw rc;
     9365                throw setError(VBOX_E_NOT_SUPPORTED,
     9366                               tr("Sizes of '%s' and '%s' are different and medium format does not support resing"),
     9367                               sourceName.c_str(), targetName.c_str());
    93889368            }
    93899369        }
     
    95319511    ErrorInfoKeeper eik;
    95329512    MultiResult mrc(rcTmp);
    9533     HRESULT rc2;
     9513    HRESULT hrc2;
    95349514
    95359515    std::set<ComObjPtr<Medium> > pMediumsForNotify;
     
    95479527            /* first, unregister the target since it may become a base
    95489528             * medium which needs re-registration */
    9549             rc2 = m->pVirtualBox->i_unregisterMedium(pTarget);
    9550             AssertComRC(rc2);
     9529            hrc2 = m->pVirtualBox->i_unregisterMedium(pTarget);
     9530            AssertComRC(hrc2);
    95519531
    95529532            /* then, reparent it and disconnect the deleted branch at both ends
     
    95639543            /* then, register again */
    95649544            ComObjPtr<Medium> pMedium;
    9565             rc2 = m->pVirtualBox->i_registerMedium(pTarget, &pMedium,
    9566                                                    treeLock);
    9567             AssertComRC(rc2);
     9545            hrc2 = m->pVirtualBox->i_registerMedium(pTarget, &pMedium, treeLock);
     9546            AssertComRC(hrc2);
    95689547        }
    95699548        else
     
    96259604
    96269605            uIdsForNotify[pMedium->i_getId()] = pMedium->i_getDeviceType();
    9627             rc2 = pMedium->m->pVirtualBox->i_unregisterMedium(pMedium);
    9628             AssertComRC(rc2);
     9606            hrc2 = pMedium->m->pVirtualBox->i_unregisterMedium(pMedium);
     9607            AssertComRC(hrc2);
    96299608
    96309609            /* now, uninitialize the deleted medium (note that
     
    96509629             * caller added by MergeChain before uninit() and updates the
    96519630             * iterator to point to the right place. */
    9652             rc2 = task.mpMediumLockList->RemoveByIterator(it);
    9653             AssertComRC(rc2);
     9631            hrc2 = task.mpMediumLockList->RemoveByIterator(it);
     9632            AssertComRC(hrc2);
    96549633
    96559634            if (task.isAsync() || pMedium != this)
     
    98159794            if (capabilities & MediumFormatCapabilities_File)
    98169795            {
    9817                 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
    9818                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
    9819                 if (FAILED(rc))
    9820                     throw rc;
     9796                HRESULT hrc = VirtualBox::i_ensureFilePathExists(targetLocation,
     9797                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
     9798                if (FAILED(hrc))
     9799                    throw hrc;
    98219800            }
    98229801
     
    1006310042{
    1006410043    LogFlowFuncEnter();
    10065     HRESULT rcOut = S_OK;
     10044    HRESULT hrcOut = S_OK;
    1006610045
    1006710046    /* pTarget is equal "this" in our case */
     
    1007710056    if (!i_isMoveOperation(pTarget))
    1007810057    {
    10079         HRESULT rc = setError(VBOX_E_FILE_ERROR,
    10080                               tr("Wrong preconditions for moving the medium %s"),
    10081                               pTarget->m->strLocationFull.c_str());
    10082         LogFlowFunc(("LEAVE: rc=%Rhrc (early)\n", rc));
    10083         return rc;
     10058        LogFlowFunc(("LEAVE: hrc=VBOX_E_FILE_ERROR (early)\n"));
     10059        return setError(VBOX_E_FILE_ERROR,
     10060                        tr("Wrong preconditions for moving the medium %s"),
     10061                        pTarget->m->strLocationFull.c_str());
    1008410062    }
    1008510063
     
    1014410122            if (targetCapabilities & MediumFormatCapabilities_File)
    1014510123            {
    10146                 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
    10147                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
    10148                 if (FAILED(rc))
    10149                     throw rc;
     10124                HRESULT hrc = VirtualBox::i_ensureFilePathExists(targetLocation,
     10125                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
     10126                if (FAILED(hrc))
     10127                    throw hrc;
    1015010128            }
    1015110129
     
    1018410162
    1018510163            }
    10186             catch (HRESULT hrcXcpt) { rcOut = hrcXcpt; }
    10187 
    10188         }
    10189         catch (HRESULT hrcXcpt) { rcOut = hrcXcpt; }
     10164            catch (HRESULT hrcXcpt) { hrcOut = hrcXcpt; }
     10165
     10166        }
     10167        catch (HRESULT hrcXcpt) { hrcOut = hrcXcpt; }
    1019010168
    1019110169        VDDestroy(hdd);
    1019210170    }
    10193     catch (HRESULT hrcXcpt) { rcOut = hrcXcpt; }
     10171    catch (HRESULT hrcXcpt) { hrcOut = hrcXcpt; }
    1019410172
    1019510173    ErrorInfoKeeper eik;
    10196     MultiResult mrc(rcOut);
     10174    MultiResult mrc(hrcOut);
    1019710175
    1019810176    // now, at the end of this task (always asynchronous), save the settings
     
    1023210210{
    1023310211    NOREF(task);
    10234     HRESULT rc = S_OK;
     10212    HRESULT hrc = S_OK;
    1023510213
    1023610214    try
     
    1026710245
    1026810246        }
    10269         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     10247        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1027010248
    1027110249        VDDestroy(hdd);
    1027210250    }
    10273     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     10251    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1027410252
    1027510253    AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
     
    1028510263    unconst(m->id).clear();
    1028610264
    10287     if (task.NotifyAboutChanges() && SUCCEEDED(rc))
     10265    if (task.NotifyAboutChanges() && SUCCEEDED(hrc))
    1028810266    {
    1028910267        if (m->pParent.isNotNull())
     
    1029210270    }
    1029310271
    10294     return rc;
     10272    return hrc;
    1029510273}
    1029610274
     
    1030510283HRESULT Medium::i_taskResetHandler(Medium::ResetTask &task)
    1030610284{
    10307     HRESULT rc = S_OK;
     10285    HRESULT hrc = S_OK;
    1030810286
    1030910287    uint64_t size = 0, logicalSize = 0;
     
    1042310401                variant = (MediumVariant_T)uImageFlags;
    1042410402        }
    10425         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     10403        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1042610404
    1042710405        VDDestroy(hdd);
    1042810406    }
    10429     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     10407    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1043010408
    1043110409    AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
     
    1043510413    m->variant = variant;
    1043610414
    10437     if (task.NotifyAboutChanges() && SUCCEEDED(rc))
     10415    if (task.NotifyAboutChanges() && SUCCEEDED(hrc))
    1043810416        m->pVirtualBox->i_onMediumConfigChanged(this);
    1043910417
     
    1044110419     * as the task destruction also destroys the media chain. */
    1044210420
    10443     return rc;
     10421    return hrc;
    1044410422}
    1044510423
     
    1045210430HRESULT Medium::i_taskCompactHandler(Medium::CompactTask &task)
    1045310431{
    10454     HRESULT rc = S_OK;
     10432    HRESULT hrc = S_OK;
    1045510433
    1045610434    /* Lock all in {parent,child} order. The lock is also used as a
     
    1052910507            }
    1053010508        }
    10531         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     10509        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1053210510
    1053310511        VDDestroy(hdd);
    1053410512    }
    10535     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    10536 
    10537     if (task.NotifyAboutChanges() && SUCCEEDED(rc))
     10513    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     10514
     10515    if (task.NotifyAboutChanges() && SUCCEEDED(hrc))
    1053810516        m->pVirtualBox->i_onMediumConfigChanged(this);
    1053910517
     
    1054110519     * as the task destruction also destroys the media chain. */
    1054210520
    10543     return rc;
     10521    return hrc;
    1054410522}
    1054510523
     
    1055210530HRESULT Medium::i_taskResizeHandler(Medium::ResizeTask &task)
    1055310531{
    10554     HRESULT rc = S_OK;
     10532    HRESULT hrc = S_OK;
    1055510533
    1055610534    uint64_t size = 0, logicalSize = 0;
     
    1064210620            logicalSize = VDGetSize(hdd, VD_LAST_IMAGE);
    1064310621        }
    10644         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     10622        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1064510623
    1064610624        VDDestroy(hdd);
    1064710625    }
    10648     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
    10649 
    10650     if (SUCCEEDED(rc))
     10626    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
     10627
     10628    if (SUCCEEDED(hrc))
    1065110629    {
    1065210630        AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
     
    1066110639     * as the task destruction also destroys the media chain. */
    1066210640
    10663     return rc;
     10641    return hrc;
    1066410642}
    1066510643
     
    1075310731            if (capabilities & MediumFormatCapabilities_File)
    1075410732            {
    10755                 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
    10756                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
    10757                 if (FAILED(rc))
    10758                     throw rc;
     10733                HRESULT hrc = VirtualBox::i_ensureFilePathExists(targetLocation,
     10734                                                                 !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
     10735                if (FAILED(hrc))
     10736                    throw hrc;
    1075910737            }
    1076010738
     
    1098810966    RT_NOREF(task);
    1098910967# endif
    10990     HRESULT rc = S_OK;
     10968    HRESULT hrc = S_OK;
    1099110969
    1099210970    /* Lock all in {parent,child} order. The lock is also used as a
     
    1100410982            /* Load the plugin */
    1100510983            Utf8Str strPlugin;
    11006             rc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
    11007             if (SUCCEEDED(rc))
     10984            hrc = pExtPackManager->i_getLibraryPathForExtPack(g_szVDPlugin, ORACLE_PUEL_EXTPACK_NAME, &strPlugin);
     10985            if (SUCCEEDED(hrc))
    1100810986            {
    1100910987                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
     
    1117311151            m->pVirtualBox->i_saveModifiedRegistries();
    1117411152        }
    11175         catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     11153        catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1117611154
    1117711155        if (pvBuf)
     
    1118411162# endif
    1118511163    }
    11186     catch (HRESULT hrcXcpt) { rc = hrcXcpt; }
     11164    catch (HRESULT hrcXcpt) { hrc = hrcXcpt; }
    1118711165
    1118811166    /* Everything is explicitly unlocked when the task exits,
    1118911167     * as the task destruction also destroys the media chain. */
    1119011168
    11191     return rc;
     11169    return hrc;
    1119211170}
    1119311171
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