Changeset 98293 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 25, 2023 1:22:39 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155498
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDnsServiceResolvConf.cpp
r98288 r98293 76 76 HRESULT HostDnsServiceResolvConf::init(HostDnsMonitorProxy *pProxy, const char *aResolvConfFileName) 77 77 { 78 HRESULT hr = HostDnsServiceBase::init(pProxy);79 AssertComRCReturn(hr , hr);78 HRESULT hrc = HostDnsServiceBase::init(pProxy); 79 AssertComRCReturn(hrc, hrc); 80 80 81 81 m = new Data(aResolvConfFileName); -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r98292 r98293 632 632 INetCfgComponent *pncc) 633 633 { 634 LPWSTR lpszName;635 GUID IfGuid;636 HRESULT hr;637 634 int vrc = VERR_GENERAL_FAILURE; 638 635 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) 642 640 { 643 641 Bstr name((CBSTR)lpszName); 644 642 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) 648 647 { 649 648 /* create a new object and add it to the list */ … … 873 872 # elif defined RT_OS_WINDOWS 874 873 # ifndef VBOX_WITH_NETFLT 875 hr = E_NOTIMPL;874 hrc = E_NOTIMPL; 876 875 # else /* # if defined VBOX_WITH_NETFLT */ 877 876 INetCfg *pNc; … … 879 878 INetCfgComponent *pTcpIpNcc; 880 879 LPWSTR lpszApp; 881 HRESULT hr ;880 HRESULT hrc; 882 881 IEnumNetCfgBindingPath *pEnumBp; 883 882 INetCfgBindingPath *pBp; … … 886 885 887 886 /* 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) 894 890 { 895 891 # ifdef VBOX_NETFLT_ONDEMAND_BIND 896 892 /* 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); 898 894 # else 899 895 /* 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) 902 898 { 903 899 /* fall back to NDIS5 miniport lookup (sun_VBoxNetFlt) */ 904 hr = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);900 hrc = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc); 905 901 } 906 902 # ifndef VBOX_WITH_HARDENING 907 if (hr != S_OK)903 if (hrc != S_OK) 908 904 { 909 905 /** @todo try to install the netflt from here */ … … 913 909 # endif 914 910 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) 920 916 { 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) 924 920 { 925 921 /* S_OK == enabled, S_FALSE == disabled */ 926 922 if (pBp->IsEnabled() == S_OK) 927 923 { 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) 931 927 { 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) 935 931 { 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) 939 935 { 940 936 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) 944 940 { 945 941 if (uComponentStatus == 0) 946 {947 942 vboxNetWinAddComponent(&list, pMpNcc); 948 }949 943 } 950 944 VBoxNetCfgWinReleaseRef(pMpNcc); … … 952 946 VBoxNetCfgWinReleaseRef(pBi); 953 947 954 hr = VBoxNetCfgWinGetNextBindingInterface(pEnumBi, &pBi);948 hrc = VBoxNetCfgWinGetNextBindingInterface(pEnumBi, &pBi); 955 949 } 956 950 VBoxNetCfgWinReleaseRef(pEnumBi); … … 959 953 VBoxNetCfgWinReleaseRef(pBp); 960 954 961 hr = VBoxNetCfgWinGetNextBindingPath(pEnumBp, &pBp);955 hrc = VBoxNetCfgWinGetNextBindingPath(pEnumBp, &pBp); 962 956 } 963 957 VBoxNetCfgWinReleaseRef(pEnumBp); … … 967 961 else 968 962 { 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)); 970 964 } 971 965 … … 1884 1878 { 1885 1879 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; 1889 1883 1890 1884 if (t == aType) -
trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
r98288 r98293 102 102 { 103 103 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)) 109 109 pList->push_back(obj); 110 110 } 111 return hr ;111 return hrc; 112 112 } 113 113 … … 119 119 { 120 120 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; 125 125 return VERR_NOT_SUPPORTED; 126 126 } … … 195 195 static HRESULT fillDeviceList(VirtualBox *pVirtualBox, HostVideoInputDeviceList *pList) 196 196 { 197 HRESULT hr;198 197 Utf8Str strLibrary; 199 200 198 #ifdef VBOX_WITH_EXTPACK 201 199 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); 203 201 #else 204 hr= E_NOTIMPL;205 #endif 206 207 if (SUCCEEDED(hr ))202 HRESULT hrc = E_NOTIMPL; 203 #endif 204 205 if (SUCCEEDED(hrc)) 208 206 { 209 207 PFNVBOXHOSTWEBCAMLIST pfn = NULL; … … 223 221 Log(("VBoxHostWebcamList vrc %Rrc, result 0x%08RX64\n", vrc, u64Result)); 224 222 if (RT_FAILURE(vrc)) 225 { 226 hr = (HRESULT)u64Result; 227 } 223 hrc = (HRESULT)u64Result; 228 224 229 225 RTLdrClose(hmod); … … 231 227 } 232 228 233 if (SUCCEEDED(hr ))229 if (SUCCEEDED(hrc)) 234 230 { 235 231 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; 242 238 } 243 239 244 240 /* static */ HRESULT HostVideoInputDevice::queryHostDevices(VirtualBox *pVirtualBox, HostVideoInputDeviceList *pList) 245 241 { 246 HRESULT hr = fillDeviceList(pVirtualBox, pList); 247 248 if (FAILED(hr)) 249 { 242 HRESULT hrc = fillDeviceList(pVirtualBox, pList); 243 if (FAILED(hrc)) 250 244 pList->clear(); 251 } 252 253 return hr; 245 return hrc; 254 246 } 255 247 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r98292 r98293 6608 6608 vrc); 6609 6609 6610 HRESULT hr = S_OK;6610 HRESULT hrc = S_OK; 6611 6611 6612 6612 *aWidth = u32Width; … … 6662 6662 } 6663 6663 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); 6667 6665 6668 6666 RTMemFree(pu8PNG); … … 6672 6670 freeSavedDisplayScreenshot(pu8Data); 6673 6671 6674 return hr ;6672 return hrc; 6675 6673 } 6676 6674 … … 14326 14324 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 14327 14325 14328 HRESULT hr = S_OK;14326 HRESULT hrc = S_OK; 14329 14327 14330 14328 if (!mAuthLibCtx.hAuthLibrary) … … 14338 14336 int vrc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 14339 14337 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); 14343 14341 } 14344 14342 … … 14346 14344 alock.release(); 14347 14345 14348 if (FAILED(hr ))14349 return hr ;14346 if (FAILED(hrc)) 14347 return hrc; 14350 14348 14351 14349 if (aAuthParams[0] == "VRDEAUTH" && aAuthParams.size() == 7) … … 14404 14402 else 14405 14403 { 14406 hr = E_INVALIDARG;14407 } 14408 14409 return hr ;14404 hrc = E_INVALIDARG; 14405 } 14406 14407 return hrc; 14410 14408 } 14411 14409 -
trunk/src/VBox/Main/src-server/UpdateAgentImpl.cpp
r98292 r98293 341 341 unconst(m_VirtualBox) = aVirtualBox; 342 342 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; 348 348 } 349 349 … … 902 902 m->strRepoUrl = "https://update.virtualbox.org"; 903 903 904 HRESULT hr = UpdateAgent::init(aVirtualBox);905 if (SUCCEEDED(hr ))904 HRESULT hrc = UpdateAgent::init(aVirtualBox); 905 if (SUCCEEDED(hrc)) 906 906 autoInitSpan.setSucceeded(); 907 907 908 return hr ;908 return hrc; 909 909 } 910 910 -
trunk/src/VBox/Main/src-server/win/NetIf-win.cpp
r98292 r98293 218 218 219 219 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) 222 222 { 223 223 if (Settings.ip) … … 983 983 int iDefaultInterface) 984 984 { 985 LPWSTR lpszName;986 GUID IfGuid;987 HRESULT hr;988 985 int vrc = VERR_GENERAL_FAILURE; 989 986 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) 993 991 { 994 992 Bstr name(lpszName); 995 993 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) 999 998 { 1000 999 Guid guidIfCopy(IfGuid); … … 1025 1024 } 1026 1025 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)); 1028 1027 CoTaskMemFree(lpszName); 1029 1028 } 1030 1029 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)); 1032 1031 1033 1032 return vrc; … … 1043 1042 return VERR_NOT_IMPLEMENTED; 1044 1043 #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) 1053 1050 { 1054 1051 LPWSTR pwszName; 1055 1052 ULONG uComponentStatus; 1056 hr = pMpNcc->GetDisplayName(&pwszName);1057 if (hr == S_OK)1053 hrc = pMpNcc->GetDisplayName(&pwszName); 1054 if (hrc == S_OK) 1058 1055 LogFunc(("%ls\n", pwszName)); 1059 1056 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) 1063 1060 { 1064 1061 if (uComponentStatus == 0) 1065 1062 { 1066 1063 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) 1070 1067 { 1071 1068 LogFunc(("id = %ls\n", pId)); 1072 1069 if (!_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2)) 1073 {1074 1070 vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_HostOnly, -1); 1075 }1076 1071 CoTaskMemFree(pId); 1077 1072 } 1078 1073 else 1079 LogRelFunc(("failed to get device id (0x%x)\n", hr ));1074 LogRelFunc(("failed to get device id (0x%x)\n", hrc)); 1080 1075 } 1081 1076 } 1082 1077 else 1083 LogRelFunc(("failed to get device status (0x%x)\n", hr ));1078 LogRelFunc(("failed to get device status (0x%x)\n", hrc)); 1084 1079 pMpNcc->Release(); 1085 1080 } 1086 Assert(hr == S_OK || hr== S_FALSE);1081 Assert(hrc == S_OK || hrc == S_FALSE); 1087 1082 1088 1083 pEnumComponent->Release(); 1089 1084 } 1090 1085 else 1091 LogRelFunc(("EnumComponents error (0x%x)\n", hr ));1086 LogRelFunc(("EnumComponents error (0x%x)\n", hrc)); 1092 1087 #endif /* # if defined VBOX_WITH_NETFLT */ 1093 1088 return VINF_SUCCESS; … … 1100 1095 #else 1101 1096 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) 1104 1099 { 1105 1100 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) 1109 1104 { 1110 1105 memset(pInfo, 0, sizeof(NETIFINFO)); … … 1483 1478 static int netIfGetUnboundHostOnlyAdapters(INetCfg *pNetCfg, std::list<BoundAdapter> &adapters) 1484 1479 { 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)); 1491 1484 else 1492 1485 { 1493 while ((hr = pEnumComponent->Next(1, &pMiniport, NULL)) == S_OK) 1486 INetCfgComponent *pMiniport; 1487 while ((hrc = pEnumComponent->Next(1, &pMiniport, NULL)) == S_OK) 1494 1488 { 1495 1489 GUID guid; … … 1497 1491 struct BoundAdapter adapter; 1498 1492 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)); 1503 1497 else if (uComponentStatus != 0) 1504 1498 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)); 1507 1501 else if (_wcsnicmp(adapter.pHwId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2)) 1508 1502 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)); 1511 1505 else 1512 1506 { … … 1522 1516 pMiniport->Release(); 1523 1517 } 1524 Assert(hr == S_OK || hr== S_FALSE);1518 Assert(hrc == S_OK || hrc == S_FALSE); 1525 1519 1526 1520 pEnumComponent->Release(); … … 1606 1600 static HRESULT netIfGetBoundAdapters(std::list<BoundAdapter> &boundAdapters) 1607 1601 { 1608 INetCfg *pNetCfg = NULL;1609 INetCfgComponent *pFilter;1610 LPWSTR lpszApp;1611 HRESULT hr;1612 1602 1613 1603 netIfLog(("building the list of interfaces\n")); 1614 1604 /* 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_OK1605 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 1627 1617 /* 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)); 1630 1620 else 1631 1621 { 1632 1622 INetCfgComponentBindings *pFilterBindings; 1633 1623 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)); 1635 1625 else 1636 1626 { … … 1638 1628 INetCfgBindingPath *pBp; 1639 1629 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)); 1641 1631 else 1642 1632 { 1643 1633 pEnumBp->Reset(); 1644 while ((hr = pEnumBp->Next(1, &pBp, NULL)) == S_OK)1634 while ((hrc = pEnumBp->Next(1, &pBp, NULL)) == S_OK) 1645 1635 { 1646 1636 IEnumNetCfgBindingInterface *pEnumBi; … … 1649 1639 { 1650 1640 /** @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)); 1652 1642 pBp->Release(); 1653 1643 continue; 1654 1644 } 1655 1645 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)); 1657 1647 else 1658 1648 { 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) 1661 1651 { 1662 1652 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)); 1665 1655 else 1666 1656 { 1667 1657 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)); 1670 1660 else 1671 1661 { 1672 1662 ULONG uStatus; 1673 1663 DWORD dwChars; 1674 if ((hr = pAdapter->GetDeviceStatus(&uStatus)) != S_OK)1664 if ((hrc = pAdapter->GetDeviceStatus(&uStatus)) != S_OK) 1675 1665 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) 1678 1668 netIfLog(("%ls: failed to get device characteristics (0x%x)\n", 1679 pwszName, hr ));1669 pwszName, hrc)); 1680 1670 else if (uStatus != 0) 1681 1671 netIfLog(("%ls: wrong status 0x%x\n", … … 1688 1678 GUID guid; 1689 1679 LPWSTR pwszHwId = NULL; 1690 if ((hr = pAdapter->GetId(&pwszHwId)) != S_OK)1680 if ((hrc = pAdapter->GetId(&pwszHwId)) != S_OK) 1691 1681 LogRelFunc(("%ls: failed to get hardware id (0x%x)\n", 1692 pwszName, hr ));1682 pwszName, hrc)); 1693 1683 else if (!_wcsnicmp(pwszHwId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2)) 1694 1684 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) 1696 1686 LogRelFunc(("%ls: failed to get instance GUID (0x%x)\n", 1697 pwszName, hr ));1687 pwszName, hrc)); 1698 1688 else 1699 1689 { … … 1894 1884 int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list) 1895 1885 { 1896 HRESULT hr = S_OK;1897 1886 int iDefault = getDefaultInterfaceIndex(); 1898 1887 /* MSDN recommends to pre-allocate a 15KB buffer. */ … … 1911 1900 dwRc = GetAdaptersAddresses(AF_UNSPEC, NETIF_GAA_FLAGS, NULL, pAddresses, &uBufLen); 1912 1901 } 1902 HRESULT hrc; 1913 1903 if (dwRc != NO_ERROR) 1914 1904 { 1915 1905 LogRelFunc(("GetAdaptersAddresses failed (0x%x)\n", dwRc)); 1916 hr = HRESULT_FROM_WIN32(dwRc);1906 hrc = HRESULT_FROM_WIN32(dwRc); 1917 1907 } 1918 1908 else 1919 1909 { 1920 1910 std::list<BoundAdapter> boundAdapters; 1921 hr = netIfGetBoundAdapters(boundAdapters);1911 hrc = netIfGetBoundAdapters(boundAdapters); 1922 1912 #if 0 1923 if (hr != S_OK)1924 hr = netIfGetBoundAdaptersFallback(boundAdapters);1913 if (hrc != S_OK) 1914 hrc = netIfGetBoundAdaptersFallback(boundAdapters); 1925 1915 #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)); 1928 1918 else 1929 1919 { … … 2008 1998 RTMemFree(pAddresses); 2009 1999 2010 return hr ;2011 } 2000 return hrc; 2001 }
Note:
See TracChangeset
for help on using the changeset viewer.