VirtualBox

Changeset 95141 in vbox for trunk


Ignore:
Timestamp:
May 31, 2022 9:31:45 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151632
Message:

Frontends + Main: Adjust to the new rules wrt. to rc -> hrc,vrc usage. This also fixes quite a few bugs wrt shadow variables, wrong return values and output error translations / exit codes. Also see @todos added [more stuff, build fix] ​bugref:10223

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp

    r93115 r95141  
    194194        return VINF_SUCCESS; /* Nothing to do. */
    195195
    196     HRESULT rc;
     196    HRESULT hrc;
    197197    ComPtr <IMachine> machine;
    198198    CHECK_ERROR_RET(g_pVirtualBox, FindMachine(strUuid.raw(),
     
    248248                        /* First pause so we don't trigger a live save which needs more time/resources. */
    249249                        bool fPaused = false;
    250                         rc = console->Pause();
    251                         if (FAILED(rc))
     250                        hrc = console->Pause();
     251                        if (FAILED(hrc))
    252252                        {
    253253                            bool fError = true;
    254                             if (rc == VBOX_E_INVALID_VM_STATE)
     254                            if (hrc == VBOX_E_INVALID_VM_STATE)
    255255                            {
    256256                                /* Check if we are already paused. */
    257257                                CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState));
    258258                                /* The error code was lost by the previous instruction. */
    259                                 rc = VBOX_E_INVALID_VM_STATE;
     259                                hrc = VBOX_E_INVALID_VM_STATE;
    260260                                if (machineState != MachineState_Paused)
    261261                                {
     
    274274
    275275                        CHECK_ERROR(sessionMachine, SaveState(progress.asOutParam()));
    276                         if (SUCCEEDED(rc))
     276                        if (SUCCEEDED(hrc))
    277277                        {
    278278                            progress->WaitForCompletion(cMsTimeout);
     
    281281                        }
    282282
    283                         if (SUCCEEDED(rc))
     283                        if (SUCCEEDED(hrc))
    284284                        {
    285285                            serviceLogVerbose(("apimon: State of machine \"%ls\" saved, powering off ...\n", strUuid.raw()));
     
    314314
    315315
    316     return SUCCEEDED(rc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR;
     316    return SUCCEEDED(hrc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR;
    317317}
    318318
     
    458458static DECLCALLBACK(int) VBoxModAPIMonitorInit(void)
    459459{
    460     HRESULT rc = S_OK;
     460    HRESULT hrc = S_OK;
    461461
    462462    do
     
    518518    } while (0);
    519519
    520     if (SUCCEEDED(rc))
     520    if (SUCCEEDED(hrc))
    521521    {
    522522        g_uAPIMonIslnLastBeatMS = 0;
    523523    }
    524524
    525     return SUCCEEDED(rc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR; /** @todo Find a better rc! */
     525    return SUCCEEDED(hrc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR; /** @todo Find a better rc! */
    526526}
    527527
     
    536536
    537537    int vrc = VINF_SUCCESS;
    538     HRESULT rc;
     538    HRESULT hrc;
    539539
    540540#ifdef DEBUG
     
    548548        CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/Heartbeat").raw(),
    549549                                                      strHeartbeat.asOutParam()));
    550         if (   SUCCEEDED(rc)
     550        if (   SUCCEEDED(hrc)
    551551            && !strHeartbeat.isEmpty()
    552552            && g_strAPIMonIslnLastBeat.compare(strHeartbeat, Bstr::CaseSensitive))
     
    571571    } while (0);
    572572
    573     if (FAILED(rc))
     573    if (FAILED(hrc))
    574574        vrc = VERR_COM_IPRT_ERROR;
    575575
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModBallooning.cpp

    r93115 r95141  
    189189
    190190    Bstr strValue;
    191     HRESULT hr = g_pVirtualBox->GetExtraData(Bstr("VBoxInternal/Guest/BalloonSizeMax").raw(),
    192                                              strValue.asOutParam());
    193     if (   SUCCEEDED(hr)
     191    HRESULT hrc = g_pVirtualBox->GetExtraData(Bstr("VBoxInternal/Guest/BalloonSizeMax").raw(),
     192                                              strValue.asOutParam());
     193    if (   SUCCEEDED(hrc)
    194194        && strValue.isNotEmpty())
    195195    {
     
    254254
    255255    Bstr strValue;
    256     HRESULT hr = rptrMachine->GetExtraData(Bstr("VBoxInternal2/Watchdog/BalloonCtrl/BalloonSizeMax").raw(),
    257                                            strValue.asOutParam());
    258     if (   SUCCEEDED(hr)
     256    HRESULT hrc = rptrMachine->GetExtraData(Bstr("VBoxInternal2/Watchdog/BalloonCtrl/BalloonSizeMax").raw(),
     257                                            strValue.asOutParam());
     258    if (   SUCCEEDED(hrc)
    259259        && strValue.isNotEmpty())
    260260    {
     
    265265    else
    266266    {
    267         hr = rptrMachine->GetExtraData(Bstr("VBoxInternal/Guest/BalloonSizeMax").raw(),
    268                                        strValue.asOutParam());
    269         if (   SUCCEEDED(hr)
     267        hrc = rptrMachine->GetExtraData(Bstr("VBoxInternal/Guest/BalloonSizeMax").raw(),
     268                                        strValue.asOutParam());
     269        if (   SUCCEEDED(hrc)
    270270            && strValue.isNotEmpty())
    271271        {
     
    276276    }
    277277
    278     if (   FAILED(hr)
     278    if (   FAILED(hrc)
    279279        || strValue.isEmpty())
    280280    {
     
    303303
    304304    Bstr strValue;
    305     HRESULT hr = g_pVirtualBox->GetExtraData(Bstr("VBoxInternal/Guest/BalloonEnabled").raw(),
    306                                              strValue.asOutParam());
    307     if (   SUCCEEDED(hr)
     305    HRESULT hrc = g_pVirtualBox->GetExtraData(Bstr("VBoxInternal/Guest/BalloonEnabled").raw(),
     306                                              strValue.asOutParam());
     307    if (   SUCCEEDED(hrc)
    308308        && strValue.isNotEmpty())
    309309    {
     
    313313    else
    314314    {
    315         hr = rptrMachine->GetExtraData(Bstr("VBoxInternal2/Watchdog/BalloonCtrl/BalloonEnabled").raw(),
    316                                        strValue.asOutParam());
    317         if (SUCCEEDED(hr))
     315        hrc = rptrMachine->GetExtraData(Bstr("VBoxInternal2/Watchdog/BalloonCtrl/BalloonEnabled").raw(),
     316                                        strValue.asOutParam());
     317        if (SUCCEEDED(hrc))
    318318        {
    319319            if (g_fVerbose)
     
    379379        strMetricNames.cloneTo(&metricNames[0]);
    380380
    381         HRESULT rc = m.queryInterfaceTo(&metricObjects[0]);
     381        HRESULT hrc = m.queryInterfaceTo(&metricObjects[0]);
    382382
    383383#ifdef VBOX_WATCHDOG_GLOBAL_PERFCOL
     
    397397                                             ComSafeArrayAsOutParam(metricAffected)));
    398398#endif
    399         if (FAILED(rc))
     399        if (FAILED(hrc))
    400400            vrc = VERR_COM_IPRT_ERROR; /** @todo Find better rc! */
    401401
     
    515515
    516516    /* Open a session for the VM. */
    517     HRESULT rc;
     517    HRESULT hrc;
    518518    CHECK_ERROR_RET(pMachine->machine, LockMachine(g_pSession, LockType_Shared), VERR_ACCESS_DENIED);
    519519
     
    525525
    526526        ComPtr <IGuest> guest;
    527         rc = console->COMGETTER(Guest)(guest.asOutParam());
    528         if (SUCCEEDED(rc))
     527        hrc = console->COMGETTER(Guest)(guest.asOutParam());
     528        if (SUCCEEDED(hrc))
    529529            CHECK_ERROR_BREAK(guest, COMSETTER(MemoryBalloonSize)((LONG)cMbBalloonCur));
    530530        else
    531531            serviceLog("Error: Unable to set new balloon size %RU32 for machine '%ls', rc=%Rhrc\n",
    532                        cMbBalloonCur, pMachine->strName.raw(), rc);
    533         if (FAILED(rc))
     532                       cMbBalloonCur, pMachine->strName.raw(), hrc);
     533        if (FAILED(hrc))
    534534            vrc = VERR_COM_IPRT_ERROR;
    535535
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp

    r93115 r95141  
    189189                    Bstr uuid;
    190190                    BOOL fRegistered;
    191                     HRESULT hr = pEvent->COMGETTER(Registered)(&fRegistered);
    192                     if (SUCCEEDED(hr))
    193                         hr = pEvent->COMGETTER(MachineId)(uuid.asOutParam());
    194 
    195                     if (SUCCEEDED(hr))
     191                    HRESULT hrc = pEvent->COMGETTER(Registered)(&fRegistered);
     192                    if (SUCCEEDED(hrc))
     193                        hrc = pEvent->COMGETTER(MachineId)(uuid.asOutParam());
     194
     195                    if (SUCCEEDED(hrc))
    196196                    {
    197197                        int rc = RTCritSectEnter(&g_csMachines);
     
    218218                    Bstr uuid;
    219219
    220                     HRESULT hr = pEvent->COMGETTER(State)(&machineState);
    221                     if (SUCCEEDED(hr))
    222                         hr = pEvent->COMGETTER(MachineId)(uuid.asOutParam());
    223 
    224                     if (SUCCEEDED(hr))
     220                    HRESULT hrc = pEvent->COMGETTER(State)(&machineState);
     221                    if (SUCCEEDED(hrc))
     222                        hrc = pEvent->COMGETTER(MachineId)(uuid.asOutParam());
     223
     224                    if (SUCCEEDED(hrc))
    225225                    {
    226226                        int rc = RTCritSectEnter(&g_csMachines);
     
    349349static int machineAdd(const Bstr &strUuid)
    350350{
    351     HRESULT rc;
     351    HRESULT hrc;
    352352
    353353    /** @todo Add exception handling! */
     
    423423                if (RT_FAILURE(rc2))
    424424                    serviceLog("OnMachineRegistered: Module '%s' reported an error: %Rrc\n",
    425                                g_aModules[j].pDesc->pszName, rc);
     425                               g_aModules[j].pDesc->pszName, hrc);
    426426                /* Keep going. */
    427427            }
     
    431431    /** @todo Add std exception handling! */
    432432
    433     return SUCCEEDED(rc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR; /** @todo Find a better error! */
     433    return SUCCEEDED(hrc) ? VINF_SUCCESS : VERR_COM_IPRT_ERROR; /** @todo Find a better error! */
    434434}
    435435
     
    696696static RTEXITCODE watchdogMain(/*HandlerArg *a */)
    697697{
    698     HRESULT rc = S_OK;
     698    HRESULT hrc = S_OK;
    699699
    700700    do
     
    797797
    798798        if (RT_FAILURE(vrc))
    799             rc = VBOX_E_IPRT_ERROR;
     799            hrc = VBOX_E_IPRT_ERROR;
    800800
    801801    } while (0);
    802802
    803     return SUCCEEDED(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
     803    return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
    804804}
    805805
     
    934934     * Setup VirtualBox + session interfaces.
    935935     */
    936     HRESULT rc = g_pVirtualBoxClient->COMGETTER(VirtualBox)(g_pVirtualBox.asOutParam());
    937     if (SUCCEEDED(rc))
    938     {
    939         rc = g_pSession.createInprocObject(CLSID_Session);
    940         if (FAILED(rc))
    941             RTMsgError("Failed to create a session object (rc=%Rhrc)!", rc);
     936    HRESULT hrc = g_pVirtualBoxClient->COMGETTER(VirtualBox)(g_pVirtualBox.asOutParam());
     937    if (SUCCEEDED(hrc))
     938    {
     939        hrc = g_pSession.createInprocObject(CLSID_Session);
     940        if (FAILED(hrc))
     941            RTMsgError("Failed to create a session object (rc=%Rhrc)!", hrc);
    942942    }
    943943    else
    944         RTMsgError("Failed to get VirtualBox object (rc=%Rhrc)!", rc);
    945 
    946     if (FAILED(rc))
     944        RTMsgError("Failed to get VirtualBox object (rc=%Rhrc)!", hrc);
     945
     946    if (FAILED(hrc))
    947947        return VERR_COM_OBJECT_NOT_FOUND;
    948948
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r93901 r95141  
    869869    }
    870870
    871     HRESULT rc;
     871    HRESULT hrc;
    872872    int vrc;
    873873    Guid uuidVM;
     
    13861386    }
    13871387
    1388     rc = com::Initialize();
     1388    hrc = com::Initialize();
    13891389#ifdef VBOX_WITH_XPCOM
    1390     if (rc == NS_ERROR_FILE_ACCESS_DENIED)
     1390    if (hrc == NS_ERROR_FILE_ACCESS_DENIED)
    13911391    {
    13921392        char szHome[RTPATH_MAX] = "";
     
    13961396    }
    13971397#endif
    1398     if (FAILED(rc))
    1399     {
    1400         RTPrintf("Error: COM initialization failed (rc=%Rhrc)!\n", rc);
     1398    if (FAILED(hrc))
     1399    {
     1400        RTPrintf("Error: COM initialization failed (rc=%Rhrc)!\n", hrc);
    14011401        return 1;
    14021402    }
     
    14181418    ComPtr<IGraphicsAdapter> pGraphicsAdapter;
    14191419
    1420     rc = pVirtualBoxClient.createInprocObject(CLSID_VirtualBoxClient);
    1421     if (FAILED(rc))
     1420    hrc = pVirtualBoxClient.createInprocObject(CLSID_VirtualBoxClient);
     1421    if (FAILED(hrc))
    14221422    {
    14231423        com::ErrorInfo info;
     
    14261426                       info.getText().raw(), info.getComponent().raw());
    14271427        else
    1428             RTPrintf("Failed to create VirtualBoxClient object! No error information available (rc=%Rhrc).\n", rc);
     1428            RTPrintf("Failed to create VirtualBoxClient object! No error information available (rc=%Rhrc).\n", hrc);
    14291429        goto leave;
    14301430    }
    14311431
    1432     rc = pVirtualBoxClient->COMGETTER(VirtualBox)(pVirtualBox.asOutParam());
    1433     if (FAILED(rc))
    1434     {
    1435         RTPrintf("Failed to get VirtualBox object (rc=%Rhrc)!\n", rc);
     1432    hrc = pVirtualBoxClient->COMGETTER(VirtualBox)(pVirtualBox.asOutParam());
     1433    if (FAILED(hrc))
     1434    {
     1435        RTPrintf("Failed to get VirtualBox object (rc=%Rhrc)!\n", hrc);
    14361436        goto leave;
    14371437    }
    1438     rc = pVirtualBoxClient->COMGETTER(Session)(pSession.asOutParam());
    1439     if (FAILED(rc))
    1440     {
    1441         RTPrintf("Failed to get session object (rc=%Rhrc)!\n", rc);
     1438    hrc = pVirtualBoxClient->COMGETTER(Session)(pSession.asOutParam());
     1439    if (FAILED(hrc))
     1440    {
     1441        RTPrintf("Failed to get session object (rc=%Rhrc)!\n", hrc);
    14421442        goto leave;
    14431443    }
     
    14461446    {
    14471447        CHECK_ERROR(pVirtualBox, SetSettingsSecret(Bstr(pcszSettingsPw).raw()));
    1448         if (FAILED(rc))
     1448        if (FAILED(hrc))
    14491449            goto leave;
    14501450    }
     
    14611461    if (uuidVM.isValid())
    14621462    {
    1463         rc = pVirtualBox->FindMachine(uuidVM.toUtf16().raw(), pMachine.asOutParam());
    1464         if (FAILED(rc) || !pMachine)
     1463        hrc = pVirtualBox->FindMachine(uuidVM.toUtf16().raw(), pMachine.asOutParam());
     1464        if (FAILED(hrc) || !pMachine)
    14651465        {
    14661466            RTPrintf("Error: machine with the given ID not found!\n");
     
    14731473         * Do we have a name but no UUID?
    14741474         */
    1475         rc = pVirtualBox->FindMachine(Bstr(vmName).raw(), pMachine.asOutParam());
    1476         if ((rc == S_OK) && pMachine)
     1475        hrc = pVirtualBox->FindMachine(Bstr(vmName).raw(), pMachine.asOutParam());
     1476        if ((hrc == S_OK) && pMachine)
    14771477        {
    14781478            Bstr bstrId;
     
    14921492    AssertReleaseRC(vrc);
    14931493
    1494     rc = pVirtualBoxClient->CheckMachineError(pMachine);
    1495     if (FAILED(rc))
     1494    hrc = pVirtualBoxClient->CheckMachineError(pMachine);
     1495    if (FAILED(hrc))
    14961496    {
    14971497        com::ErrorInfo info;
     
    15001500                       info.getText().raw(), info.getComponent().raw());
    15011501        else
    1502             RTPrintf("Failed to check for VM errors! No error information available (rc=%Rhrc).\n", rc);
     1502            RTPrintf("Failed to check for VM errors! No error information available (rc=%Rhrc).\n", hrc);
    15031503        goto leave;
    15041504    }
     
    15201520        {
    15211521            ComPtr<IProgress> progress;
    1522             rc = pMachine->LaunchVMProcess(pSession, Bstr("headless").raw(), ComSafeArrayNullInParam(), progress.asOutParam());
    1523             if (SUCCEEDED(rc) && !progress.isNull())
     1522            hrc = pMachine->LaunchVMProcess(pSession, Bstr("headless").raw(), ComSafeArrayNullInParam(), progress.asOutParam());
     1523            if (SUCCEEDED(hrc) && !progress.isNull())
    15241524            {
    15251525                RTPrintf("Waiting for VM to power on...\n");
    1526                 rc = progress->WaitForCompletion(-1);
    1527                 if (SUCCEEDED(rc))
     1526                hrc = progress->WaitForCompletion(-1);
     1527                if (SUCCEEDED(hrc))
    15281528                {
    15291529                    BOOL completed = true;
    1530                     rc = progress->COMGETTER(Completed)(&completed);
    1531                     if (SUCCEEDED(rc))
     1530                    hrc = progress->COMGETTER(Completed)(&completed);
     1531                    if (SUCCEEDED(hrc))
    15321532                    {
    15331533                        LONG iRc;
    1534                         rc = progress->COMGETTER(ResultCode)(&iRc);
    1535                         if (SUCCEEDED(rc))
     1534                        hrc = progress->COMGETTER(ResultCode)(&iRc);
     1535                        if (SUCCEEDED(hrc))
    15361536                        {
    15371537                            if (FAILED(iRc))
     
    15541554            }
    15551555        }
    1556         if (FAILED(rc))
     1556        if (FAILED(hrc))
    15571557        {
    15581558            RTPrintf("Error: failed to power up VM! No error text available.\n");
     
    15601560        }
    15611561
    1562         rc = pMachine->LockMachine(pSession, LockType_Shared);
     1562        hrc = pMachine->LockMachine(pSession, LockType_Shared);
    15631563    }
    15641564    else
    15651565    {
    15661566        pSession->COMSETTER(Name)(Bstr("GUI/SDL").raw());
    1567         rc = pMachine->LockMachine(pSession, LockType_VM);
    1568     }
    1569 
    1570     if (FAILED(rc))
     1567        hrc = pMachine->LockMachine(pSession, LockType_VM);
     1568    }
     1569
     1570    if (FAILED(hrc))
    15711571    {
    15721572        com::ErrorInfo info;
     
    16941694            ComPtr<IHost> pHost;
    16951695            CHECK_ERROR_BREAK(pVirtualBox, COMGETTER(Host)(pHost.asOutParam()));
    1696             rc = pHost->FindHostFloppyDrive(bstrFdaFile.raw(),
     1696            hrc = pHost->FindHostFloppyDrive(bstrFdaFile.raw(),
    16971697                                            pMedium.asOutParam());
    1698             if (FAILED(rc))
     1698            if (FAILED(hrc))
    16991699            {
    17001700                /* try to find an existing one */
    1701                 rc = pVirtualBox->OpenMedium(bstrFdaFile.raw(),
     1701                hrc = pVirtualBox->OpenMedium(bstrFdaFile.raw(),
    17021702                                             DeviceType_Floppy,
    17031703                                             AccessMode_ReadWrite,
    17041704                                             FALSE /* fForceNewUuid */,
    17051705                                             pMedium.asOutParam());
    1706                 if (FAILED(rc))
     1706                if (FAILED(hrc))
    17071707                {
    17081708                    /* try to add to the list */
     
    17561756    }
    17571757    while (0);
    1758     if (FAILED(rc))
     1758    if (FAILED(hrc))
    17591759        goto leave;
    17601760
     
    17791779            ComPtr<IHost> pHost;
    17801780            CHECK_ERROR_BREAK(pVirtualBox, COMGETTER(Host)(pHost.asOutParam()));
    1781             rc = pHost->FindHostDVDDrive(bstrCdromFile.raw(), pMedium.asOutParam());
    1782             if (FAILED(rc))
     1781            hrc = pHost->FindHostDVDDrive(bstrCdromFile.raw(), pMedium.asOutParam());
     1782            if (FAILED(hrc))
    17831783            {
    17841784                /* try to find an existing one */
    1785                 rc = pVirtualBox->OpenMedium(bstrCdromFile.raw(),
     1785                hrc = pVirtualBox->OpenMedium(bstrCdromFile.raw(),
    17861786                                            DeviceType_DVD,
    17871787                                            AccessMode_ReadWrite,
    17881788                                            FALSE /* fForceNewUuid */,
    17891789                                            pMedium.asOutParam());
    1790                 if (FAILED(rc))
     1790                if (FAILED(hrc))
    17911791                {
    17921792                    /* try to add to the list */
     
    18401840    }
    18411841    while (0);
    1842     if (FAILED(rc))
     1842    if (FAILED(hrc))
    18431843        goto leave;
    18441844
     
    18671867            ComPtr<ISnapshot> pCurrentSnapshot;
    18681868            CHECK_ERROR(gpMachine, COMGETTER(CurrentSnapshot)(pCurrentSnapshot.asOutParam()));
    1869             if (FAILED(rc))
     1869            if (FAILED(hrc))
    18701870                goto leave;
    18711871
    18721872            CHECK_ERROR(gpMachine, RestoreSnapshot(pCurrentSnapshot, gpProgress.asOutParam()));
    1873             rc = gpProgress->WaitForCompletion(-1);
     1873            hrc = gpProgress->WaitForCompletion(-1);
    18741874        }
    18751875    }
     
    18911891    if (bootDevice != DeviceType_Null)
    18921892    {
    1893         rc = gpMachine->SetBootOrder(1, bootDevice);
    1894         if (rc != S_OK)
     1893        hrc = gpMachine->SetBootOrder(1, bootDevice);
     1894        if (hrc != S_OK)
    18951895        {
    18961896            RTPrintf("Error: could not set boot device, using default.\n");
     
    19011901    if (memorySize)
    19021902    {
    1903         rc = gpMachine->COMSETTER(MemorySize)(memorySize);
    1904         if (rc != S_OK)
     1903        hrc = gpMachine->COMSETTER(MemorySize)(memorySize);
     1904        if (hrc != S_OK)
    19051905        {
    19061906            ULONG ramSize = 0;
     
    19101910    }
    19111911
    1912     rc = gpMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam());
    1913     if (rc != S_OK)
     1912    hrc = gpMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam());
     1913    if (hrc != S_OK)
    19141914    {
    19151915        RTPrintf("Error: could not get graphics adapter object\n");
     
    19191919    if (vramSize)
    19201920    {
    1921         rc = pGraphicsAdapter->COMSETTER(VRAMSize)(vramSize);
    1922         if (rc != S_OK)
     1921        hrc = pGraphicsAdapter->COMSETTER(VRAMSize)(vramSize);
     1922        if (hrc != S_OK)
    19231923        {
    19241924            pGraphicsAdapter->COMGETTER(VRAMSize)((ULONG*)&vramSize);
     
    19511951        // create our SDL framebuffer instance
    19521952        gpFramebuffer[i].createObject();
    1953         rc = gpFramebuffer[i]->init(i, fFullscreen, fResizable, fShowSDLConfig, false,
     1953        hrc = gpFramebuffer[i]->init(i, fFullscreen, fResizable, fShowSDLConfig, false,
    19541954                                    fixedWidth, fixedHeight, fixedBPP, fSeparate);
    1955         if (FAILED(rc))
     1955        if (FAILED(hrc))
    19561956        {
    19571957            RTPrintf("Error: could not create framebuffer object!\n");
     
    20312031    {
    20322032        // register our framebuffer
    2033         rc = gpDisplay->AttachFramebuffer(i, gpFramebuffer[i], gaFramebufferId[i].asOutParam());
    2034         if (FAILED(rc))
     2033        hrc = gpDisplay->AttachFramebuffer(i, gpFramebuffer[i], gaFramebufferId[i].asOutParam());
     2034        if (FAILED(hrc))
    20352035        {
    20362036            RTPrintf("Error: could not register framebuffer object!\n");
     
    20402040        LONG xOrigin, yOrigin;
    20412041        GuestMonitorStatus_T monitorStatus;
    2042         rc = gpDisplay->GetScreenResolution(i, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
     2042        hrc = gpDisplay->GetScreenResolution(i, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
    20432043        gpFramebuffer[i]->setOrigin(xOrigin, yOrigin);
    20442044    }
     
    20912091    if (pszPortVRDP)
    20922092    {
    2093         rc = gpMachine->COMGETTER(VRDEServer)(gpVRDEServer.asOutParam());
    2094         AssertMsg((rc == S_OK) && gpVRDEServer, ("Could not get VRDP Server! rc = 0x%x\n", rc));
     2093        hrc = gpMachine->COMGETTER(VRDEServer)(gpVRDEServer.asOutParam());
     2094        AssertMsg((hrc == S_OK) && gpVRDEServer, ("Could not get VRDP Server! rc = 0x%x\n", hrc));
    20952095        if (gpVRDEServer)
    20962096        {
     
    20982098            if (strcmp(pszPortVRDP, "0"))
    20992099            {
    2100                 rc = gpVRDEServer->SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(pszPortVRDP).raw());
    2101                 if (rc != S_OK)
     2100                hrc = gpVRDEServer->SetVRDEProperty(Bstr("TCP/Ports").raw(), Bstr(pszPortVRDP).raw());
     2101                if (hrc != S_OK)
    21022102                {
    2103                     RTPrintf("Error: could not set VRDP port! rc = 0x%x\n", rc);
     2103                    RTPrintf("Error: could not set VRDP port! rc = 0x%x\n", hrc);
    21042104                    goto leave;
    21052105                }
    21062106            }
    21072107            // now enable VRDP
    2108             rc = gpVRDEServer->COMSETTER(Enabled)(TRUE);
    2109             if (rc != S_OK)
    2110             {
    2111                 RTPrintf("Error: could not enable VRDP server! rc = 0x%x\n", rc);
     2108            hrc = gpVRDEServer->COMSETTER(Enabled)(TRUE);
     2109            if (hrc != S_OK)
     2110            {
     2111                RTPrintf("Error: could not enable VRDP server! rc = 0x%x\n", hrc);
    21122112                goto leave;
    21132113            }
     
    21152115    }
    21162116
    2117     rc = E_FAIL;
     2117    hrc = E_FAIL;
    21182118#ifdef VBOXSDL_ADVANCED_OPTIONS
    21192119    if (u32WarpDrive != 0)
     
    21882188    {
    21892189        LogFlow(("Powering up the VM...\n"));
    2190         rc = gpConsole->PowerUp(gpProgress.asOutParam());
    2191         if (rc != S_OK)
     2190        hrc = gpConsole->PowerUp(gpProgress.asOutParam());
     2191        if (hrc != S_OK)
    21922192        {
    21932193            com::ErrorInfo info(gpConsole, COM_IIDOF(IConsole));
     
    22282228    do
    22292229    {
    2230         rc = gpMachine->COMGETTER(State)(&machineState);
    2231         if (    rc == S_OK
     2230        hrc = gpMachine->COMGETTER(State)(&machineState);
     2231        if (    hrc == S_OK
    22322232            &&  (   machineState == MachineState_Starting
    22332233                 || machineState == MachineState_Restoring
     
    22802280                        ULONG dummy;
    22812281                        GuestMonitorStatus_T monitorStatus;
    2282                         rc = gpDisplay->GetScreenResolution(event.user.code, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
     2282                        hrc = gpDisplay->GetScreenResolution(event.user.code, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
    22832283                        gpFramebuffer[event.user.code]->setOrigin(xOrigin, yOrigin);
    22842284                        break;
     
    23252325        }
    23262326        eventQ->processEventQueue(0);
    2327     } while (   rc == S_OK
     2327    } while (   hrc == S_OK
    23282328             && (   machineState == MachineState_Starting
    23292329                 || machineState == MachineState_Restoring
     
    23472347            PrintError("Failed to power up VM", info.getText().raw());
    23482348        else
    2349             RTPrintf("Error: failed to power up VM! No error text available (rc = 0x%x state = %d)\n", rc, machineState);
     2349            RTPrintf("Error: failed to power up VM! No error text available (rc = 0x%x state = %d)\n", hrc, machineState);
    23502350        goto leave;
    23512351    }
     
    23552355    pConsoleListener->getWrapped()->ignorePowerOffEvents(false);
    23562356
    2357     rc = gpConsole->COMGETTER(Keyboard)(gpKeyboard.asOutParam());
     2357    hrc = gpConsole->COMGETTER(Keyboard)(gpKeyboard.asOutParam());
    23582358    if (!gpKeyboard)
    23592359    {
     
    28412841                ULONG dummy;
    28422842                GuestMonitorStatus_T monitorStatus;
    2843                 rc = gpDisplay->GetScreenResolution(event.user.code, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
     2843                hrc = gpDisplay->GetScreenResolution(event.user.code, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
    28442844                gpFramebuffer[event.user.code]->setOrigin(xOrigin, yOrigin);
    28452845                break;
     
    29372937
    29382938    if (gpVRDEServer)
    2939         rc = gpVRDEServer->COMSETTER(Enabled)(FALSE);
     2939        hrc = gpVRDEServer->COMSETTER(Enabled)(FALSE);
    29402940
    29412941    /*
     
    29682968            CHECK_ERROR_BREAK(pProgress, COMGETTER(Completed)(&completed));
    29692969            ASSERT(completed);
    2970             LONG hrc;
    2971             CHECK_ERROR_BREAK(pProgress, COMGETTER(ResultCode)(&hrc));
    2972             if (FAILED(hrc))
     2970            LONG hrc2;
     2971            CHECK_ERROR_BREAK(pProgress, COMGETTER(ResultCode)(&hrc2));
     2972            if (FAILED(hrc2))
    29732973            {
    29742974                com::ErrorInfo info;
     
    29772977                               info.getText().raw(), info.getComponent().raw());
    29782978                else
    2979                     RTPrintf("Failed to power down virtual machine! No error information available (rc = 0x%x).\n", hrc);
     2979                    RTPrintf("Failed to power down virtual machine! No error information available (rc=%Rhrc).\n", hrc2);
    29802980                break;
    29812981            }
     
    30013001        && machineState != MachineState_AbortedSaved)
    30023002    {
    3003         rc = gpMachine->DiscardSettings();
    3004         AssertMsg(SUCCEEDED(rc), ("DiscardSettings %Rhrc, machineState %d\n", rc, machineState));
     3003        hrc = gpMachine->DiscardSettings();
     3004        AssertMsg(SUCCEEDED(hrc), ("DiscardSettings %Rhrc, machineState %d\n", hrc, machineState));
    30053005    }
    30063006
     
    30083008    if (sessionOpened)
    30093009    {
    3010         rc = pSession->UnlockMachine();
    3011         AssertComRC(rc);
     3010        hrc = pSession->UnlockMachine();
     3011        AssertComRC(hrc);
    30123012    }
    30133013
     
    31213121    LogFlow(("Returning from main()!\n"));
    31223122    RTLogFlush(NULL);
    3123     return FAILED(rc) ? 1 : 0;
     3123    return FAILED(hrc) ? 1 : 0;
    31243124}
    31253125
     
    41254125    UpdateTitlebar(TITLEBAR_SAVE);
    41264126    gpProgress = NULL;
    4127     HRESULT rc = gpMachine->SaveState(gpProgress.asOutParam());
    4128     if (FAILED(rc))
    4129     {
    4130         RTPrintf("Error saving state! rc = 0x%x\n", rc);
     4127    HRESULT hrc = gpMachine->SaveState(gpProgress.asOutParam());
     4128    if (FAILED(hrc))
     4129    {
     4130        RTPrintf("Error saving state! rc=%Rhrc\n", hrc);
    41314131        return;
    41324132    }
     
    41424142    {
    41434143        BOOL fCompleted = false;
    4144         rc = gpProgress->COMGETTER(Completed)(&fCompleted);
    4145         if (FAILED(rc) || fCompleted)
     4144        hrc = gpProgress->COMGETTER(Completed)(&fCompleted);
     4145        if (FAILED(hrc) || fCompleted)
    41464146            break;
    41474147        ULONG cPercentNow;
    4148         rc = gpProgress->COMGETTER(Percent)(&cPercentNow);
    4149         if (FAILED(rc))
     4148        hrc = gpProgress->COMGETTER(Percent)(&cPercentNow);
     4149        if (FAILED(hrc))
    41504150            break;
    41514151        if (cPercentNow != cPercent)
     
    41564156
    41574157        /* wait */
    4158         rc = gpProgress->WaitForCompletion(100);
    4159         if (FAILED(rc))
     4158        hrc = gpProgress->WaitForCompletion(100);
     4159        if (FAILED(hrc))
    41604160            break;
    41614161        /// @todo process gui events.
     
    41744174         */
    41754175        BOOL fCompleted = false;
    4176         rc = gpProgress->COMGETTER(Completed)(&fCompleted);
    4177         if (FAILED(rc) || fCompleted)
     4176        hrc = gpProgress->COMGETTER(Completed)(&fCompleted);
     4177        if (FAILED(hrc) || fCompleted)
    41784178            break;
    41794179        ULONG cPercentNow;
    4180         rc = gpProgress->COMGETTER(Percent)(&cPercentNow);
    4181         if (FAILED(rc))
     4180        hrc = gpProgress->COMGETTER(Percent)(&cPercentNow);
     4181        if (FAILED(hrc))
    41824182            break;
    41834183        if (cPercentNow != cPercent)
     
    42384238     */
    42394239    LONG lrc;
    4240     rc = gpProgress->COMGETTER(ResultCode)(&lrc);
    4241     if (FAILED(rc))
     4240    hrc = gpProgress->COMGETTER(ResultCode)(&lrc);
     4241    if (FAILED(hrc))
    42424242        lrc = ~0;
    42434243    if (!lrc)
     
    43244324            {
    43254325                ULONG cPercentNow;
    4326                 HRESULT rc = gpProgress->COMGETTER(Percent)(&cPercentNow);
    4327                 if (SUCCEEDED(rc))
     4326                HRESULT hrc = gpProgress->COMGETTER(Percent)(&cPercentNow);
     4327                if (SUCCEEDED(hrc))
    43284328                    RTStrPrintf(szTitle + strlen(szTitle), sizeof(szTitle) - strlen(szTitle),
    43294329                                " - Restoring %d%%...", (int)cPercentNow);
     
    43354335            {
    43364336                ULONG cPercentNow;
    4337                 HRESULT rc = gpProgress->COMGETTER(Percent)(&cPercentNow);
    4338                 if (SUCCEEDED(rc))
     4337                HRESULT hrc = gpProgress->COMGETTER(Percent)(&cPercentNow);
     4338                if (SUCCEEDED(hrc))
    43394339                    RTStrPrintf(szTitle + strlen(szTitle), sizeof(szTitle) - strlen(szTitle),
    43404340                                " - Teleporting %d%%...", (int)cPercentNow);
     
    48734873            RTStrPrintf(pszSnapshotName, sizeof(pszSnapshotName), "Snapshot %d", cSnapshots + 1);
    48744874            gpProgress = NULL;
    4875             HRESULT rc;
     4875            HRESULT hrc;
    48764876            Bstr snapId;
    48774877            CHECK_ERROR(gpMachine, TakeSnapshot(Bstr(pszSnapshotName).raw(),
     
    48794879                                                TRUE, snapId.asOutParam(),
    48804880                                                gpProgress.asOutParam()));
    4881             if (FAILED(rc))
    4882             {
    4883                 RTPrintf("Error taking snapshot! rc = 0x%x\n", rc);
     4881            if (FAILED(hrc))
     4882            {
     4883                RTPrintf("Error taking snapshot! rc=%Rhrc\n", hrc);
    48844884                /* continue operation */
    48854885                return VINF_SUCCESS;
     
    48934893            {
    48944894                BOOL fCompleted = false;
    4895                 rc = gpProgress->COMGETTER(Completed)(&fCompleted);
    4896                 if (FAILED(rc) || fCompleted)
     4895                hrc = gpProgress->COMGETTER(Completed)(&fCompleted);
     4896                if (FAILED(hrc) || fCompleted)
    48974897                    break;
    48984898                ULONG cPercentNow;
    4899                 rc = gpProgress->COMGETTER(Percent)(&cPercentNow);
    4900                 if (FAILED(rc))
     4899                hrc = gpProgress->COMGETTER(Percent)(&cPercentNow);
     4900                if (FAILED(hrc))
    49014901                    break;
    49024902                if (cPercentNow != cPercent)
     
    49074907
    49084908                /* wait */
    4909                 rc = gpProgress->WaitForCompletion(100);
    4910                 if (FAILED(rc))
     4909                hrc = gpProgress->WaitForCompletion(100);
     4910                if (FAILED(hrc))
    49114911                    break;
    49124912                /// @todo process gui events.
  • trunk/src/VBox/ImageMounter/vboximg-mount/vboximgMedia.cpp

    r93115 r95141  
    316316vboximgListVMs(IVirtualBox *pVirtualBox)
    317317{
    318     HRESULT rc = 0;
     318    HRESULT hrc = 0;
    319319    com::SafeIfaceArray<IMachine> pMachines;
    320320    CHECK_ERROR(pVirtualBox, COMGETTER(Machines)(ComSafeArrayAsOutParam(pMachines)));
     
    372372                        }
    373373                    }
    374                     rc = listMedia(pVirtualBox, pMachine,
     374                    hrc = listMedia(pVirtualBox, pMachine,
    375375                            RTStrDup(CSTR(machineName)), RTStrDup(CSTR(machineUuid)));
    376376                    RTPrintf("\n");
     
    379379        }
    380380    }
    381     return rc;
    382 }
     381    return hrc;
     382}
Note: See TracChangeset for help on using the changeset viewer.

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