VirtualBox

Changeset 98293 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jan 25, 2023 1:22:39 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155498
Message:

Main/src-server: hr -> hrc. bugref:10223

Location:
trunk/src/VBox/Main/src-server
Files:
6 edited

Legend:

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

    r98288 r98293  
    7676HRESULT HostDnsServiceResolvConf::init(HostDnsMonitorProxy *pProxy, const char *aResolvConfFileName)
    7777{
    78     HRESULT hr = HostDnsServiceBase::init(pProxy);
    79     AssertComRCReturn(hr, hr);
     78    HRESULT hrc = HostDnsServiceBase::init(pProxy);
     79    AssertComRCReturn(hrc, hrc);
    8080
    8181    m = new Data(aResolvConfFileName);
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r98292 r98293  
    632632                                  INetCfgComponent *pncc)
    633633{
    634     LPWSTR lpszName;
    635     GUID IfGuid;
    636     HRESULT hr;
    637634    int vrc = VERR_GENERAL_FAILURE;
    638635
    639     hr = pncc->GetDisplayName(&lpszName);
    640     Assert(hr == S_OK);
    641     if (hr == S_OK)
     636    LPWSTR lpszName = NULL;
     637    HRESULT hrc = pncc->GetDisplayName(&lpszName);
     638    Assert(hrc == S_OK);
     639    if (hrc == S_OK)
    642640    {
    643641        Bstr name((CBSTR)lpszName);
    644642
    645         hr = pncc->GetInstanceGuid(&IfGuid);
    646         Assert(hr == S_OK);
    647         if (hr == S_OK)
     643        GUID IfGuid;
     644        hrc = pncc->GetInstanceGuid(&IfGuid);
     645        Assert(hrc == S_OK);
     646        if (hrc == S_OK)
    648647        {
    649648            /* create a new object and add it to the list */
     
    873872#  elif defined RT_OS_WINDOWS
    874873#   ifndef VBOX_WITH_NETFLT
    875     hr = E_NOTIMPL;
     874    hrc = E_NOTIMPL;
    876875#   else /* #  if defined VBOX_WITH_NETFLT */
    877876    INetCfg              *pNc;
     
    879878    INetCfgComponent     *pTcpIpNcc;
    880879    LPWSTR               lpszApp;
    881     HRESULT              hr;
     880    HRESULT              hrc;
    882881    IEnumNetCfgBindingPath      *pEnumBp;
    883882    INetCfgBindingPath          *pBp;
     
    886885
    887886    /* we are using the INetCfg API for getting the list of miniports */
    888     hr = VBoxNetCfgWinQueryINetCfg(FALSE,
    889                                    VBOX_APP_NAME,
    890                                    &pNc,
    891                                    &lpszApp);
    892     Assert(hr == S_OK);
    893     if (hr == S_OK)
     887    hrc = VBoxNetCfgWinQueryINetCfg(FALSE, VBOX_APP_NAME, &pNc, &lpszApp);
     888    Assert(hrc == S_OK);
     889    if (hrc == S_OK)
    894890    {
    895891#    ifdef VBOX_NETFLT_ONDEMAND_BIND
    896892        /* for the protocol-based approach for now we just get all miniports the MS_TCPIP protocol binds to */
    897         hr = pNc->FindComponent(L"MS_TCPIP", &pTcpIpNcc);
     893        hrc = pNc->FindComponent(L"MS_TCPIP", &pTcpIpNcc);
    898894#    else
    899895        /* for the filter-based approach we get all miniports our filter (oracle_VBoxNetLwf)is bound to */
    900         hr = pNc->FindComponent(L"oracle_VBoxNetLwf", &pTcpIpNcc);
    901         if (hr != S_OK)
     896        hrc = pNc->FindComponent(L"oracle_VBoxNetLwf", &pTcpIpNcc);
     897        if (hrc != S_OK)
    902898        {
    903899            /* fall back to NDIS5 miniport lookup (sun_VBoxNetFlt) */
    904             hr = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);
     900            hrc = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);
    905901        }
    906902#     ifndef VBOX_WITH_HARDENING
    907         if (hr != S_OK)
     903        if (hrc != S_OK)
    908904        {
    909905            /** @todo try to install the netflt from here */
     
    913909#    endif
    914910
    915         if (hr == S_OK)
    916         {
    917             hr = VBoxNetCfgWinGetBindingPathEnum(pTcpIpNcc, EBP_BELOW, &pEnumBp);
    918             Assert(hr == S_OK);
    919             if (hr == S_OK)
     911        if (hrc == S_OK)
     912        {
     913            hrc = VBoxNetCfgWinGetBindingPathEnum(pTcpIpNcc, EBP_BELOW, &pEnumBp);
     914            Assert(hrc == S_OK);
     915            if (hrc == S_OK)
    920916            {
    921                 hr = VBoxNetCfgWinGetFirstBindingPath(pEnumBp, &pBp);
    922                 Assert(hr == S_OK || hr == S_FALSE);
    923                 while (hr == S_OK)
     917                hrc = VBoxNetCfgWinGetFirstBindingPath(pEnumBp, &pBp);
     918                Assert(hrc == S_OK || hrc == S_FALSE);
     919                while (hrc == S_OK)
    924920                {
    925921                    /* S_OK == enabled, S_FALSE == disabled */
    926922                    if (pBp->IsEnabled() == S_OK)
    927923                    {
    928                         hr = VBoxNetCfgWinGetBindingInterfaceEnum(pBp, &pEnumBi);
    929                         Assert(hr == S_OK);
    930                         if (hr == S_OK)
     924                        hrc = VBoxNetCfgWinGetBindingInterfaceEnum(pBp, &pEnumBi);
     925                        Assert(hrc == S_OK);
     926                        if (hrc == S_OK)
    931927                        {
    932                             hr = VBoxNetCfgWinGetFirstBindingInterface(pEnumBi, &pBi);
    933                             Assert(hr == S_OK);
    934                             while (hr == S_OK)
     928                            hrc = VBoxNetCfgWinGetFirstBindingInterface(pEnumBi, &pBi);
     929                            Assert(hrc == S_OK);
     930                            while (hrc == S_OK)
    935931                            {
    936                                 hr = pBi->GetLowerComponent(&pMpNcc);
    937                                 Assert(hr == S_OK);
    938                                 if (hr == S_OK)
     932                                hrc = pBi->GetLowerComponent(&pMpNcc);
     933                                Assert(hrc == S_OK);
     934                                if (hrc == S_OK)
    939935                                {
    940936                                    ULONG uComponentStatus;
    941                                     hr = pMpNcc->GetDeviceStatus(&uComponentStatus);
    942                                     Assert(hr == S_OK);
    943                                     if (hr == S_OK)
     937                                    hrc = pMpNcc->GetDeviceStatus(&uComponentStatus);
     938                                    Assert(hrc == S_OK);
     939                                    if (hrc == S_OK)
    944940                                    {
    945941                                        if (uComponentStatus == 0)
    946                                         {
    947942                                            vboxNetWinAddComponent(&list, pMpNcc);
    948                                         }
    949943                                    }
    950944                                    VBoxNetCfgWinReleaseRef(pMpNcc);
     
    952946                                VBoxNetCfgWinReleaseRef(pBi);
    953947
    954                                 hr = VBoxNetCfgWinGetNextBindingInterface(pEnumBi, &pBi);
     948                                hrc = VBoxNetCfgWinGetNextBindingInterface(pEnumBi, &pBi);
    955949                            }
    956950                            VBoxNetCfgWinReleaseRef(pEnumBi);
     
    959953                    VBoxNetCfgWinReleaseRef(pBp);
    960954
    961                     hr = VBoxNetCfgWinGetNextBindingPath(pEnumBp, &pBp);
     955                    hrc = VBoxNetCfgWinGetNextBindingPath(pEnumBp, &pBp);
    962956                }
    963957                VBoxNetCfgWinReleaseRef(pEnumBp);
     
    967961        else
    968962        {
    969             LogRel(("failed to get the oracle_VBoxNetLwf(sun_VBoxNetFlt) component, error (0x%x)\n", hr));
     963            LogRel(("failed to get the oracle_VBoxNetLwf(sun_VBoxNetFlt) component, error (0x%x)\n", hrc));
    970964        }
    971965
     
    18841878    {
    18851879        HostNetworkInterfaceType_T t;
    1886         HRESULT hr = (*it)->COMGETTER(InterfaceType)(&t);
    1887         if (FAILED(hr))
    1888             return hr;
     1880        HRESULT hrc = (*it)->COMGETTER(InterfaceType)(&t);
     1881        if (FAILED(hrc))
     1882            return hrc;
    18891883
    18901884        if (t == aType)
  • trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp

    r98288 r98293  
    102102{
    103103    ComObjPtr<HostVideoInputDevice> obj;
    104     HRESULT hr = obj.createObject();
    105     if (SUCCEEDED(hr))
    106     {
    107         hr = obj->init(name, path, alias);
    108         if (SUCCEEDED(hr))
     104    HRESULT hrc = obj.createObject();
     105    if (SUCCEEDED(hrc))
     106    {
     107        hrc = obj->init(name, path, alias);
     108        if (SUCCEEDED(hrc))
    109109            pList->push_back(obj);
    110110    }
    111     return hr;
     111    return hrc;
    112112}
    113113
     
    119119{
    120120    HostVideoInputDeviceList *pList = (HostVideoInputDeviceList *)pvUser;
    121     HRESULT hr = hostVideoInputDeviceAdd(pList, pszName, pszPath, pszAlias);
    122     if (FAILED(hr))
    123     {
    124         *pu64Result = (uint64_t)hr;
     121    HRESULT hrc = hostVideoInputDeviceAdd(pList, pszName, pszPath, pszAlias);
     122    if (FAILED(hrc))
     123    {
     124        *pu64Result = (uint64_t)hrc;
    125125        return VERR_NOT_SUPPORTED;
    126126    }
     
    195195static HRESULT fillDeviceList(VirtualBox *pVirtualBox, HostVideoInputDeviceList *pList)
    196196{
    197     HRESULT hr;
    198197    Utf8Str strLibrary;
    199 
    200198#ifdef VBOX_WITH_EXTPACK
    201199    ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager();
    202     hr = pExtPackMgr->i_getLibraryPathForExtPack("VBoxHostWebcam", ORACLE_PUEL_EXTPACK_NAME, &strLibrary);
     200    HRESULT hrc = pExtPackMgr->i_getLibraryPathForExtPack("VBoxHostWebcam", ORACLE_PUEL_EXTPACK_NAME, &strLibrary);
    203201#else
    204     hr = E_NOTIMPL;
    205 #endif
    206 
    207     if (SUCCEEDED(hr))
     202    HRESULT hrc = E_NOTIMPL;
     203#endif
     204
     205    if (SUCCEEDED(hrc))
    208206    {
    209207        PFNVBOXHOSTWEBCAMLIST pfn = NULL;
     
    223221            Log(("VBoxHostWebcamList vrc %Rrc, result 0x%08RX64\n", vrc, u64Result));
    224222            if (RT_FAILURE(vrc))
    225             {
    226                 hr = (HRESULT)u64Result;
    227             }
     223                hrc = (HRESULT)u64Result;
    228224
    229225            RTLdrClose(hmod);
     
    231227        }
    232228
    233         if (SUCCEEDED(hr))
     229        if (SUCCEEDED(hrc))
    234230        {
    235231            if (RT_FAILURE(vrc))
    236                 hr = pVirtualBox->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    237                                                HostVideoInputDevice::tr("Failed to get webcam list: %Rrc"), vrc);
    238         }
    239     }
    240 
    241     return hr;
     232                hrc = pVirtualBox->setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
     233                                                HostVideoInputDevice::tr("Failed to get webcam list: %Rrc"), vrc);
     234        }
     235    }
     236
     237    return hrc;
    242238}
    243239
    244240/* static */ HRESULT HostVideoInputDevice::queryHostDevices(VirtualBox *pVirtualBox, HostVideoInputDeviceList *pList)
    245241{
    246     HRESULT hr = fillDeviceList(pVirtualBox, pList);
    247 
    248     if (FAILED(hr))
    249     {
     242    HRESULT hrc = fillDeviceList(pVirtualBox, pList);
     243    if (FAILED(hrc))
    250244        pList->clear();
    251     }
    252 
    253     return hr;
     245    return hrc;
    254246}
    255247
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r98292 r98293  
    66086608                            vrc);
    66096609
    6610     HRESULT hr = S_OK;
     6610    HRESULT hrc = S_OK;
    66116611
    66126612    *aWidth = u32Width;
     
    66626662            }
    66636663            else
    6664                 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
    6665                                   tr("Could not convert saved thumbnail to PNG (%Rrc)"),
    6666                                   vrc);
     6664                hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not convert saved thumbnail to PNG (%Rrc)"), vrc);
    66676665
    66686666            RTMemFree(pu8PNG);
     
    66726670    freeSavedDisplayScreenshot(pu8Data);
    66736671
    6674     return hr;
     6672    return hrc;
    66756673}
    66766674
     
    1432614324    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    1432714325
    14328     HRESULT hr = S_OK;
     14326    HRESULT hrc = S_OK;
    1432914327
    1433014328    if (!mAuthLibCtx.hAuthLibrary)
     
    1433814336        int vrc = AuthLibLoad(&mAuthLibCtx, filename.c_str());
    1433914337        if (RT_FAILURE(vrc))
    14340             hr = setErrorBoth(E_FAIL, vrc,
    14341                               tr("Could not load the external authentication library '%s' (%Rrc)"),
    14342                               filename.c_str(), vrc);
     14338            hrc = setErrorBoth(E_FAIL, vrc,
     14339                               tr("Could not load the external authentication library '%s' (%Rrc)"),
     14340                               filename.c_str(), vrc);
    1434314341    }
    1434414342
     
    1434614344    alock.release();
    1434714345
    14348     if (FAILED(hr))
    14349        return hr;
     14346    if (FAILED(hrc))
     14347       return hrc;
    1435014348
    1435114349    if (aAuthParams[0] == "VRDEAUTH" && aAuthParams.size() == 7)
     
    1440414402    else
    1440514403    {
    14406         hr = E_INVALIDARG;
    14407     }
    14408 
    14409     return hr;
     14404        hrc = E_INVALIDARG;
     14405    }
     14406
     14407    return hrc;
    1441014408}
    1441114409
  • trunk/src/VBox/Main/src-server/UpdateAgentImpl.cpp

    r98292 r98293  
    341341    unconst(m_VirtualBox) = aVirtualBox;
    342342
    343     HRESULT hr = unconst(m_EventSource).createObject();
    344     if (SUCCEEDED(hr))
    345         hr = m_EventSource->init();
    346 
    347     return hr;
     343    HRESULT hrc = unconst(m_EventSource).createObject();
     344    if (SUCCEEDED(hrc))
     345        hrc = m_EventSource->init();
     346
     347    return hrc;
    348348}
    349349
     
    902902    m->strRepoUrl = "https://update.virtualbox.org";
    903903
    904     HRESULT hr = UpdateAgent::init(aVirtualBox);
    905     if (SUCCEEDED(hr))
     904    HRESULT hrc = UpdateAgent::init(aVirtualBox);
     905    if (SUCCEEDED(hrc))
    906906        autoInitSpan.setSucceeded();
    907907
    908     return hr;
     908    return hrc;
    909909}
    910910
  • trunk/src/VBox/Main/src-server/win/NetIf-win.cpp

    r98292 r98293  
    218218
    219219        ADAPTER_SETTINGS Settings;
    220         HRESULT hr = VBoxNetCfgWinGetAdapterSettings((const GUID *)guid.raw(), &Settings);
    221         if (hr == S_OK)
     220        HRESULT hrc = VBoxNetCfgWinGetAdapterSettings((const GUID *)guid.raw(), &Settings);
     221        if (hrc == S_OK)
    222222        {
    223223            if (Settings.ip)
     
    983983                                  int iDefaultInterface)
    984984{
    985     LPWSTR              lpszName;
    986     GUID                IfGuid;
    987     HRESULT hr;
    988985    int vrc = VERR_GENERAL_FAILURE;
    989986
    990     hr = pncc->GetDisplayName(&lpszName);
    991     Assert(hr == S_OK);
    992     if (hr == S_OK)
     987    LPWSTR lpszName;
     988    HRESULT hrc = pncc->GetDisplayName(&lpszName);
     989    Assert(hrc == S_OK);
     990    if (hrc == S_OK)
    993991    {
    994992        Bstr name(lpszName);
    995993
    996         hr = pncc->GetInstanceGuid(&IfGuid);
    997         Assert(hr == S_OK);
    998         if (hr == S_OK)
     994        GUID IfGuid;
     995        hrc = pncc->GetInstanceGuid(&IfGuid);
     996        Assert(hrc == S_OK);
     997        if (hrc == S_OK)
    999998        {
    1000999            Guid guidIfCopy(IfGuid);
     
    10251024        }
    10261025        else
    1027             LogRelFunc(("failed to get device instance GUID (0x%x)\n", hr));
     1026            LogRelFunc(("failed to get device instance GUID (0x%x)\n", hrc));
    10281027        CoTaskMemFree(lpszName);
    10291028    }
    10301029    else
    1031         LogRelFunc(("failed to get device display name (0x%x)\n", hr));
     1030        LogRelFunc(("failed to get device display name (0x%x)\n", hrc));
    10321031
    10331032    return vrc;
     
    10431042    return VERR_NOT_IMPLEMENTED;
    10441043#else /* #  if defined VBOX_WITH_NETFLT */
    1045     INetCfgComponent     *pMpNcc;
    1046     HRESULT              hr;
    1047     IEnumNetCfgComponent  *pEnumComponent;
    1048 
    1049     hr = pNc->EnumComponents(&GUID_DEVCLASS_NET, &pEnumComponent);
    1050     if (hr == S_OK)
    1051     {
    1052         while ((hr = pEnumComponent->Next(1, &pMpNcc, NULL)) == S_OK)
     1044    IEnumNetCfgComponent *pEnumComponent;
     1045    HRESULT hrc = pNc->EnumComponents(&GUID_DEVCLASS_NET, &pEnumComponent);
     1046    if (hrc == S_OK)
     1047    {
     1048        INetCfgComponent *pMpNcc;
     1049        while ((hrc = pEnumComponent->Next(1, &pMpNcc, NULL)) == S_OK)
    10531050        {
    10541051            LPWSTR pwszName;
    10551052            ULONG uComponentStatus;
    1056             hr = pMpNcc->GetDisplayName(&pwszName);
    1057             if (hr == S_OK)
     1053            hrc = pMpNcc->GetDisplayName(&pwszName);
     1054            if (hrc == S_OK)
    10581055                LogFunc(("%ls\n", pwszName));
    10591056            else
    1060                 LogRelFunc(("failed to get device display name (0x%x)\n", hr));
    1061             hr = pMpNcc->GetDeviceStatus(&uComponentStatus);
    1062             if (hr == S_OK)
     1057                LogRelFunc(("failed to get device display name (0x%x)\n", hrc));
     1058            hrc = pMpNcc->GetDeviceStatus(&uComponentStatus);
     1059            if (hrc == S_OK)
    10631060            {
    10641061                if (uComponentStatus == 0)
    10651062                {
    10661063                    LPWSTR pId;
    1067                     hr = pMpNcc->GetId(&pId);
    1068                     Assert(hr == S_OK);
    1069                     if (hr == S_OK)
     1064                    hrc = pMpNcc->GetId(&pId);
     1065                    Assert(hrc == S_OK);
     1066                    if (hrc == S_OK)
    10701067                    {
    10711068                        LogFunc(("id = %ls\n", pId));
    10721069                        if (!_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
    1073                         {
    10741070                            vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_HostOnly, -1);
    1075                         }
    10761071                        CoTaskMemFree(pId);
    10771072                    }
    10781073                    else
    1079                         LogRelFunc(("failed to get device id (0x%x)\n", hr));
     1074                        LogRelFunc(("failed to get device id (0x%x)\n", hrc));
    10801075                }
    10811076            }
    10821077            else
    1083                 LogRelFunc(("failed to get device status (0x%x)\n", hr));
     1078                LogRelFunc(("failed to get device status (0x%x)\n", hrc));
    10841079            pMpNcc->Release();
    10851080        }
    1086         Assert(hr == S_OK || hr == S_FALSE);
     1081        Assert(hrc == S_OK || hrc == S_FALSE);
    10871082
    10881083        pEnumComponent->Release();
    10891084    }
    10901085    else
    1091         LogRelFunc(("EnumComponents error (0x%x)\n", hr));
     1086        LogRelFunc(("EnumComponents error (0x%x)\n", hrc));
    10921087#endif /* #  if defined VBOX_WITH_NETFLT */
    10931088    return VINF_SUCCESS;
     
    11001095#else
    11011096    Bstr name;
    1102     HRESULT hr = pIf->COMGETTER(Name)(name.asOutParam());
    1103     if (hr == S_OK)
     1097    HRESULT hrc = pIf->COMGETTER(Name)(name.asOutParam());
     1098    if (hrc == S_OK)
    11041099    {
    11051100        Bstr                IfGuid;
    1106         hr = pIf->COMGETTER(Id)(IfGuid.asOutParam());
    1107         Assert(hr == S_OK);
    1108         if (hr == S_OK)
     1101        hrc = pIf->COMGETTER(Id)(IfGuid.asOutParam());
     1102        Assert(hrc == S_OK);
     1103        if (hrc == S_OK)
    11091104        {
    11101105            memset(pInfo, 0, sizeof(NETIFINFO));
     
    14831478static int netIfGetUnboundHostOnlyAdapters(INetCfg *pNetCfg, std::list<BoundAdapter> &adapters)
    14841479{
    1485     INetCfgComponent     *pMiniport;
    1486     HRESULT              hr;
    1487     IEnumNetCfgComponent  *pEnumComponent;
    1488 
    1489     if ((hr = pNetCfg->EnumComponents(&GUID_DEVCLASS_NET, &pEnumComponent)) != S_OK)
    1490         LogRelFunc(("failed to enumerate network adapter components (0x%x)\n", hr));
     1480    IEnumNetCfgComponent *pEnumComponent;
     1481    HRESULT hrc = pNetCfg->EnumComponents(&GUID_DEVCLASS_NET, &pEnumComponent);
     1482    if (hrc != S_OK)
     1483        LogRelFunc(("failed to enumerate network adapter components (0x%x)\n", hrc));
    14911484    else
    14921485    {
    1493         while ((hr = pEnumComponent->Next(1, &pMiniport, NULL)) == S_OK)
     1486        INetCfgComponent *pMiniport;
     1487        while ((hrc = pEnumComponent->Next(1, &pMiniport, NULL)) == S_OK)
    14941488        {
    14951489            GUID guid;
     
    14971491            struct BoundAdapter adapter;
    14981492            memset(&adapter, 0, sizeof(adapter));
    1499             if ((hr = pMiniport->GetDisplayName(&adapter.pName)) != S_OK)
    1500                 LogRelFunc(("failed to get device display name (0x%x)\n", hr));
    1501             else if ((hr = pMiniport->GetDeviceStatus(&uComponentStatus)) != S_OK)
    1502                 netIfLog(("failed to get device status (0x%x)\n", hr));
     1493            if ((hrc = pMiniport->GetDisplayName(&adapter.pName)) != S_OK)
     1494                LogRelFunc(("failed to get device display name (0x%x)\n", hrc));
     1495            else if ((hrc = pMiniport->GetDeviceStatus(&uComponentStatus)) != S_OK)
     1496                netIfLog(("failed to get device status (0x%x)\n", hrc));
    15031497            else if (uComponentStatus != 0)
    15041498                netIfLog(("wrong device status (0x%x)\n", uComponentStatus));
    1505             else if ((hr = pMiniport->GetId(&adapter.pHwId)) != S_OK)
    1506                 LogRelFunc(("failed to get device id (0x%x)\n", hr));
     1499            else if ((hrc = pMiniport->GetId(&adapter.pHwId)) != S_OK)
     1500                LogRelFunc(("failed to get device id (0x%x)\n", hrc));
    15071501            else if (_wcsnicmp(adapter.pHwId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
    15081502                netIfLog(("not host-only id = %ls, ignored\n", adapter.pHwId));
    1509             else if ((hr = pMiniport->GetInstanceGuid(&guid)) != S_OK)
    1510                 LogRelFunc(("failed to get instance id (0x%x)\n", hr));
     1503            else if ((hrc = pMiniport->GetInstanceGuid(&guid)) != S_OK)
     1504                LogRelFunc(("failed to get instance id (0x%x)\n", hrc));
    15111505            else
    15121506            {
     
    15221516            pMiniport->Release();
    15231517        }
    1524         Assert(hr == S_OK || hr == S_FALSE);
     1518        Assert(hrc == S_OK || hrc == S_FALSE);
    15251519
    15261520        pEnumComponent->Release();
     
    16061600static HRESULT netIfGetBoundAdapters(std::list<BoundAdapter> &boundAdapters)
    16071601{
    1608     INetCfg              *pNetCfg = NULL;
    1609     INetCfgComponent     *pFilter;
    1610     LPWSTR               lpszApp;
    1611     HRESULT              hr;
    16121602
    16131603    netIfLog(("building the list of interfaces\n"));
    16141604    /* we are using the INetCfg API for getting the list of miniports */
    1615     hr = VBoxNetCfgWinQueryINetCfg(&pNetCfg, FALSE,
    1616                        VBOX_APP_NAME,
    1617                        10000,
    1618                        &lpszApp);
    1619     Assert(hr == S_OK);
    1620     if (hr != S_OK)
    1621     {
    1622         LogRelFunc(("failed to query INetCfg (0x%x)\n", hr));
    1623         return hr;
    1624     }
    1625 
    1626     if ((hr = pNetCfg->FindComponent(L"oracle_VBoxNetLwf", &pFilter)) != S_OK
     1605    INetCfg  *pNetCfg = NULL;
     1606    LPWSTR    lpszApp = NULL;
     1607    HRESULT hrc = VBoxNetCfgWinQueryINetCfg(&pNetCfg, FALSE, VBOX_APP_NAME, 10000, &lpszApp);
     1608    Assert(hrc == S_OK);
     1609    if (hrc != S_OK)
     1610    {
     1611        LogRelFunc(("failed to query INetCfg (0x%x)\n", hrc));
     1612        return hrc;
     1613    }
     1614
     1615    INetCfgComponent *pFilter;
     1616    if ((hrc = pNetCfg->FindComponent(L"oracle_VBoxNetLwf", &pFilter)) != S_OK
    16271617        /* fall back to NDIS5 miniport lookup */
    1628         && (hr = pNetCfg->FindComponent(L"sun_VBoxNetFlt", &pFilter)))
    1629         LogRelFunc(("could not find either 'oracle_VBoxNetLwf' or 'sun_VBoxNetFlt' components (0x%x)\n", hr));
     1618        && (hrc = pNetCfg->FindComponent(L"sun_VBoxNetFlt", &pFilter)))
     1619        LogRelFunc(("could not find either 'oracle_VBoxNetLwf' or 'sun_VBoxNetFlt' components (0x%x)\n", hrc));
    16301620    else
    16311621    {
    16321622        INetCfgComponentBindings *pFilterBindings;
    16331623        if ((pFilter->QueryInterface(IID_INetCfgComponentBindings, (PVOID*)&pFilterBindings)) != S_OK)
    1634             LogRelFunc(("failed to query INetCfgComponentBindings (0x%x)\n", hr));
     1624            LogRelFunc(("failed to query INetCfgComponentBindings (0x%x)\n", hrc));
    16351625        else
    16361626        {
     
    16381628            INetCfgBindingPath     *pBp;
    16391629            if ((pFilterBindings->EnumBindingPaths(EBP_BELOW, &pEnumBp)) != S_OK)
    1640                 LogRelFunc(("failed to enumerate binding paths (0x%x)\n", hr));
     1630                LogRelFunc(("failed to enumerate binding paths (0x%x)\n", hrc));
    16411631            else
    16421632            {
    16431633                pEnumBp->Reset();
    1644                 while ((hr = pEnumBp->Next(1, &pBp, NULL)) == S_OK)
     1634                while ((hrc = pEnumBp->Next(1, &pBp, NULL)) == S_OK)
    16451635                {
    16461636                    IEnumNetCfgBindingInterface *pEnumBi;
     
    16491639                    {
    16501640                        /** @todo some id of disabled path could be useful. */
    1651                         netIfLog(("INetCfgBindingPath is disabled (0x%x)\n", hr));
     1641                        netIfLog(("INetCfgBindingPath is disabled (0x%x)\n", hrc));
    16521642                        pBp->Release();
    16531643                        continue;
    16541644                    }
    16551645                    if ((pBp->EnumBindingInterfaces(&pEnumBi)) != S_OK)
    1656                         LogRelFunc(("failed to enumerate binding interfaces (0x%x)\n", hr));
     1646                        LogRelFunc(("failed to enumerate binding interfaces (0x%x)\n", hrc));
    16571647                    else
    16581648                    {
    1659                         hr = pEnumBi->Reset();
    1660                         while ((hr = pEnumBi->Next(1, &pBi, NULL)) == S_OK)
     1649                        hrc = pEnumBi->Reset();
     1650                        while ((hrc = pEnumBi->Next(1, &pBi, NULL)) == S_OK)
    16611651                        {
    16621652                            INetCfgComponent *pAdapter;
    1663                             if ((hr = pBi->GetLowerComponent(&pAdapter)) != S_OK)
    1664                                 LogRelFunc(("failed to get lower component (0x%x)\n", hr));
     1653                            if ((hrc = pBi->GetLowerComponent(&pAdapter)) != S_OK)
     1654                                LogRelFunc(("failed to get lower component (0x%x)\n", hrc));
    16651655                            else
    16661656                            {
    16671657                                LPWSTR pwszName = NULL;
    1668                                 if ((hr = pAdapter->GetDisplayName(&pwszName)) != S_OK)
    1669                                     LogRelFunc(("failed to get display name (0x%x)\n", hr));
     1658                                if ((hrc = pAdapter->GetDisplayName(&pwszName)) != S_OK)
     1659                                    LogRelFunc(("failed to get display name (0x%x)\n", hrc));
    16701660                                else
    16711661                                {
    16721662                                    ULONG uStatus;
    16731663                                    DWORD dwChars;
    1674                                     if ((hr = pAdapter->GetDeviceStatus(&uStatus)) != S_OK)
     1664                                    if ((hrc = pAdapter->GetDeviceStatus(&uStatus)) != S_OK)
    16751665                                        netIfLog(("%ls: failed to get device status (0x%x)\n",
    1676                                                   pwszName, hr));
    1677                                     else if ((hr = pAdapter->GetCharacteristics(&dwChars)) != S_OK)
     1666                                                  pwszName, hrc));
     1667                                    else if ((hrc = pAdapter->GetCharacteristics(&dwChars)) != S_OK)
    16781668                                        netIfLog(("%ls: failed to get device characteristics (0x%x)\n",
    1679                                                   pwszName, hr));
     1669                                                  pwszName, hrc));
    16801670                                    else if (uStatus != 0)
    16811671                                        netIfLog(("%ls: wrong status 0x%x\n",
     
    16881678                                        GUID guid;
    16891679                                        LPWSTR pwszHwId = NULL;
    1690                                         if ((hr = pAdapter->GetId(&pwszHwId)) != S_OK)
     1680                                        if ((hrc = pAdapter->GetId(&pwszHwId)) != S_OK)
    16911681                                            LogRelFunc(("%ls: failed to get hardware id (0x%x)\n",
    1692                                                       pwszName, hr));
     1682                                                      pwszName, hrc));
    16931683                                        else if (!_wcsnicmp(pwszHwId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
    16941684                                            netIfLog(("host-only adapter %ls, ignored\n", pwszName));
    1695                                         else if ((hr = pAdapter->GetInstanceGuid(&guid)) != S_OK)
     1685                                        else if ((hrc = pAdapter->GetInstanceGuid(&guid)) != S_OK)
    16961686                                            LogRelFunc(("%ls: failed to get instance GUID (0x%x)\n",
    1697                                                       pwszName, hr));
     1687                                                      pwszName, hrc));
    16981688                                        else
    16991689                                        {
     
    18941884int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
    18951885{
    1896     HRESULT hr = S_OK;
    18971886    int iDefault = getDefaultInterfaceIndex();
    18981887    /* MSDN recommends to pre-allocate a 15KB buffer. */
     
    19111900        dwRc = GetAdaptersAddresses(AF_UNSPEC, NETIF_GAA_FLAGS, NULL, pAddresses, &uBufLen);
    19121901    }
     1902    HRESULT hrc;
    19131903    if (dwRc != NO_ERROR)
    19141904    {
    19151905        LogRelFunc(("GetAdaptersAddresses failed (0x%x)\n", dwRc));
    1916         hr = HRESULT_FROM_WIN32(dwRc);
     1906        hrc = HRESULT_FROM_WIN32(dwRc);
    19171907    }
    19181908    else
    19191909    {
    19201910        std::list<BoundAdapter> boundAdapters;
    1921         hr = netIfGetBoundAdapters(boundAdapters);
     1911        hrc = netIfGetBoundAdapters(boundAdapters);
    19221912#if 0
    1923         if (hr != S_OK)
    1924             hr = netIfGetBoundAdaptersFallback(boundAdapters);
     1913        if (hrc != S_OK)
     1914            hrc = netIfGetBoundAdaptersFallback(boundAdapters);
    19251915#endif
    1926         if (hr != S_OK)
    1927             LogRelFunc(("netIfGetBoundAdapters failed (0x%x)\n", hr));
     1916        if (hrc != S_OK)
     1917            LogRelFunc(("netIfGetBoundAdapters failed (0x%x)\n", hrc));
    19281918        else
    19291919        {
     
    20081998    RTMemFree(pAddresses);
    20091999
    2010     return hr;
    2011 }
     2000    return hrc;
     2001}
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