VirtualBox

Changeset 98260 in vbox for trunk/src


Ignore:
Timestamp:
Jan 24, 2023 1:30:40 AM (2 years ago)
Author:
vboxsync
Message:

Main/ConsoleImpl.cpp: rc -> vrc/hrc bugref:10223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r98123 r98260  
    166166 * Once created, the task structure adds itself as a Console caller. This means:
    167167 *
    168  * 1. The user must check for #rc() before using the created structure
    169  *    (e.g. passing it as a thread function argument). If #rc() returns a
     168 * 1. The user must check for #hrc() before using the created structure
     169 *    (e.g. passing it as a thread function argument). If #hrc() returns a
    170170 *    failure, the Console object may not be used by the task.
    171171 * 2. On successful initialization, the structure keeps the Console caller
     
    211211    }
    212212
     213    HRESULT hrc() const { return mRC; }
    213214    HRESULT rc() const { return mRC; }
    214     bool isOk() const { return SUCCEEDED(rc()); }
     215    bool isOk() const { return SUCCEEDED(hrc()); }
    215216
    216217    /** Releases the VM caller before destruction. Not normally necessary. */
     
    320321                ComPtr<IMachine> pMachine = mConsole->i_machine();
    321322                ComPtr<INATRedirectEvent> pNREv = aEvent;
    322                 HRESULT rc = E_FAIL;
    323323                Assert(pNREv);
    324324
    325325                Bstr id;
    326                 rc = pNREv->COMGETTER(MachineId)(id.asOutParam());
    327                 AssertComRC(rc);
     326                HRESULT hrc = pNREv->COMGETTER(MachineId)(id.asOutParam());
     327                AssertComRC(hrc);
    328328                if (id != mConsole->i_getId())
    329329                    break;
     
    343343                pNREv->COMGETTER(GuestPort)(&guestPort);
    344344                ULONG ulSlot;
    345                 rc = pNREv->COMGETTER(Slot)(&ulSlot);
    346                 AssertComRC(rc);
    347                 if (FAILED(rc))
    348                     break;
     345                hrc = pNREv->COMGETTER(Slot)(&ulSlot);
     346                AssertComRCBreak(hrc, RT_NOTHING);
    349347                mConsole->i_onNATRedirectRuleChanged(ulSlot, fRemove, proto, hostIp.raw(), hostPort, guestIp.raw(), guestPort);
    350348                break;
     
    515513    LogFlowThisFunc(("aMachine=%p, aControl=%p\n", aMachine, aControl));
    516514
    517     HRESULT rc = E_FAIL;
    518 
    519515    unconst(mMachine) = aMachine;
    520516    unconst(mControl) = aControl;
     
    522518    /* Cache essential properties and objects, and create child objects */
    523519
    524     rc = mMachine->COMGETTER(State)(&mMachineState);
    525     AssertComRCReturnRC(rc);
    526 
    527     rc = mMachine->COMGETTER(Id)(mstrUuid.asOutParam());
    528     AssertComRCReturnRC(rc);
     520    HRESULT hrc = mMachine->COMGETTER(State)(&mMachineState);
     521    AssertComRCReturnRC(hrc);
     522
     523    hrc = mMachine->COMGETTER(Id)(mstrUuid.asOutParam());
     524    AssertComRCReturnRC(hrc);
    529525
    530526#ifdef VBOX_WITH_EXTPACK
    531527    unconst(mptrExtPackManager).createObject();
    532     rc = mptrExtPackManager->initExtPackManager(NULL, VBOXEXTPACKCTX_VM_PROCESS);
    533         AssertComRCReturnRC(rc);
     528    hrc = mptrExtPackManager->initExtPackManager(NULL, VBOXEXTPACKCTX_VM_PROCESS);
     529    AssertComRCReturnRC(hrc);
    534530#endif
    535531
    536532    // Event source may be needed by other children
    537533    unconst(mEventSource).createObject();
    538     rc = mEventSource->init();
    539     AssertComRCReturnRC(rc);
     534    hrc = mEventSource->init();
     535    AssertComRCReturnRC(hrc);
    540536
    541537    mcAudioRefs = 0;
     
    549545    {
    550546        /* Load the VMM. We won't continue without it being successfully loaded here. */
    551         rc = i_loadVMM();
    552         AssertComRCReturnRC(rc);
    553 
    554         rc = mMachine->COMGETTER(VRDEServer)(unconst(mVRDEServer).asOutParam());
    555         AssertComRCReturnRC(rc);
     547        hrc = i_loadVMM();
     548        AssertComRCReturnRC(hrc);
     549
     550        hrc = mMachine->COMGETTER(VRDEServer)(unconst(mVRDEServer).asOutParam());
     551        AssertComRCReturnRC(hrc);
    556552
    557553        unconst(mGuest).createObject();
    558         rc = mGuest->init(this);
    559         AssertComRCReturnRC(rc);
     554        hrc = mGuest->init(this);
     555        AssertComRCReturnRC(hrc);
    560556
    561557        ULONG cCpus = 1;
    562         rc = mMachine->COMGETTER(CPUCount)(&cCpus);
     558        hrc = mMachine->COMGETTER(CPUCount)(&cCpus);
    563559        mGuest->i_setCpuCount(cCpus);
    564560
    565561        unconst(mKeyboard).createObject();
    566         rc = mKeyboard->init(this);
    567         AssertComRCReturnRC(rc);
     562        hrc = mKeyboard->init(this);
     563        AssertComRCReturnRC(hrc);
    568564
    569565        unconst(mMouse).createObject();
    570         rc = mMouse->init(this);
    571         AssertComRCReturnRC(rc);
     566        hrc = mMouse->init(this);
     567        AssertComRCReturnRC(hrc);
    572568
    573569        unconst(mDisplay).createObject();
    574         rc = mDisplay->init(this);
    575         AssertComRCReturnRC(rc);
     570        hrc = mDisplay->init(this);
     571        AssertComRCReturnRC(hrc);
    576572
    577573        unconst(mVRDEServerInfo).createObject();
    578         rc = mVRDEServerInfo->init(this);
    579         AssertComRCReturnRC(rc);
     574        hrc = mVRDEServerInfo->init(this);
     575        AssertComRCReturnRC(hrc);
    580576
    581577        unconst(mEmulatedUSB).createObject();
    582         rc = mEmulatedUSB->init(this);
    583         AssertComRCReturnRC(rc);
     578        hrc = mEmulatedUSB->init(this);
     579        AssertComRCReturnRC(hrc);
    584580
    585581        /* Init the NVRAM store. */
    586582        ComPtr<INvramStore> pNvramStore;
    587         rc = aMachine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
    588         AssertComRCReturnRC(rc);
     583        hrc = aMachine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
     584        AssertComRCReturnRC(hrc);
    589585
    590586        Bstr strNonVolatilePath;
     
    592588
    593589        unconst(mptrNvramStore).createObject();
    594         rc = mptrNvramStore->init(this, strNonVolatilePath);
    595         AssertComRCReturnRC(rc);
     590        hrc = mptrNvramStore->init(this, strNonVolatilePath);
     591        AssertComRCReturnRC(hrc);
    596592
    597593#ifdef VBOX_WITH_FULL_VM_ENCRYPTION
    598594        Bstr bstrNvramKeyId;
    599595        Bstr bstrNvramKeyStore;
    600         rc = pNvramStore->COMGETTER(KeyId)(bstrNvramKeyId.asOutParam());
    601         AssertComRCReturnRC(rc);
    602         rc = pNvramStore->COMGETTER(KeyStore)(bstrNvramKeyStore.asOutParam());
    603         AssertComRCReturnRC(rc);
     596        hrc = pNvramStore->COMGETTER(KeyId)(bstrNvramKeyId.asOutParam());
     597        AssertComRCReturnRC(hrc);
     598        hrc = pNvramStore->COMGETTER(KeyStore)(bstrNvramKeyStore.asOutParam());
     599        AssertComRCReturnRC(hrc);
    604600        const Utf8Str strNvramKeyId(bstrNvramKeyId);
    605601        const Utf8Str strNvramKeyStore(bstrNvramKeyStore);
     
    609605        /* Grab global and machine shared folder lists */
    610606
    611         rc = i_fetchSharedFolders(true /* aGlobal */);
    612         AssertComRCReturnRC(rc);
    613         rc = i_fetchSharedFolders(false /* aGlobal */);
    614         AssertComRCReturnRC(rc);
     607        hrc = i_fetchSharedFolders(true /* aGlobal */);
     608        AssertComRCReturnRC(hrc);
     609        hrc = i_fetchSharedFolders(false /* aGlobal */);
     610        AssertComRCReturnRC(hrc);
    615611
    616612        /* Create other child objects */
     
    621617        /* Figure out size of meAttachmentType vector */
    622618        ComPtr<IVirtualBox> pVirtualBox;
    623         rc = aMachine->COMGETTER(Parent)(pVirtualBox.asOutParam());
    624         AssertComRC(rc);
     619        hrc = aMachine->COMGETTER(Parent)(pVirtualBox.asOutParam());
     620        AssertComRC(hrc);
    625621        ComPtr<ISystemProperties> pSystemProperties;
    626622        if (pVirtualBox)
     
    658654        {
    659655            ComPtr<IEventSource> pES;
    660             rc = pVirtualBox->COMGETTER(EventSource)(pES.asOutParam());
    661             AssertComRC(rc);
     656            hrc = pVirtualBox->COMGETTER(EventSource)(pES.asOutParam());
     657            AssertComRC(hrc);
    662658            ComObjPtr<VmEventListenerImpl> aVmListener;
    663659            aVmListener.createObject();
     
    669665            eventTypes.push_back(VBoxEventType_OnHostPCIDevicePlug);
    670666            eventTypes.push_back(VBoxEventType_OnExtraDataChanged);
    671             rc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true);
    672             AssertComRC(rc);
     667            hrc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true);
     668            AssertComRC(hrc);
    673669        }
    674670    }
     
    679675#ifdef VBOX_WITH_EXTPACK
    680676    /* Let the extension packs have a go at things (hold no locks). */
    681     if (SUCCEEDED(rc))
     677    if (SUCCEEDED(hrc))
    682678        mptrExtPackManager->i_callAllConsoleReadyHooks(this);
    683679#endif
     
    709705        ComPtr<IEventSource> pES;
    710706        ComPtr<IVirtualBox> pVirtualBox;
    711         HRESULT rc = mMachine->COMGETTER(Parent)(pVirtualBox.asOutParam());
    712         AssertComRC(rc);
    713         if (SUCCEEDED(rc) && !pVirtualBox.isNull())
    714         {
    715             rc = pVirtualBox->COMGETTER(EventSource)(pES.asOutParam());
    716             AssertComRC(rc);
     707        HRESULT hrc = mMachine->COMGETTER(Parent)(pVirtualBox.asOutParam());
     708        AssertComRC(hrc);
     709        if (SUCCEEDED(hrc) && !pVirtualBox.isNull())
     710        {
     711            hrc = pVirtualBox->COMGETTER(EventSource)(pES.asOutParam());
     712            AssertComRC(hrc);
    717713            if (!pES.isNull())
    718714            {
    719                 rc = pES->UnregisterListener(mVmListener);
    720                 AssertComRC(rc);
     715                hrc = pES->UnregisterListener(mVmListener);
     716                AssertComRC(hrc);
    721717            }
    722718        }
     
    909905#endif
    910906
    911     HRESULT rc = i_unloadCryptoIfModule();
    912     AssertComRC(rc);
     907    HRESULT hrc = i_unloadCryptoIfModule();
     908    AssertComRC(hrc);
    913909
    914910    LogFlowThisFuncLeave();
     
    954950                hrc = mMachine->DeleteGuestProperty(Bstr(names[i]).raw());
    955951                if (FAILED(hrc))
    956                     LogRel(("RESET: Could not delete transient property \"%s\", rc=%Rhrc\n",
     952                    LogRel(("RESET: Could not delete transient property \"%s\", hrc=%Rhrc\n",
    957953                            names[i].c_str(), hrc));
    958954            }
     
    960956    }
    961957    else
    962         LogRel(("RESET: Unable to enumerate guest properties, rc=%Rhrc\n", hrc));
     958        LogRel(("RESET: Unable to enumerate guest properties, hrc=%Rhrc\n", hrc));
    963959}
    964960
     
    12561252                uint32_t u32GuestFlags = VMMDEV_SETCREDENTIALS_JUDGE;
    12571253
    1258                 int rc = pDevPort->pfnSetCredentials(pDevPort, pszUser, pszPassword, pszDomain, u32GuestFlags);
    1259 
    1260                 if (RT_SUCCESS(rc))
     1254                int vrc = pDevPort->pfnSetCredentials(pDevPort, pszUser, pszPassword, pszDomain, u32GuestFlags);
     1255                if (RT_SUCCESS(vrc))
    12611256                {
    12621257                    /* Wait for guest. */
    1263                     rc = m_pVMMDev->WaitCredentialsJudgement(authTimeout, &u32GuestFlags);
    1264 
    1265                     if (RT_SUCCESS(rc))
     1258                    vrc = m_pVMMDev->WaitCredentialsJudgement(authTimeout, &u32GuestFlags);
     1259                    if (RT_SUCCESS(vrc))
    12661260                    {
    12671261                        switch (u32GuestFlags & (  VMMDEV_CREDENTIALS_JUDGE_OK
     
    12731267                            case VMMDEV_CREDENTIALS_JUDGE_OK:          guestJudgement = AuthGuestAccessGranted; break;
    12741268                            default:
    1275                                 LogFlowFunc(("Invalid guest flags %#08x!!!\n", u32GuestFlags)); break;
     1269                                LogFlowFunc(("Invalid guest flags %#08x!!!\n", u32GuestFlags));
     1270                                break;
    12761271                        }
    12771272                    }
    12781273                    else
    1279                     {
    1280                         LogFlowFunc(("Wait for credentials judgement rc = %Rrc!!!\n", rc));
    1281                     }
    1282 
     1274                        LogFlowFunc(("Wait for credentials judgement vrc = %Rrc!!!\n", vrc));
    12831275                    LogFlowFunc(("Guest judgement %d\n", guestJudgement));
    12841276                }
    12851277                else
    1286                 {
    1287                     LogFlowFunc(("Could not set credentials rc = %Rrc!!!\n", rc));
    1288                 }
     1278                    LogFlowFunc(("Could not set credentials vrc = %Rrc!!!\n", vrc));
    12891279            }
    12901280
     
    13071297                }
    13081298            }
    1309         } break;
     1299            break;
     1300        }
    13101301
    13111302        default:
     
    14051396        if (pDevPort)
    14061397        {
    1407             int rc = pDevPort->pfnSetCredentials(m_pVMMDev->getVMMDevPort(),
    1408                                                  pszUser, pszPassword, pszDomain, u32GuestFlags);
    1409             AssertRC(rc);
     1398            int vrc = pDevPort->pfnSetCredentials(m_pVMMDev->getVMMDevPort(), pszUser, pszPassword, pszDomain, u32GuestFlags);
     1399            AssertRC(vrc);
    14101400        }
    14111401    }
     
    18751865        ComObjPtr<SharedFolder> pSharedFolder;
    18761866        pSharedFolder.createObject();
    1877         HRESULT rc = pSharedFolder->init(this,
    1878                                          strName,
    1879                                          strHostPath,
    1880                                          writable,
    1881                                          autoMount,
    1882                                          strAutoMountPoint,
    1883                                          false /* fFailOnError */);
    1884         AssertComRCReturn(rc, VERR_INTERNAL_ERROR);
     1867        HRESULT hrc = pSharedFolder->init(this,
     1868                                          strName,
     1869                                          strHostPath,
     1870                                          writable,
     1871                                          autoMount,
     1872                                          strAutoMountPoint,
     1873                                          false /* fFailOnError */);
     1874        AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
    18851875
    18861876        m_mapSharedFolders.insert(std::make_pair(strName, pSharedFolder));
     
    19101900             pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
    19111901
    1912     int  rc;
    19131902    Bstr name(pCBData->pcszName);
    19141903    Bstr value(pCBData->pcszValue);
     
    19251914        ::FireGuestPropertyChangedEvent(pConsole->mEventSource, pConsole->i_getId().raw(), name.raw(), value.raw(), flags.raw(),
    19261915                                        fWasDeleted);
    1927         rc = VINF_SUCCESS;
    1928     }
    1929     else
    1930     {
    1931         LogFlow(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n",
    1932                  hrc, pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
    1933         rc = Global::vboxStatusCodeFromCOM(hrc);
    1934     }
    1935     return rc;
     1916        return VINF_SUCCESS;
     1917    }
     1918    LogFlow(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n",
     1919             hrc, pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
     1920    return Global::vboxStatusCodeFromCOM(hrc);
    19361921}
    19371922
     
    21552140
    21562141    /* Read console data stored in the saved state file (if not yet done) */
    2157     HRESULT rc = i_loadDataFromSavedState();
    2158     if (FAILED(rc)) return rc;
     2142    HRESULT hrc = i_loadDataFromSavedState();
     2143    if (FAILED(hrc))
     2144        return hrc;
    21592145
    21602146    size_t i = 0;
     
    24072393
    24082394    int vrc = pVMM->pfnPDMR3DeviceDetach(pUVM, "acpi", 0, idCpu, 0);
    2409     Log(("UnplugCpu: rc=%Rrc\n", vrc));
     2395    Log(("UnplugCpu: vrc=%Rrc\n", vrc));
    24102396
    24112397    return vrc;
     
    24142400HRESULT Console::i_doCPURemove(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM)
    24152401{
    2416     HRESULT rc = S_OK;
    2417 
    24182402    LogFlowThisFuncEnter();
    24192403
    24202404    AutoCaller autoCaller(this);
    2421     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     2405    HRESULT hrc = autoCaller.rc();
     2406    if (FAILED(hrc))
     2407        return hrc;
    24222408
    24232409    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    24362422    /* Check if the CPU is present */
    24372423    BOOL fCpuAttached;
    2438     rc = mMachine->GetCPUStatus(aCpu, &fCpuAttached);
    2439     if (FAILED(rc))
    2440         return rc;
     2424    hrc = mMachine->GetCPUStatus(aCpu, &fCpuAttached);
     2425    if (FAILED(hrc))
     2426        return hrc;
    24412427    if (!fCpuAttached)
    24422428        return setError(E_FAIL, tr("CPU %d is not attached"), aCpu);
     
    25062492        }
    25072493        else
    2508            rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Hot-Remove failed (rc=%Rrc)"), vrc);
     2494           hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Hot-Remove failed (vrc=%Rrc)"), vrc);
    25092495    }
    25102496    else
    2511         rc = setErrorBoth(VBOX_E_VM_ERROR, VERR_RESOURCE_BUSY,
    2512                           tr("Hot-Remove was aborted because the CPU may still be used by the guest"), VERR_RESOURCE_BUSY);
    2513 
    2514     LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc));
     2497        hrc = setErrorBoth(VBOX_E_VM_ERROR, VERR_RESOURCE_BUSY,
     2498                           tr("Hot-Remove was aborted because the CPU may still be used by the guest"), VERR_RESOURCE_BUSY);
     2499
     2500    LogFlowThisFunc(("mMachineState=%d, hrc=%Rhrc\n", mMachineState, hrc));
    25152501    LogFlowThisFuncLeave();
    2516     return rc;
     2502    return hrc;
    25172503}
    25182504
     
    25222508    RT_NOREF(pThis);
    25232509
    2524     int rc = pVMM->pfnVMR3HotPlugCpu(pUVM, idCpu);
    2525     AssertRC(rc);
     2510    int vrc = pVMM->pfnVMR3HotPlugCpu(pUVM, idCpu);
     2511    AssertRC(vrc);
     2512
     2513    /** @todo r=bird: Error handling here just sucks. */
    25262514
    25272515    PCFGMNODE pInst = pVMM->pfnCFGMR3GetChild(pVMM->pfnCFGMR3GetRootU(pUVM), "Devices/acpi/0/");
     
    25302518    pVMM->pfnCFGMR3RemoveNode(pVMM->pfnCFGMR3GetChildF(pInst, "LUN#%u", idCpu));
    25312519
    2532 #define RC_CHECK() do { if (RT_FAILURE(rc)) { AssertReleaseRC(rc); break; } } while (0)
     2520#define RC_CHECK() do { AssertReleaseRC(vrc); } while (0)
    25332521
    25342522    PCFGMNODE pLunL0;
    25352523    PCFGMNODE pCfg;
    2536     rc = pVMM->pfnCFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%u", idCpu);    RC_CHECK();
    2537     rc = pVMM->pfnCFGMR3InsertString(pLunL0, "Driver",       "ACPICpu"); RC_CHECK();
    2538     rc = pVMM->pfnCFGMR3InsertNode(pLunL0,   "Config",       &pCfg);     RC_CHECK();
     2524    vrc = pVMM->pfnCFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%u", idCpu);    RC_CHECK();
     2525    vrc = pVMM->pfnCFGMR3InsertString(pLunL0, "Driver",       "ACPICpu"); RC_CHECK();
     2526    vrc = pVMM->pfnCFGMR3InsertNode(pLunL0,   "Config",       &pCfg);     RC_CHECK();
    25392527
    25402528    /*
     
    25422530     */
    25432531    PPDMIBASE pBase;
    2544     rc = pVMM->pfnPDMR3DeviceAttach(pUVM, "acpi", 0, idCpu, 0, &pBase); RC_CHECK();
    2545 
    2546     Log(("PlugCpu: rc=%Rrc\n", rc));
     2532    vrc = pVMM->pfnPDMR3DeviceAttach(pUVM, "acpi", 0, idCpu, 0, &pBase); RC_CHECK();
     2533
     2534    Log(("PlugCpu: vrc=%Rrc\n", vrc));
    25472535
    25482536    pVMM->pfnCFGMR3Dump(pInst);
     
    25552543HRESULT Console::i_doCPUAdd(ULONG aCpu, PUVM pUVM, PCVMMR3VTABLE pVMM)
    25562544{
    2557     HRESULT rc = S_OK;
    2558 
    25592545    LogFlowThisFuncEnter();
    25602546
    25612547    AutoCaller autoCaller(this);
    2562     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     2548    HRESULT hrc = autoCaller.rc();
     2549    if (FAILED(hrc))
     2550        return hrc;
    25632551
    25642552    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    25782566    /* Check if the CPU is present */
    25792567    BOOL fCpuAttached;
    2580     rc = mMachine->GetCPUStatus(aCpu, &fCpuAttached);
    2581     if (FAILED(rc)) return rc;
     2568    hrc = mMachine->GetCPUStatus(aCpu, &fCpuAttached);
     2569    if (FAILED(hrc))
     2570        return hrc;
    25822571
    25832572    if (fCpuAttached)
    2584         return setError(E_FAIL,
    2585                         tr("CPU %d is already attached"), aCpu);
     2573        return setError(E_FAIL, tr("CPU %d is already attached"), aCpu);
    25862574
    25872575    /*
     
    26152603    }
    26162604    else
    2617         rc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not add CPU to the machine (%Rrc)"), vrc);
    2618 
    2619     LogFlowThisFunc(("mMachineState=%d, rc=%Rhrc\n", mMachineState, rc));
     2605        hrc = setErrorBoth(VBOX_E_VM_ERROR, vrc, tr("Could not add CPU to the machine (%Rrc)"), vrc);
     2606
     2607    LogFlowThisFunc(("mMachineState=%d, hrc=%Rhrc\n", mMachineState, hrc));
    26202608    LogFlowThisFuncLeave();
    2621     return rc;
     2609    return hrc;
    26222610}
    26232611
     
    26262614    LogFlowThisFuncEnter();
    26272615
    2628     HRESULT rc = i_pause(Reason_Unspecified);
    2629 
    2630     LogFlowThisFunc(("rc=%Rhrc\n", rc));
     2616    HRESULT hrc = i_pause(Reason_Unspecified);
     2617
     2618    LogFlowThisFunc(("hrc=%Rhrc\n", hrc));
    26312619    LogFlowThisFuncLeave();
    2632     return rc;
     2620    return hrc;
    26332621}
    26342622
     
    26442632                        Global::stringifyMachineState(mMachineState));
    26452633
    2646     HRESULT rc = i_resume(Reason_Unspecified, alock);
    2647 
    2648     LogFlowThisFunc(("rc=%Rhrc\n", rc));
     2634    HRESULT hrc = i_resume(Reason_Unspecified, alock);
     2635
     2636    LogFlowThisFunc(("hrc=%Rhrc\n", hrc));
    26492637    LogFlowThisFuncLeave();
    2650     return rc;
     2638    return hrc;
    26512639}
    26522640
     
    30663054{
    30673055#ifdef VBOX_WITH_USB
    3068 
    30693056    aDevice = NULL;
    30703057
    30713058    SafeIfaceArray<IUSBDevice> devsvec;
    3072     HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
    3073     if (FAILED(rc)) return rc;
     3059    HRESULT hrc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
     3060    if (FAILED(hrc))
     3061        return hrc;
    30743062
    30753063    for (size_t i = 0; i < devsvec.size(); ++i)
    30763064    {
    30773065        Bstr bstrAddress;
    3078         rc = devsvec[i]->COMGETTER(Address)(bstrAddress.asOutParam());
    3079         if (FAILED(rc)) return rc;
     3066        hrc = devsvec[i]->COMGETTER(Address)(bstrAddress.asOutParam());
     3067        if (FAILED(hrc))
     3068            return hrc;
    30803069        if (bstrAddress == aName)
    30813070        {
     
    30983087{
    30993088#ifdef VBOX_WITH_USB
    3100 
    31013089    aDevice = NULL;
    31023090
    31033091    SafeIfaceArray<IUSBDevice> devsvec;
    3104     HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
    3105     if (FAILED(rc)) return rc;
     3092    HRESULT hrc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
     3093    if (FAILED(hrc))
     3094        return hrc;
    31063095
    31073096    Utf8Str const strId = aId.toString();
     
    31093098    {
    31103099        Bstr id;
    3111         rc = devsvec[i]->COMGETTER(Id)(id.asOutParam());
    3112         if (FAILED(rc)) return rc;
     3100        hrc = devsvec[i]->COMGETTER(Id)(id.asOutParam());
     3101        if (FAILED(hrc))
     3102            return hrc;
    31133103        if (id == strId)
    31143104        {
     
    31523142
    31533143    ComObjPtr<SharedFolder> pSharedFolder;
    3154     HRESULT rc = i_findSharedFolder(aName, pSharedFolder, false /* aSetError */);
    3155     if (SUCCEEDED(rc))
    3156         return setError(VBOX_E_FILE_ERROR,
    3157                         tr("Shared folder named '%s' already exists"),
    3158                         aName.c_str());
     3144    HRESULT hrc = i_findSharedFolder(aName, pSharedFolder, false /* aSetError */);
     3145    if (SUCCEEDED(hrc))
     3146        return setError(VBOX_E_FILE_ERROR, tr("Shared folder named '%s' already exists"), aName.c_str());
    31593147
    31603148    pSharedFolder.createObject();
    3161     rc = pSharedFolder->init(this,
    3162                              aName,
    3163                              aHostPath,
    3164                              !!aWritable,
    3165                              !!aAutomount,
    3166                              aAutoMountPoint,
    3167                              true /* fFailOnError */);
    3168     if (FAILED(rc)) return rc;
     3149    hrc = pSharedFolder->init(this,
     3150                              aName,
     3151                              aHostPath,
     3152                              !!aWritable,
     3153                              !!aAutomount,
     3154                              aAutoMountPoint,
     3155                              true /* fFailOnError */);
     3156    if (FAILED(hrc))
     3157        return hrc;
    31693158
    31703159    /* If the VM is online and supports shared folders, share this folder
     
    31803169        if (i_findOtherSharedFolder(aName, it))
    31813170        {
    3182             rc = i_removeSharedFolder(aName);
    3183             if (FAILED(rc))
    3184                 return rc;
     3171            hrc = i_removeSharedFolder(aName);
     3172            if (FAILED(hrc))
     3173                return hrc;
    31853174        }
    31863175
    31873176        /* second, create the given folder */
    3188         rc = i_createSharedFolder(aName, SharedFolderData(aHostPath, !!aWritable, !!aAutomount, aAutoMountPoint));
    3189         if (FAILED(rc))
    3190             return rc;
     3177        hrc = i_createSharedFolder(aName, SharedFolderData(aHostPath, !!aWritable, !!aAutomount, aAutoMountPoint));
     3178        if (FAILED(hrc))
     3179            return hrc;
    31913180    }
    31923181
     
    31993188    LogFlowThisFunc(("Leaving for '%s' -> '%s'\n", aName.c_str(), aHostPath.c_str()));
    32003189
    3201     return rc;
     3190    return hrc;
    32023191}
    32033192
     
    32243213
    32253214    ComObjPtr<SharedFolder> pSharedFolder;
    3226     HRESULT rc = i_findSharedFolder(aName, pSharedFolder, true /* aSetError */);
    3227     if (FAILED(rc)) return rc;
     3215    HRESULT hrc = i_findSharedFolder(aName, pSharedFolder, true /* aSetError */);
     3216    if (FAILED(hrc))
     3217        return hrc;
    32283218
    32293219    /* protect the VM handle (if not NULL) */
     
    32373227
    32383228        /* first, remove the given folder */
    3239         rc = i_removeSharedFolder(aName);
    3240         if (FAILED(rc)) return rc;
     3229        hrc = i_removeSharedFolder(aName);
     3230        if (FAILED(hrc))
     3231            return hrc;
    32413232
    32423233        /* first, remove the machine or the global folder if there is any */
     
    32443235        if (i_findOtherSharedFolder(aName, it))
    32453236        {
    3246             rc = i_createSharedFolder(aName, it->second);
    3247             /* don't check rc here because we need to remove the console
     3237            hrc = i_createSharedFolder(aName, it->second);
     3238            /* don't check hrc here because we need to remove the console
    32483239             * folder from the collection even on failure */
    32493240        }
     
    32583249    LogFlowThisFunc(("Leaving for '%s'\n", aName.c_str()));
    32593250
    3260     return rc;
     3251    return hrc;
    32613252}
    32623253
     
    34533444    va_list args;
    34543445    va_start(args, pcsz);
    3455     HRESULT rc = setErrorInternalV(aResultCode,
    3456                                    getStaticClassIID(),
    3457                                    getStaticComponentName(),
    3458                                    pcsz, args,
    3459                                    false /* aWarning */,
    3460                                    true /* aLogIt */);
     3446    HRESULT hrc = setErrorInternalV(aResultCode,
     3447                                    getStaticClassIID(),
     3448                                    getStaticComponentName(),
     3449                                    pcsz, args,
     3450                                    false /* aWarning */,
     3451                                    true /* aLogIt */);
    34613452    va_end(args);
    3462     return rc;
     3453    return hrc;
    34633454}
    34643455
     
    34683459    va_list args;
    34693460    va_start(args, pcsz);
    3470     HRESULT rc = setErrorInternalV(aResultCode,
    3471                                    getStaticClassIID(),
    3472                                    getStaticComponentName(),
    3473                                    pcsz, args,
    3474                                    false /* aWarning */,
    3475                                    true /* aLogIt */,
    3476                                    vrc);
     3461    HRESULT hrc = setErrorInternalV(aResultCode,
     3462                                    getStaticClassIID(),
     3463                                    getStaticComponentName(),
     3464                                    pcsz, args,
     3465                                    false /* aWarning */,
     3466                                    true /* aLogIt */,
     3467                                    vrc);
    34773468    va_end(args);
    3478     return rc;
     3469    return hrc;
    34793470}
    34803471
     
    36283619    /* disable the callback to prevent Console-level state change */
    36293620    mVMStateChangeCallbackDisabled = true;
    3630     int rc = pVMM->pfnVMR3Resume(pUVM, VMRESUMEREASON_RECONFIG);
     3621    int vrc = pVMM->pfnVMR3Resume(pUVM, VMRESUMEREASON_RECONFIG);
    36313622    mVMStateChangeCallbackDisabled = false;
    3632     AssertRC(rc);
    3633     if (RT_FAILURE(rc))
     3623    AssertRC(vrc);
     3624    if (RT_FAILURE(vrc))
    36343625    {
    36353626        VMSTATE enmVMState = pVMM->pfnVMR3GetStateU(pUVM);
     
    36603651    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    36613652
    3662     HRESULT rc = S_OK;
    36633653    const char *pszDevice = NULL;
    36643654
    36653655    SafeIfaceArray<IStorageController> ctrls;
    3666     rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
    3667     AssertComRC(rc);
    3668     IMedium *pMedium;
    3669     rc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
    3670     AssertComRC(rc);
     3656    HRESULT hrc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
     3657    AssertComRC(hrc);
     3658
     3659    IMedium *pMedium = NULL;
     3660    hrc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
     3661    AssertComRC(hrc);
     3662
    36713663    Bstr mediumLocation;
    36723664    if (pMedium)
    36733665    {
    3674         rc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
    3675         AssertComRC(rc);
     3666        hrc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
     3667        AssertComRC(hrc);
    36763668    }
    36773669
    36783670    Bstr attCtrlName;
    3679     rc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
    3680     AssertComRC(rc);
     3671    hrc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
     3672    AssertComRC(hrc);
    36813673    ComPtr<IStorageController> pStorageController;
    36823674    for (size_t i = 0; i < ctrls.size(); ++i)
    36833675    {
    36843676        Bstr ctrlName;
    3685         rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
    3686         AssertComRC(rc);
     3677        hrc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
     3678        AssertComRC(hrc);
    36873679        if (attCtrlName == ctrlName)
    36883680        {
     
    36923684    }
    36933685    if (pStorageController.isNull())
    3694         return setError(E_FAIL,
    3695                         tr("Could not find storage controller '%ls'"), attCtrlName.raw());
     3686        return setError(E_FAIL, tr("Could not find storage controller '%ls'"), attCtrlName.raw());
    36963687
    36973688    StorageControllerType_T enmCtrlType;
    3698     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
    3699     AssertComRC(rc);
     3689    hrc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     3690    AssertComRC(hrc);
    37003691    pszDevice = i_storageControllerTypeToStr(enmCtrlType);
    37013692
    37023693    StorageBus_T enmBus;
    3703     rc = pStorageController->COMGETTER(Bus)(&enmBus);
    3704     AssertComRC(rc);
     3694    hrc = pStorageController->COMGETTER(Bus)(&enmBus);
     3695    AssertComRC(hrc);
     3696
    37053697    ULONG uInstance;
    3706     rc = pStorageController->COMGETTER(Instance)(&uInstance);
    3707     AssertComRC(rc);
     3698    hrc = pStorageController->COMGETTER(Instance)(&uInstance);
     3699    AssertComRC(hrc);
     3700
    37083701    BOOL fUseHostIOCache;
    3709     rc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
    3710     AssertComRC(rc);
     3702    hrc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
     3703    AssertComRC(hrc);
    37113704
    37123705    /*
     
    37153708     */
    37163709    bool fResume = false;
    3717     rc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume);
    3718     if (FAILED(rc))
    3719         return rc;
     3710    hrc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume);
     3711    if (FAILED(hrc))
     3712        return hrc;
    37203713
    37213714    /*
     
    37953788    AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE);
    37963789
    3797     int rc = pThis->i_configMediumAttachment(pcszDevice,
    3798                                              uInstance,
    3799                                              enmBus,
    3800                                              fUseHostIOCache,
    3801                                              false /* fSetupMerge */,
    3802                                              false /* fBuiltinIOCache */,
    3803                                              false /* fInsertDiskIntegrityDrv. */,
    3804                                              0 /* uMergeSource */,
    3805                                              0 /* uMergeTarget */,
    3806                                              aMediumAtt,
    3807                                              pThis->mMachineState,
    3808                                              NULL /* phrc */,
    3809                                              true /* fAttachDetach */,
    3810                                              fForce /* fForceUnmount */,
    3811                                              false  /* fHotplug */,
    3812                                              pUVM,
    3813                                              pVMM,
    3814                                              NULL /* paLedDevType */,
    3815                                              NULL /* ppLunL0 */);
    3816     LogFlowFunc(("Returning %Rrc\n", rc));
    3817     return rc;
     3790    int hrc = pThis->i_configMediumAttachment(pcszDevice,
     3791                                              uInstance,
     3792                                              enmBus,
     3793                                              fUseHostIOCache,
     3794                                              false /* fSetupMerge */,
     3795                                              false /* fBuiltinIOCache */,
     3796                                              false /* fInsertDiskIntegrityDrv. */,
     3797                                              0 /* uMergeSource */,
     3798                                              0 /* uMergeTarget */,
     3799                                              aMediumAtt,
     3800                                              pThis->mMachineState,
     3801                                              NULL /* phrc */,
     3802                                              true /* fAttachDetach */,
     3803                                              fForce /* fForceUnmount */,
     3804                                              false  /* fHotplug */,
     3805                                              pUVM,
     3806                                              pVMM,
     3807                                              NULL /* paLedDevType */,
     3808                                              NULL /* ppLunL0 */);
     3809    LogFlowFunc(("Returning %Rrc\n", hrc));
     3810    return hrc;
    38183811}
    38193812
     
    38373830    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    38383831
    3839     HRESULT rc = S_OK;
    38403832    const char *pszDevice = NULL;
    38413833
    38423834    SafeIfaceArray<IStorageController> ctrls;
    3843     rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
    3844     AssertComRC(rc);
    3845     IMedium *pMedium;
    3846     rc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
    3847     AssertComRC(rc);
     3835    HRESULT hrc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
     3836    AssertComRC(hrc);
     3837
     3838    IMedium *pMedium = NULL;
     3839    hrc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
     3840    AssertComRC(hrc);
     3841
    38483842    Bstr mediumLocation;
    38493843    if (pMedium)
    38503844    {
    3851         rc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
    3852         AssertComRC(rc);
     3845        hrc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
     3846        AssertComRC(hrc);
    38533847    }
    38543848
    38553849    Bstr attCtrlName;
    3856     rc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
    3857     AssertComRC(rc);
     3850    hrc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
     3851    AssertComRC(hrc);
    38583852    ComPtr<IStorageController> pStorageController;
    38593853    for (size_t i = 0; i < ctrls.size(); ++i)
    38603854    {
    38613855        Bstr ctrlName;
    3862         rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
    3863         AssertComRC(rc);
     3856        hrc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
     3857        AssertComRC(hrc);
    38643858        if (attCtrlName == ctrlName)
    38653859        {
     
    38723866
    38733867    StorageControllerType_T enmCtrlType;
    3874     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
    3875     AssertComRC(rc);
     3868    hrc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     3869    AssertComRC(hrc);
    38763870    pszDevice = i_storageControllerTypeToStr(enmCtrlType);
    38773871
    38783872    StorageBus_T enmBus;
    3879     rc = pStorageController->COMGETTER(Bus)(&enmBus);
    3880     AssertComRC(rc);
     3873    hrc = pStorageController->COMGETTER(Bus)(&enmBus);
     3874    AssertComRC(hrc);
     3875
    38813876    ULONG uInstance;
    3882     rc = pStorageController->COMGETTER(Instance)(&uInstance);
    3883     AssertComRC(rc);
     3877    hrc = pStorageController->COMGETTER(Instance)(&uInstance);
     3878    AssertComRC(hrc);
     3879
    38843880    BOOL fUseHostIOCache;
    3885     rc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
    3886     AssertComRC(rc);
     3881    hrc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
     3882    AssertComRC(hrc);
    38873883
    38883884    /*
     
    38913887     */
    38923888    bool fResume = false;
    3893     rc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume);
    3894     if (FAILED(rc))
    3895         return rc;
     3889    hrc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume);
     3890    if (FAILED(hrc))
     3891        return hrc;
    38963892
    38973893    /*
     
    39723968    AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE);
    39733969
    3974     int rc = pThis->i_configMediumAttachment(pcszDevice,
    3975                                              uInstance,
    3976                                              enmBus,
    3977                                              fUseHostIOCache,
    3978                                              false /* fSetupMerge */,
    3979                                              false /* fBuiltinIOCache */,
    3980                                              false /* fInsertDiskIntegrityDrv. */,
    3981                                              0 /* uMergeSource */,
    3982                                              0 /* uMergeTarget */,
    3983                                              aMediumAtt,
    3984                                              pThis->mMachineState,
    3985                                              NULL /* phrc */,
    3986                                              true /* fAttachDetach */,
    3987                                              false /* fForceUnmount */,
    3988                                              !fSilent /* fHotplug */,
    3989                                              pUVM,
    3990                                              pVMM,
    3991                                              NULL /* paLedDevType */,
    3992                                              NULL);
    3993     LogFlowFunc(("Returning %Rrc\n", rc));
    3994     return rc;
     3970    int hrc = pThis->i_configMediumAttachment(pcszDevice,
     3971                                              uInstance,
     3972                                              enmBus,
     3973                                              fUseHostIOCache,
     3974                                              false /* fSetupMerge */,
     3975                                              false /* fBuiltinIOCache */,
     3976                                              false /* fInsertDiskIntegrityDrv. */,
     3977                                              0 /* uMergeSource */,
     3978                                              0 /* uMergeTarget */,
     3979                                              aMediumAtt,
     3980                                              pThis->mMachineState,
     3981                                              NULL /* phrc */,
     3982                                              true /* fAttachDetach */,
     3983                                              false /* fForceUnmount */,
     3984                                              !fSilent /* fHotplug */,
     3985                                              pUVM,
     3986                                              pVMM,
     3987                                              NULL /* paLedDevType */,
     3988                                              NULL);
     3989    LogFlowFunc(("Returning %Rrc\n", hrc));
     3990    return hrc;
    39953991}
    39963992
     
    40134009    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    40144010
    4015     HRESULT rc = S_OK;
    40164011    const char *pszDevice = NULL;
    40174012
    40184013    SafeIfaceArray<IStorageController> ctrls;
    4019     rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
    4020     AssertComRC(rc);
    4021     IMedium *pMedium;
    4022     rc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
    4023     AssertComRC(rc);
     4014    HRESULT hrc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
     4015    AssertComRC(hrc);
     4016
     4017    IMedium *pMedium = NULL;
     4018    hrc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
     4019    AssertComRC(hrc);
     4020
    40244021    Bstr mediumLocation;
    40254022    if (pMedium)
    40264023    {
    4027         rc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
    4028         AssertComRC(rc);
     4024        hrc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
     4025        AssertComRC(hrc);
    40294026    }
    40304027
    40314028    Bstr attCtrlName;
    4032     rc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
    4033     AssertComRC(rc);
     4029    hrc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
     4030    AssertComRC(hrc);
    40344031    ComPtr<IStorageController> pStorageController;
    40354032    for (size_t i = 0; i < ctrls.size(); ++i)
    40364033    {
    40374034        Bstr ctrlName;
    4038         rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
    4039         AssertComRC(rc);
     4035        hrc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
     4036        AssertComRC(hrc);
    40404037        if (attCtrlName == ctrlName)
    40414038        {
     
    40484045
    40494046    StorageControllerType_T enmCtrlType;
    4050     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
    4051     AssertComRC(rc);
     4047    hrc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     4048    AssertComRC(hrc);
    40524049    pszDevice = i_storageControllerTypeToStr(enmCtrlType);
    40534050
    4054     StorageBus_T enmBus;
    4055     rc = pStorageController->COMGETTER(Bus)(&enmBus);
    4056     AssertComRC(rc);
    4057     ULONG uInstance;
    4058     rc = pStorageController->COMGETTER(Instance)(&uInstance);
    4059     AssertComRC(rc);
     4051    StorageBus_T enmBus = (StorageBus_T)0;
     4052    hrc = pStorageController->COMGETTER(Bus)(&enmBus);
     4053    AssertComRC(hrc);
     4054
     4055    ULONG uInstance = 0;
     4056    hrc = pStorageController->COMGETTER(Instance)(&uInstance);
     4057    AssertComRC(hrc);
    40604058
    40614059    /*
     
    40644062     */
    40654063    bool fResume = false;
    4066     rc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume);
    4067     if (FAILED(rc))
    4068         return rc;
     4064    hrc = i_suspendBeforeConfigChange(pUVM, pVMM, &alock, &fResume);
     4065    if (FAILED(hrc))
     4066        return hrc;
    40694067
    40704068    /*
     
    42204218    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    42214219
    4222     HRESULT rc = S_OK;
     4220    HRESULT hrc = S_OK;
    42234221
    42244222    /* don't trigger network changes if the VM isn't running */
     
    42284226        /* Get the properties we need from the adapter */
    42294227        BOOL fCableConnected, fTraceEnabled;
    4230         rc = aNetworkAdapter->COMGETTER(CableConnected)(&fCableConnected);
    4231         AssertComRC(rc);
    4232         if (SUCCEEDED(rc))
    4233         {
    4234             rc = aNetworkAdapter->COMGETTER(TraceEnabled)(&fTraceEnabled);
    4235             AssertComRC(rc);
    4236             if (SUCCEEDED(rc))
     4228        hrc = aNetworkAdapter->COMGETTER(CableConnected)(&fCableConnected);
     4229        AssertComRC(hrc);
     4230        if (SUCCEEDED(hrc))
     4231        {
     4232            hrc = aNetworkAdapter->COMGETTER(TraceEnabled)(&fTraceEnabled);
     4233            AssertComRC(hrc);
     4234            if (SUCCEEDED(hrc))
    42374235            {
    42384236                ULONG ulInstance;
    4239                 rc = aNetworkAdapter->COMGETTER(Slot)(&ulInstance);
    4240                 AssertComRC(rc);
    4241                 if (SUCCEEDED(rc))
     4237                hrc = aNetworkAdapter->COMGETTER(Slot)(&ulInstance);
     4238                AssertComRC(hrc);
     4239                if (SUCCEEDED(hrc))
    42424240                {
    42434241                    /*
     
    42464244                     */
    42474245                    NetworkAdapterType_T adapterType;
    4248                     rc = aNetworkAdapter->COMGETTER(AdapterType)(&adapterType);
    4249                     AssertComRC(rc);
     4246                    hrc = aNetworkAdapter->COMGETTER(AdapterType)(&adapterType);
     4247                    AssertComRC(hrc);
    42504248                    const char *pszAdapterName = networkAdapterTypeToName(adapterType);
    42514249
     
    42824280                                }
    42834281
    4284                                 rc = i_doNetworkAdapterChange(ptrVM.rawUVM(), ptrVM.vtable(), pszAdapterName,
    4285                                                               ulInstance, 0, aNetworkAdapter);
     4282                                hrc = i_doNetworkAdapterChange(ptrVM.rawUVM(), ptrVM.vtable(), pszAdapterName,
     4283                                                               ulInstance, 0, aNetworkAdapter);
    42864284
    42874285                                if (fTraceEnabled && fCableConnected && pINetCfg)
     
    42994297
    43004298                    if (RT_FAILURE(vrc))
    4301                         rc = E_FAIL;
     4299                        hrc = E_FAIL;
    43024300
    43034301                    alock.acquire();
     
    43124310
    43134311    /* notify console callbacks on success */
    4314     if (SUCCEEDED(rc))
     4312    if (SUCCEEDED(hrc))
    43154313        ::FireNetworkAdapterChangedEvent(mEventSource, aNetworkAdapter);
    43164314
    4317     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    4318     return rc;
     4315    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     4316    return hrc;
    43194317}
    43204318
     
    43344332    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    43354333
    4336     HRESULT rc = S_OK;
     4334    HRESULT hrc = S_OK;
    43374335
    43384336    /* don't trigger NAT engine changes if the VM isn't running */
     
    43434341        {
    43444342            ComPtr<INetworkAdapter> pNetworkAdapter;
    4345             rc = i_machine()->GetNetworkAdapter(ulInstance, pNetworkAdapter.asOutParam());
    4346             if (   FAILED(rc)
     4343            hrc = i_machine()->GetNetworkAdapter(ulInstance, pNetworkAdapter.asOutParam());
     4344            if (   FAILED(hrc)
    43474345                || pNetworkAdapter.isNull())
    43484346                break;
     
    43534351             */
    43544352            NetworkAdapterType_T adapterType;
    4355             rc = pNetworkAdapter->COMGETTER(AdapterType)(&adapterType);
    4356             if (FAILED(rc))
     4353            hrc = pNetworkAdapter->COMGETTER(AdapterType)(&adapterType);
     4354            if (FAILED(hrc))
    43574355            {
    4358                 AssertComRC(rc);
    4359                 rc = E_FAIL;
     4356                AssertComRC(hrc);
     4357                hrc = E_FAIL;
    43604358                break;
    43614359            }
     
    43714369                    break;
    43724370                ComAssertRC(vrc);
    4373                 rc = E_FAIL;
     4371                hrc = E_FAIL;
    43744372                break;
    43754373            }
    43764374
    43774375            NetworkAttachmentType_T attachmentType;
    4378             rc = pNetworkAdapter->COMGETTER(AttachmentType)(&attachmentType);
    4379             if (   FAILED(rc)
     4376            hrc = pNetworkAdapter->COMGETTER(AttachmentType)(&attachmentType);
     4377            if (   FAILED(hrc)
    43804378                || attachmentType != NetworkAttachmentType_NAT)
    43814379            {
    4382                 rc = E_FAIL;
     4380                hrc = E_FAIL;
    43834381                break;
    43844382            }
     
    44034401                                                     (uint16_t)aGuestPort);
    44044402            if (RT_FAILURE(vrc))
    4405                 rc = E_FAIL;
     4403                hrc = E_FAIL;
    44064404        } while (0); /* break loop */
    44074405        ptrVM.release();
    44084406    }
    44094407
    4410     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    4411     return rc;
     4408    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     4409    return hrc;
    44124410}
    44134411
     
    44884486    {
    44894487        PPDMIBASE pBase;
    4490         int rc = pVMM->pfnPDMR3QueryDriverOnLun(pUVM, pszDevice, ulInstance, 0 /* iLun */, "NAT", &pBase);
    4491         if (RT_FAILURE(rc))
     4488        int vrc = pVMM->pfnPDMR3QueryDriverOnLun(pUVM, pszDevice, ulInstance, 0 /* iLun */, "NAT", &pBase);
     4489        if (RT_FAILURE(vrc))
    44924490            continue;
    44934491
     
    45234521 * @param   ppszVal Where to store the value on success.
    45244522 */
    4525 int Console::i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
    4526                                     char **ppszKey, char **ppszVal)
    4527 {
    4528     int rc = VINF_SUCCESS;
     4523int Console::i_consoleParseKeyValue(const char *psz, const char **ppszEnd, char **ppszKey, char **ppszVal)
     4524{
    45294525    const char *pszKeyStart = psz;
    4530     const char *pszValStart = NULL;
    4531     size_t cchKey = 0;
    4532     size_t cchVal = 0;
    4533 
    45344526    while (   *psz != '='
    45354527           && *psz)
     
    45404532        return VERR_INVALID_PARAMETER;
    45414533
    4542     cchKey = psz - pszKeyStart;
    4543     psz++; /* Skip = character */
    4544     pszValStart = psz;
     4534    size_t const cchKey = psz - pszKeyStart;
     4535
     4536    psz++; /* Skip '=' character */
     4537    const char *pszValStart = psz;
    45454538
    45464539    while (   *psz != ','
     
    45494542           && *psz)
    45504543        psz++;
    4551 
    4552     cchVal = psz - pszValStart;
    4553 
     4544    size_t const cchVal = psz - pszValStart;
     4545
     4546    int vrc = VINF_SUCCESS;
    45544547    if (cchKey && cchVal)
    45554548    {
     
    45584551        {
    45594552            *ppszVal = RTStrDupN(pszValStart, cchVal);
    4560             if (!*ppszVal)
     4553            if (*ppszVal)
     4554                *ppszEnd = psz;
     4555            else
    45614556            {
    45624557                RTStrFree(*ppszKey);
    4563                 rc = VERR_NO_MEMORY;
     4558                vrc = VERR_NO_STR_MEMORY;
    45644559            }
    45654560        }
    45664561        else
    4567             rc = VERR_NO_MEMORY;
     4562            vrc = VERR_NO_STR_MEMORY;
    45684563    }
    45694564    else
    4570         rc = VERR_INVALID_PARAMETER;
    4571 
    4572     if (RT_SUCCESS(rc))
    4573         *ppszEnd = psz;
    4574 
    4575     return rc;
     4565        vrc = VERR_INVALID_PARAMETER;
     4566
     4567    return vrc;
    45764568}
    45774569
     
    46784670        PPDMIBASE pIBase = NULL;
    46794671        PPDMIMEDIA pIMedium = NULL;
    4680         int rc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);
    4681         if (RT_SUCCESS(rc))
     4672        int vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);
     4673        if (RT_SUCCESS(vrc))
    46824674        {
    46834675            if (pIBase)
     
    46874679                {
    46884680#ifdef VBOX_WITH_FULL_VM_ENCRYPTION
    4689                     rc = pIMedium->pfnSetSecKeyIf(pIMedium, fKeepSecIf ? mpIfSecKey : NULL, mpIfSecKeyHlp);
    4690                     Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     4681                    vrc = pIMedium->pfnSetSecKeyIf(pIMedium, fKeepSecIf ? mpIfSecKey : NULL, mpIfSecKeyHlp);
     4682                    Assert(RT_SUCCESS(vrc) || vrc == VERR_NOT_SUPPORTED);
    46914683                    if (fKeepSecIf)
    46924684                        m_cDisksPwProvided++;
    46934685#else
    4694                     rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp);
    4695                     Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     4686                    vrc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp);
     4687                    Assert(RT_SUCCESS(vrc) || vrc == VERR_NOT_SUPPORTED);
    46964688#endif
    46974689                }
     
    47974789            PPDMIBASE pIBase = NULL;
    47984790            PPDMIMEDIA pIMedium = NULL;
    4799             int rc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);
    4800             if (RT_SUCCESS(rc))
     4791            int vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);
     4792            if (RT_SUCCESS(vrc))
    48014793            {
    48024794                if (pIBase)
     
    48054797                    if (pIMedium)
    48064798                    {
    4807                         rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp);
    4808                         Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     4799                        vrc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp);
     4800                        Assert(RT_SUCCESS(vrc) || vrc == VERR_NOT_SUPPORTED);
    48094801                    }
    48104802                }
     
    49754967    char *pszUuid = NULL;
    49764968    char *pszKeyEnc = NULL;
    4977     int rc = VINF_SUCCESS;
     4969    int vrc = VINF_SUCCESS;
    49784970    HRESULT hrc = S_OK;
    49794971
    49804972    while (   *psz
    4981            && RT_SUCCESS(rc))
     4973           && RT_SUCCESS(vrc))
    49824974    {
    49834975        char *pszKey = NULL;
     
    49854977        const char *pszEnd = NULL;
    49864978
    4987         rc = i_consoleParseKeyValue(psz, &pszEnd, &pszKey, &pszVal);
    4988         if (RT_SUCCESS(rc))
     4979        vrc = i_consoleParseKeyValue(psz, &pszEnd, &pszKey, &pszVal);
     4980        if (RT_SUCCESS(vrc))
    49894981        {
    49904982            if (!RTStrCmp(pszKey, "uuid"))
     
    49934985                pszKeyEnc = pszVal;
    49944986            else
    4995                 rc = VERR_INVALID_PARAMETER;
     4987                vrc = VERR_INVALID_PARAMETER;
    49964988
    49974989            RTStrFree(pszKey);
     
    50165008    }
    50175009
    5018     if (   RT_SUCCESS(rc)
     5010    if (   RT_SUCCESS(vrc)
    50195011        && pszUuid
    50205012        && pszKeyEnc)
     
    50275019        {
    50285020            uint8_t *pbKey;
    5029             rc = RTMemSaferAllocZEx((void **)&pbKey, cbKey, RTMEMSAFER_F_REQUIRE_NOT_PAGABLE);
    5030             if (RT_SUCCESS(rc))
     5021            vrc = RTMemSaferAllocZEx((void **)&pbKey, cbKey, RTMEMSAFER_F_REQUIRE_NOT_PAGABLE);
     5022            if (RT_SUCCESS(vrc))
    50315023            {
    5032                 rc = RTBase64Decode(pszKeyEnc, pbKey, cbKey, NULL, NULL);
    5033                 if (RT_SUCCESS(rc))
     5024                vrc = RTBase64Decode(pszKeyEnc, pbKey, cbKey, NULL, NULL);
     5025                if (RT_SUCCESS(vrc))
    50345026                {
    5035                     rc = m_pKeyStore->addSecretKey(Utf8Str(pszUuid), pbKey, cbKey);
    5036                     if (RT_SUCCESS(rc))
     5027                    vrc = m_pKeyStore->addSecretKey(Utf8Str(pszUuid), pbKey, cbKey);
     5028                    if (RT_SUCCESS(vrc))
    50375029                    {
    50385030                        hrc = i_configureEncryptionForDisk(Utf8Str(pszUuid), NULL);
     
    50405032                        {
    50415033                            /* Delete the key from the map. */
    5042                             rc = m_pKeyStore->deleteSecretKey(Utf8Str(pszUuid));
    5043                             AssertRC(rc);
     5034                            vrc = m_pKeyStore->deleteSecretKey(Utf8Str(pszUuid));
     5035                            AssertRC(vrc);
    50445036                        }
    50455037                    }
    50465038                }
    50475039                else
    5048                     hrc = setErrorBoth(E_FAIL, rc, tr("Failed to decode the key (%Rrc)"), rc);
     5040                    hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to decode the key (%Rrc)"), vrc);
    50495041
    50505042                RTMemSaferFree(pbKey, cbKey);
    50515043            }
    50525044            else
    5053                 hrc = setErrorBoth(E_FAIL, rc, tr("Failed to allocate secure memory for the key (%Rrc)"), rc);
     5045                hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to allocate secure memory for the key (%Rrc)"), vrc);
    50545046        }
    50555047        else
    5056             hrc = setError(E_FAIL,
    5057                            tr("The base64 encoding of the passed key is incorrect"));
    5058     }
    5059     else if (RT_SUCCESS(rc))
    5060         hrc = setError(E_FAIL,
    5061                        tr("The encryption configuration is incomplete"));
     5048            hrc = setError(E_FAIL, tr("The base64 encoding of the passed key is incorrect"));
     5049    }
     5050    else if (RT_SUCCESS(vrc))
     5051        hrc = setError(E_FAIL, tr("The encryption configuration is incomplete"));
    50625052
    50635053    if (pszUuid)
     
    50945084{
    50955085    /* Remove keys which are supposed to be removed on a suspend. */
    5096     int rc = m_pKeyStore->deleteAllSecretKeys(true /* fSuspend */, true /* fForce */);
    5097     AssertRC(rc); NOREF(rc);
     5086    int vrc = m_pKeyStore->deleteAllSecretKeys(true /* fSuspend */, true /* fForce */);
     5087    AssertRC(vrc);
    50985088}
    50995089
     
    51325122     * here to make requests from under the lock in order to serialize them.
    51335123     */
    5134     int rc = pVMM->pfnVMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,
    5135                                        (PFNRT)i_changeNetworkAttachment, 7,
    5136                                        this, pUVM, pVMM, pszDevice, uInstance, uLun, aNetworkAdapter);
     5124    int vrc = pVMM->pfnVMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,
     5125                                        (PFNRT)i_changeNetworkAttachment, 7,
     5126                                        this, pUVM, pVMM, pszDevice, uInstance, uLun, aNetworkAdapter);
    51375127
    51385128    if (fResume)
    51395129        i_resumeAfterConfigChange(pUVM, pVMM);
    51405130
    5141     if (RT_SUCCESS(rc))
     5131    if (RT_SUCCESS(vrc))
    51425132        return S_OK;
    51435133
    5144     return setErrorBoth(E_FAIL, rc,  tr("Could not change the network adaptor attachement type (%Rrc)"), rc);
     5134    return setErrorBoth(E_FAIL, vrc,  tr("Could not change the network adaptor attachement type (%Rrc)"), vrc);
    51455135}
    51465136
     
    52055195    AssertRelease(pInst);
    52065196
    5207     int rc = pThis->i_configNetwork(pszDevice, uInstance, uLun, aNetworkAdapter, pCfg, pLunL0, pInst,
    5208                                     true /*fAttachDetach*/, false /*fIgnoreConnectFailure*/, pUVM, pVMM);
    5209 
    5210     LogFlowFunc(("Returning %Rrc\n", rc));
    5211     return rc;
     5197    int vrc = pThis->i_configNetwork(pszDevice, uInstance, uLun, aNetworkAdapter, pCfg, pLunL0, pInst,
     5198                                     true /*fAttachDetach*/, false /*fIgnoreConnectFailure*/, pUVM, pVMM);
     5199
     5200    LogFlowFunc(("Returning %Rrc\n", vrc));
     5201    return vrc;
    52125202}
    52135203
     
    52665256            if (SUCCEEDED(hrc))
    52675257            {
    5268                 int rc = VINF_SUCCESS;
     5258                int vrc = VINF_SUCCESS;
    52695259
    52705260                for (ULONG ulLUN = 0; ulLUN < 16 /** @todo Use a define */; ulLUN++)
     
    52845274                            && pAudioCon->pfnEnable)
    52855275                        {
    5286                             int rcIn = pAudioCon->pfnEnable(pAudioCon, PDMAUDIODIR_IN, RT_BOOL(fEnabledIn));
    5287                             if (RT_FAILURE(rcIn))
    5288                                 LogRel(("Audio: Failed to %s input of LUN#%RU32, rc=%Rrc\n",
    5289                                         fEnabledIn ? "enable" : "disable", ulLUN, rcIn));
    5290 
    5291                             if (RT_SUCCESS(rc))
    5292                                 rc = rcIn;
    5293 
    5294                             int rcOut = pAudioCon->pfnEnable(pAudioCon, PDMAUDIODIR_OUT, RT_BOOL(fEnabledOut));
    5295                             if (RT_FAILURE(rcOut))
    5296                                 LogRel(("Audio: Failed to %s output of LUN#%RU32, rc=%Rrc\n",
    5297                                         fEnabledIn ? "enable" : "disable", ulLUN, rcOut));
    5298 
    5299                             if (RT_SUCCESS(rc))
    5300                                 rc = rcOut;
     5276                            int vrcIn = pAudioCon->pfnEnable(pAudioCon, PDMAUDIODIR_IN, RT_BOOL(fEnabledIn));
     5277                            if (RT_FAILURE(vrcIn))
     5278                                LogRel(("Audio: Failed to %s input of LUN#%RU32, vrcIn=%Rrc\n",
     5279                                        fEnabledIn ? "enable" : "disable", ulLUN, vrcIn));
     5280
     5281                            if (RT_SUCCESS(vrc))
     5282                                vrc = vrcIn;
     5283
     5284                            int vrcOut = pAudioCon->pfnEnable(pAudioCon, PDMAUDIODIR_OUT, RT_BOOL(fEnabledOut));
     5285                            if (RT_FAILURE(vrcOut))
     5286                                LogRel(("Audio: Failed to %s output of LUN#%RU32, vrcOut=%Rrc\n",
     5287                                        fEnabledIn ? "enable" : "disable", ulLUN, vrcOut));
     5288
     5289                            if (RT_SUCCESS(vrc))
     5290                                vrc = vrcOut;
    53015291                        }
    53025292                    }
    53035293                }
    53045294
    5305                 if (RT_SUCCESS(rc))
     5295                if (RT_SUCCESS(vrc))
    53065296                    LogRel(("Audio: Status has changed (input is %s, output is %s)\n",
    53075297                            fEnabledIn  ? "enabled" : "disabled", fEnabledOut ? "enabled" : "disabled"));
     
    53185308        ::FireAudioAdapterChangedEvent(mEventSource, aAudioAdapter);
    53195309
    5320     LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
     5310    LogFlowThisFunc(("Leaving S_OKn"));
    53215311    return S_OK;
    53225312}
     
    53815371
    53825372    HRESULT hrc = S_OK;
    5383     int rc = VINF_SUCCESS;
     5373    int vrc = VINF_SUCCESS;
    53845374    ULONG ulSlot;
    53855375    hrc = pSerialPort->COMGETTER(Slot)(&ulSlot);
     
    53995389            if (pThis->m_aeSerialPortMode[ulSlot] != PortMode_Disconnected)
    54005390            {
    5401                 rc = pVMM->pfnPDMR3DeviceDetach(pUVM, "serial", ulSlot, 0, 0);
     5391                vrc = pVMM->pfnPDMR3DeviceDetach(pUVM, "serial", ulSlot, 0, 0);
    54025392                PCFGMNODE pLunL0 = pVMM->pfnCFGMR3GetChildF(pInst, "LUN#0");
    54035393                pVMM->pfnCFGMR3RemoveNode(pLunL0);
    54045394            }
    54055395
    5406             if (RT_SUCCESS(rc))
     5396            if (RT_SUCCESS(vrc))
    54075397            {
    54085398                BOOL fServer;
     
    54165406                    && eHostMode != PortMode_Disconnected)
    54175407                {
    5418                     rc = pThis->i_configSerialPort(pInst, eHostMode, Utf8Str(bstrPath).c_str(), RT_BOOL(fServer));
    5419                     if (RT_SUCCESS(rc))
     5408                    vrc = pThis->i_configSerialPort(pInst, eHostMode, Utf8Str(bstrPath).c_str(), RT_BOOL(fServer));
     5409                    if (RT_SUCCESS(vrc))
    54205410                    {
    54215411                        /*
     
    54235413                         */
    54245414                        PPDMIBASE pBase;
    5425                         rc = pVMM->pfnPDMR3DeviceAttach(pUVM, "serial", ulSlot, 0, 0, &pBase);
     5415                        vrc = pVMM->pfnPDMR3DeviceAttach(pUVM, "serial", ulSlot, 0, 0, &pBase);
    54265416
    54275417                        pVMM->pfnCFGMR3Dump(pInst);
     
    54325422    }
    54335423
    5434     if (RT_SUCCESS(rc) && FAILED(hrc))
    5435         rc = VERR_INTERNAL_ERROR;
    5436 
    5437     LogFlowFunc(("Returning %Rrc\n", rc));
    5438     return rc;
     5424    if (RT_SUCCESS(vrc) && FAILED(hrc))
     5425        vrc = VERR_INTERNAL_ERROR;
     5426
     5427    LogFlowFunc(("Returning %Rrc\n", vrc));
     5428    return vrc;
    54395429}
    54405430
     
    54685458            PortMode_T eHostMode;
    54695459            hrc = aSerialPort->COMGETTER(HostMode)(&eHostMode);
    5470             if (m_aeSerialPortMode[ulSlot] != eHostMode)
     5460            if (SUCCEEDED(hrc) && m_aeSerialPortMode[ulSlot] != eHostMode)
    54715461            {
    54725462                /*
     
    54745464                 */
    54755465                bool fResume = false;
    5476                 HRESULT hr = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), NULL, &fResume);
    5477                 if (FAILED(hr))
    5478                     return hr;
     5466                hrc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), NULL, &fResume);
     5467                if (FAILED(hrc))
     5468                    return hrc;
    54795469
    54805470                /*
     
    54825472                 * using VM3ReqCallWait.
    54835473                 */
    5484                 int rc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /*idDstCpu*/,
    5485                                                              (PFNRT)i_changeSerialPortAttachment, 4,
    5486                                                              this, ptrVM.rawUVM(), ptrVM.vtable(), aSerialPort);
     5474                int vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /*idDstCpu*/,
     5475                                                              (PFNRT)i_changeSerialPortAttachment, 4,
     5476                                                              this, ptrVM.rawUVM(), ptrVM.vtable(), aSerialPort);
    54875477
    54885478                if (fResume)
    54895479                    i_resumeAfterConfigChange(ptrVM.rawUVM(), ptrVM.vtable());
    5490                 if (RT_SUCCESS(rc))
     5480                if (RT_SUCCESS(vrc))
    54915481                    m_aeSerialPortMode[ulSlot] = eHostMode;
    54925482                else
    5493                     hrc = setErrorBoth(E_FAIL, rc, tr("Failed to change the serial port attachment (%Rrc)"), rc);
     5483                    hrc = setErrorBoth(E_FAIL, vrc, tr("Failed to change the serial port attachment (%Rrc)"), vrc);
    54945484            }
    54955485        }
     
    54995489        ::FireSerialPortChangedEvent(mEventSource, aSerialPort);
    55005490
    5501     LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
     5491    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
    55025492    return hrc;
    55035493}
     
    55155505    ::FireParallelPortChangedEvent(mEventSource, aParallelPort);
    55165506
    5517     LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
     5507    LogFlowThisFunc(("Leaving S_OK\n"));
    55185508    return S_OK;
    55195509}
     
    55315521    ::FireStorageControllerChangedEvent(mEventSource, aMachineId.toString(), aControllerName);
    55325522
    5533     LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
     5523    LogFlowThisFunc(("Leaving S_OK\n"));
    55345524    return S_OK;
    55355525}
     
    55455535    AssertComRCReturnRC(autoCaller.rc());
    55465536
    5547     HRESULT rc = S_OK;
     5537    HRESULT hrc = S_OK;
    55485538
    55495539    /* don't trigger medium changes if the VM isn't running */
     
    55515541    if (ptrVM.isOk())
    55525542    {
    5553         rc = i_doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM(), ptrVM.vtable());
     5543        hrc = i_doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM(), ptrVM.vtable());
    55545544        ptrVM.release();
    55555545    }
    55565546
    55575547    /* notify console callbacks on success */
    5558     if (SUCCEEDED(rc))
     5548    if (SUCCEEDED(hrc))
    55595549        ::FireMediumChangedEvent(mEventSource, aMediumAttachment);
    55605550
    5561     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    5562     return rc;
     5551    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5552    return hrc;
    55635553}
    55645554
     
    55755565    AssertComRCReturnRC(autoCaller.rc());
    55765566
    5577     HRESULT rc = S_OK;
     5567    HRESULT hrc = S_OK;
    55785568
    55795569    /* don't trigger CPU changes if the VM isn't running */
     
    55825572    {
    55835573        if (aRemove)
    5584             rc = i_doCPURemove(aCPU, ptrVM.rawUVM(), ptrVM.vtable());
     5574            hrc = i_doCPURemove(aCPU, ptrVM.rawUVM(), ptrVM.vtable());
    55855575        else
    5586             rc = i_doCPUAdd(aCPU, ptrVM.rawUVM(), ptrVM.vtable());
     5576            hrc = i_doCPUAdd(aCPU, ptrVM.rawUVM(), ptrVM.vtable());
    55875577        ptrVM.release();
    55885578    }
    55895579
    55905580    /* notify console callbacks on success */
    5591     if (SUCCEEDED(rc))
     5581    if (SUCCEEDED(hrc))
    55925582        ::FireCPUChangedEvent(mEventSource, aCPU, aRemove);
    55935583
    5594     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    5595     return rc;
     5584    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5585    return hrc;
    55965586}
    55975587
     
    56105600    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    56115601
    5612     HRESULT rc = S_OK;
     5602    HRESULT hrc = S_OK;
    56135603
    56145604    /* don't trigger the CPU priority change if the VM isn't running */
     
    56225612        {
    56235613            /* No need to call in the EMT thread. */
    5624             rc = ptrVM.vtable()->pfnVMR3SetCpuExecutionCap(ptrVM.rawUVM(), aExecutionCap);
     5614            hrc = ptrVM.vtable()->pfnVMR3SetCpuExecutionCap(ptrVM.rawUVM(), aExecutionCap);
    56255615        }
    56265616        else
    5627             rc = i_setInvalidMachineStateError();
     5617            hrc = i_setInvalidMachineStateError();
    56285618        ptrVM.release();
    56295619    }
    56305620
    56315621    /* notify console callbacks on success */
    5632     if (SUCCEEDED(rc))
     5622    if (SUCCEEDED(hrc))
    56335623    {
    56345624        alock.release();
     
    56365626    }
    56375627
    5638     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    5639     return rc;
     5628    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5629    return hrc;
    56405630}
    56415631
     
    56545644    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    56555645
    5656     HRESULT rc = S_OK;
     5646    HRESULT hrc = S_OK;
    56575647
    56585648    /* don't trigger the clipboard mode change if the VM isn't running */
     
    56665656            int vrc = i_changeClipboardMode(aClipboardMode);
    56675657            if (RT_FAILURE(vrc))
    5668                 rc = E_FAIL; /** @todo r=andy Set error info here? */
     5658                hrc = E_FAIL; /** @todo r=andy Set error info here! */
    56695659        }
    56705660        else
    5671             rc = i_setInvalidMachineStateError();
     5661            hrc = i_setInvalidMachineStateError();
    56725662        ptrVM.release();
    56735663    }
    56745664
    56755665    /* notify console callbacks on success */
    5676     if (SUCCEEDED(rc))
     5666    if (SUCCEEDED(hrc))
    56775667    {
    56785668        alock.release();
     
    56805670    }
    56815671
    5682     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    5683     return rc;
     5672    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5673    return hrc;
    56845674}
    56855675
     
    56985688    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    56995689
    5700     HRESULT rc = S_OK;
     5690    HRESULT hrc = S_OK;
    57015691
    57025692    /* don't trigger the change if the VM isn't running */
     
    57105700            int vrc = i_changeClipboardFileTransferMode(aEnabled);
    57115701            if (RT_FAILURE(vrc))
    5712                 rc = E_FAIL; /** @todo r=andy Set error info here? */
     5702                hrc = E_FAIL; /** @todo r=andy Set error info here! */
    57135703        }
    57145704        else
    5715             rc = i_setInvalidMachineStateError();
     5705            hrc = i_setInvalidMachineStateError();
    57165706        ptrVM.release();
    57175707    }
    57185708
    57195709    /* notify console callbacks on success */
    5720     if (SUCCEEDED(rc))
     5710    if (SUCCEEDED(hrc))
    57215711    {
    57225712        alock.release();
     
    57245714    }
    57255715
    5726     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    5727     return rc;
     5716    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5717    return hrc;
    57285718}
    57295719
     
    57425732    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    57435733
    5744     HRESULT rc = S_OK;
     5734    HRESULT hrc = S_OK;
    57455735
    57465736    /* don't trigger the drag and drop mode change if the VM isn't running */
     
    57535743            i_changeDnDMode(aDnDMode);
    57545744        else
    5755             rc = i_setInvalidMachineStateError();
     5745            hrc = i_setInvalidMachineStateError();
    57565746        ptrVM.release();
    57575747    }
    57585748
    57595749    /* notify console callbacks on success */
    5760     if (SUCCEEDED(rc))
     5750    if (SUCCEEDED(hrc))
    57615751    {
    57625752        alock.release();
     
    57645754    }
    57655755
    5766     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    5767     return rc;
     5756    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     5757    return hrc;
    57685758}
    57695759
     
    58215811    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    58225812
    5823     HRESULT rc = S_OK;
     5813    HRESULT hrc = S_OK;
    58245814
    58255815    /* don't trigger VRDE server changes if the VM isn't running */
     
    58465836                    BOOL vrdpEnabled = FALSE;
    58475837
    5848                     rc = mVRDEServer->COMGETTER(Enabled)(&vrdpEnabled);
    5849                     ComAssertComRCRetRC(rc);
     5838                    hrc = mVRDEServer->COMGETTER(Enabled)(&vrdpEnabled);
     5839                    ComAssertComRCRetRC(hrc);
    58505840
    58515841                    if (aRestart)
     
    58655855                            {
    58665856                                Utf8Str errMsg = VRDPServerErrorToMsg(vrc);
    5867                                 rc = setErrorBoth(E_FAIL, vrc, errMsg.c_str());
     5857                                hrc = setErrorBoth(E_FAIL, vrc, "%s", errMsg.c_str());
    58685858                            }
    58695859                            else
     
    58875877                }
    58885878                else
    5889                     rc = i_setInvalidMachineStateError();
     5879                    hrc = i_setInvalidMachineStateError();
    58905880
    58915881                mfVRDEChangeInProcess = false;
    5892             } while (mfVRDEChangePending && SUCCEEDED(rc));
     5882            } while (mfVRDEChangePending && SUCCEEDED(hrc));
    58935883        }
    58945884
     
    58975887
    58985888    /* notify console callbacks on success */
    5899     if (SUCCEEDED(rc))
     5889    if (SUCCEEDED(hrc))
    59005890    {
    59015891        alock.release();
     
    59035893    }
    59045894
    5905     return rc;
     5895    return hrc;
    59065896}
    59075897
     
    59455935    }
    59465936
    5947     HRESULT rc = RT_SUCCESS(vrc) ? S_OK
    5948                : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Sending monitor hot-plug event failed (%Rrc)"), vrc);
    5949 
    5950     LogFlowThisFunc(("rc=%Rhrc\n", rc));
     5937    HRESULT hrc = RT_SUCCESS(vrc) ? S_OK
     5938                : setErrorBoth(VBOX_E_PDM_ERROR, vrc, tr("Sending monitor hot-plug event failed (%Rrc)"), vrc);
     5939
     5940    LogFlowThisFunc(("hrc=%Rhrc\n", hrc));
    59515941    LogFlowThisFuncLeave();
    5952     return rc;
     5942    return hrc;
    59535943}
    59545944
     
    60586048    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    60596049
    6060     HRESULT rc = S_OK;
     6050    HRESULT hrc = S_OK;
    60616051#ifdef VBOX_WITH_RECORDING
    60626052    /* Don't trigger recording changes if the VM isn't running. */
     
    60736063        }
    60746064        else /* Error set via ErrorInfo within i_recordingEnable() already. */
    6075             rc = VBOX_E_IPRT_ERROR;
     6065            hrc = VBOX_E_IPRT_ERROR;
    60766066        ptrVM.release();
    60776067    }
     
    60796069    RT_NOREF(fEnabled);
    60806070#endif /* VBOX_WITH_RECORDING */
    6081     return rc;
     6071    return hrc;
    60826072}
    60836073
     
    61116101    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    61126102
    6113     HRESULT rc = i_fetchSharedFolders(aGlobal);
     6103    HRESULT hrc = i_fetchSharedFolders(aGlobal);
    61146104
    61156105    /* notify console callbacks on success */
    6116     if (SUCCEEDED(rc))
     6106    if (SUCCEEDED(hrc))
    61176107    {
    61186108        alock.release();
     
    61206110    }
    61216111
    6122     return rc;
     6112    return hrc;
    61236113}
    61246114
     
    61456135        ::FireGuestDebugControlChangedEvent(mEventSource, aGuestDebugControl);
    61466136
    6147     LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
     6137    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
    61486138    return hrc;
    61496139}
     
    62036193
    62046194    alock.release();
    6205     HRESULT rc = i_attachUSBDevice(aDevice, aMaskedIfs, aCaptureFilename);
    6206     if (FAILED(rc))
     6195    HRESULT hrc = i_attachUSBDevice(aDevice, aMaskedIfs, aCaptureFilename);
     6196    if (FAILED(hrc))
    62076197    {
    62086198        /* take the current error info */
     
    62186208    }
    62196209
    6220     return rc;
     6210    return hrc;
    62216211
    62226212#else   /* !VBOX_WITH_USB */
     
    62926282
    62936283    alock.release();
    6294     HRESULT rc = i_detachUSBDevice(pUSBDevice);
    6295     if (FAILED(rc))
     6284    HRESULT hrc = i_detachUSBDevice(pUSBDevice);
     6285    if (FAILED(hrc))
    62966286    {
    62976287        /* Re-add the device to the collection */
     
    63116301    }
    63126302
    6313     return rc;
     6303    return hrc;
    63146304
    63156305#else   /* !VBOX_WITH_USB */
     
    63336323    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    63346324
    6335     HRESULT rc = S_OK;
     6325    HRESULT hrc = S_OK;
    63366326
    63376327    /* don't trigger bandwidth group changes if the VM isn't running */
     
    63466336            /* No need to call in the EMT thread. */
    63476337            Bstr bstrName;
    6348             rc = aBandwidthGroup->COMGETTER(Name)(bstrName.asOutParam());
    6349             if (SUCCEEDED(rc))
     6338            hrc = aBandwidthGroup->COMGETTER(Name)(bstrName.asOutParam());
     6339            if (SUCCEEDED(hrc))
    63506340            {
    63516341                Utf8Str const strName(bstrName);
    63526342                LONG64 cMax;
    6353                 rc = aBandwidthGroup->COMGETTER(MaxBytesPerSec)(&cMax);
    6354                 if (SUCCEEDED(rc))
     6343                hrc = aBandwidthGroup->COMGETTER(MaxBytesPerSec)(&cMax);
     6344                if (SUCCEEDED(hrc))
    63556345                {
    63566346                    BandwidthGroupType_T enmType;
    6357                     rc = aBandwidthGroup->COMGETTER(Type)(&enmType);
    6358                     if (SUCCEEDED(rc))
     6347                    hrc = aBandwidthGroup->COMGETTER(Type)(&enmType);
     6348                    if (SUCCEEDED(hrc))
    63596349                    {
    63606350                        int vrc = VINF_SUCCESS;
     
    63666356                            vrc = ptrVM.vtable()->pfnPDMR3NsBwGroupSetLimit(ptrVM.rawUVM(), strName.c_str(), cMax);
    63676357                        else
    6368                             rc = E_NOTIMPL;
     6358                            hrc = E_NOTIMPL;
    63696359#endif
    63706360                        AssertRC(vrc);
     
    63746364        }
    63756365        else
    6376             rc = i_setInvalidMachineStateError();
     6366            hrc = i_setInvalidMachineStateError();
    63776367        ptrVM.release();
    63786368    }
    63796369
    63806370    /* notify console callbacks on success */
    6381     if (SUCCEEDED(rc))
     6371    if (SUCCEEDED(hrc))
    63826372    {
    63836373        alock.release();
     
    63856375    }
    63866376
    6387     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    6388     return rc;
     6377    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     6378    return hrc;
    63896379}
    63906380
     
    64016391    AssertComRCReturnRC(autoCaller.rc());
    64026392
    6403     HRESULT rc = S_OK;
     6393    HRESULT hrc = S_OK;
    64046394
    64056395    /* don't trigger medium changes if the VM isn't running */
     
    64086398    {
    64096399        if (aRemove)
    6410             rc = i_doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), ptrVM.vtable(), RT_BOOL(aSilent));
     6400            hrc = i_doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), ptrVM.vtable(), RT_BOOL(aSilent));
    64116401        else
    6412             rc = i_doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), ptrVM.vtable(), RT_BOOL(aSilent));
     6402            hrc = i_doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), ptrVM.vtable(), RT_BOOL(aSilent));
    64136403        ptrVM.release();
    64146404    }
    64156405
    64166406    /* notify console callbacks on success */
    6417     if (SUCCEEDED(rc))
     6407    if (SUCCEEDED(hrc))
    64186408        ::FireStorageDeviceChangedEvent(mEventSource, aMediumAttachment, aRemove, aSilent);
    64196409
    6420     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
    6421     return rc;
     6410    LogFlowThisFunc(("Leaving hrc=%#x\n", hrc));
     6411    return hrc;
    64226412}
    64236413
     
    64806470     * ptrVM, so there is no need to hold a lock of this */
    64816471
    6482     HRESULT rc = E_UNEXPECTED;
     6472    HRESULT hrc = E_UNEXPECTED;
    64836473    try
    64846474    {
     
    65156505                *aFlags = &szBuffer[strlen(szBuffer) + 1];
    65166506
    6517             rc = S_OK;
     6507            hrc = S_OK;
    65186508        }
    65196509        else if (vrc == VERR_NOT_FOUND)
    65206510        {
    65216511            *aValue = "";
    6522             rc = S_OK;
     6512            hrc = S_OK;
    65236513        }
    65246514        else
    6525             rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc);
     6515            hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc);
    65266516    }
    65276517    catch(std::bad_alloc & /*e*/)
    65286518    {
    6529         rc = E_OUTOFMEMORY;
    6530     }
    6531 
    6532     return rc;
     6519        hrc = E_OUTOFMEMORY;
     6520    }
     6521
     6522    return hrc;
    65336523#endif /* VBOX_WITH_GUEST_PROPS */
    65346524}
     
    66506640static DECLCALLBACK(int) onlineMergeMediumProgress(void *pvUser, unsigned uPercentage)
    66516641{
    6652     HRESULT rc = S_OK;
     6642    HRESULT hrc = S_OK;
    66536643    IProgress *pProgress = static_cast<IProgress *>(pvUser);
    66546644    if (pProgress)
     
    66566646        ComPtr<IInternalProgressControl> pProgressControl(pProgress);
    66576647        AssertReturn(!!pProgressControl, VERR_INVALID_PARAMETER);
    6658         rc = pProgressControl->SetCurrentOperationProgress(uPercentage);
    6659     }
    6660     return SUCCEEDED(rc) ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
     6648        hrc = pProgressControl->SetCurrentOperationProgress(uPercentage);
     6649    }
     6650    return SUCCEEDED(hrc) ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
    66616651}
    66626652
     
    66716661    AssertComRCReturnRC(autoCaller.rc());
    66726662
    6673     HRESULT rc = S_OK;
     6663    HRESULT hrc = S_OK;
    66746664    int vrc = VINF_SUCCESS;
    66756665
     
    66956685    /** @todo AssertComRC -> AssertComRCReturn! Could potentially end up
    66966686     *        using uninitialized variables here. */
    6697     BOOL fBuiltinIOCache;
    6698     rc = mMachine->COMGETTER(IOCacheEnabled)(&fBuiltinIOCache);
    6699     AssertComRC(rc);
     6687    BOOL fBuiltinIOCache = FALSE;
     6688    hrc = mMachine->COMGETTER(IOCacheEnabled)(&fBuiltinIOCache);
     6689    AssertComRC(hrc);
    67006690    SafeIfaceArray<IStorageController> ctrls;
    6701     rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
    6702     AssertComRC(rc);
    6703     LONG lDev;
    6704     rc = aMediumAttachment->COMGETTER(Device)(&lDev);
    6705     AssertComRC(rc);
    6706     LONG lPort;
    6707     rc = aMediumAttachment->COMGETTER(Port)(&lPort);
    6708     AssertComRC(rc);
    6709     IMedium *pMedium;
    6710     rc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
    6711     AssertComRC(rc);
     6691    hrc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));
     6692    AssertComRC(hrc);
     6693    LONG lDev = -1;
     6694    hrc = aMediumAttachment->COMGETTER(Device)(&lDev);
     6695    AssertComRC(hrc);
     6696    LONG lPort = -1;
     6697    hrc = aMediumAttachment->COMGETTER(Port)(&lPort);
     6698    AssertComRC(hrc);
     6699    IMedium *pMedium = NULL;
     6700    hrc = aMediumAttachment->COMGETTER(Medium)(&pMedium);
     6701    AssertComRC(hrc);
    67126702    Bstr mediumLocation;
    67136703    if (pMedium)
    67146704    {
    6715         rc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
    6716         AssertComRC(rc);
     6705        hrc = pMedium->COMGETTER(Location)(mediumLocation.asOutParam());
     6706        AssertComRC(hrc);
    67176707    }
    67186708
    67196709    Bstr attCtrlName;
    6720     rc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
    6721     AssertComRC(rc);
     6710    hrc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam());
     6711    AssertComRC(hrc);
    67226712    ComPtr<IStorageController> pStorageController;
    67236713    for (size_t i = 0; i < ctrls.size(); ++i)
    67246714    {
    67256715        Bstr ctrlName;
    6726         rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
    6727         AssertComRC(rc);
     6716        hrc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());
     6717        AssertComRC(hrc);
    67286718        if (attCtrlName == ctrlName)
    67296719        {
     
    67386728
    67396729    StorageControllerType_T enmCtrlType;
    6740     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
    6741     AssertComRC(rc);
     6730    hrc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     6731    AssertComRC(hrc);
    67426732    const char *pcszDevice = i_storageControllerTypeToStr(enmCtrlType);
    67436733
    67446734    StorageBus_T enmBus;
    6745     rc = pStorageController->COMGETTER(Bus)(&enmBus);
    6746     AssertComRC(rc);
    6747     ULONG uInstance;
    6748     rc = pStorageController->COMGETTER(Instance)(&uInstance);
    6749     AssertComRC(rc);
    6750     BOOL fUseHostIOCache;
    6751     rc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
    6752     AssertComRC(rc);
     6735    hrc = pStorageController->COMGETTER(Bus)(&enmBus);
     6736    AssertComRC(hrc);
     6737
     6738    ULONG uInstance = 0;
     6739    hrc = pStorageController->COMGETTER(Instance)(&uInstance);
     6740    AssertComRC(hrc);
     6741
     6742    BOOL fUseHostIOCache = TRUE;
     6743    hrc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
     6744    AssertComRC(hrc);
    67536745
    67546746    unsigned uLUN;
    6755     rc = Console::i_storageBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
    6756     AssertComRCReturnRC(rc);
     6747    hrc = Console::i_storageBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
     6748    AssertComRCReturnRC(hrc);
    67576749
    67586750    Assert(mMachineState == MachineState_DeletingSnapshotOnline);
     
    67606752    /* Pause the VM, as it might have pending IO on this drive */
    67616753    bool fResume = false;
    6762     rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), &alock, &fResume);
    6763     if (FAILED(rc))
    6764         return rc;
     6754    hrc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), &alock, &fResume);
     6755    if (FAILED(hrc))
     6756        return hrc;
    67656757
    67666758    bool fInsertDiskIntegrityDrv = false;
    67676759    Bstr strDiskIntegrityFlag;
    6768     rc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableDiskIntegrityDriver").raw(),
    6769                                 strDiskIntegrityFlag.asOutParam());
    6770     if (   rc   == S_OK
     6760    hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableDiskIntegrityDriver").raw(), strDiskIntegrityFlag.asOutParam());
     6761    if (   hrc == S_OK
    67716762        && strDiskIntegrityFlag == "1")
    67726763        fInsertDiskIntegrityDrv = true;
     
    67776768                                              this, ptrVM.rawUVM(), ptrVM.vtable(), pcszDevice, uInstance, enmBus,
    67786769                                              fUseHostIOCache, fBuiltinIOCache, fInsertDiskIntegrityDrv, true /* fSetupMerge */,
    6779                                               aSourceIdx, aTargetIdx, aMediumAttachment, mMachineState, &rc);
     6770                                              aSourceIdx, aTargetIdx, aMediumAttachment, mMachineState, &hrc);
    67806771    /* error handling is after resuming the VM */
    67816772
     
    67856776    if (RT_FAILURE(vrc))
    67866777        return setErrorBoth(E_FAIL, vrc, "%Rrc", vrc);
    6787     if (FAILED(rc))
    6788         return rc;
     6778    if (FAILED(hrc))
     6779        return hrc;
    67896780
    67906781    PPDMIBASE pIBase = NULL;
     
    68106801    alock.acquire();
    68116802    /* Pause the VM, as it might have pending IO on this drive */
    6812     rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), &alock, &fResume);
    6813     if (FAILED(rc))
    6814         return rc;
     6803    hrc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), ptrVM.vtable(), &alock, &fResume);
     6804    if (FAILED(hrc))
     6805        return hrc;
    68156806    alock.release();
    68166807
    68176808    /* Update medium chain and state now, so that the VM can continue. */
    6818     rc = mControl->FinishOnlineMergeMedium();
     6809    hrc = mControl->FinishOnlineMergeMedium();
    68196810
    68206811    vrc = ptrVM.vtable()->pfnVMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
     
    68226813                                              this, ptrVM.rawUVM(), ptrVM.vtable(), pcszDevice, uInstance, enmBus,
    68236814                                              fUseHostIOCache, fBuiltinIOCache, fInsertDiskIntegrityDrv, false /* fSetupMerge */,
    6824                                               0 /* uMergeSource */, 0 /* uMergeTarget */, aMediumAttachment, mMachineState, &rc);
     6815                                              0 /* uMergeSource */, 0 /* uMergeTarget */, aMediumAttachment, mMachineState, &hrc);
    68256816    /* error handling is after resuming the VM */
    68266817
     
    68306821    if (RT_FAILURE(vrc))
    68316822        return setErrorBoth(E_FAIL, vrc, "%Rrc", vrc);
    6832     if (FAILED(rc))
    6833         return rc;
    6834 
    6835     return rc;
     6823    if (FAILED(hrc))
     6824        return hrc;
     6825
     6826    return hrc;
    68366827}
    68376828
Note: See TracChangeset for help on using the changeset viewer.

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