VirtualBox

Changeset 16967 in vbox


Ignore:
Timestamp:
Feb 20, 2009 10:03:55 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43133
Message:

NetAdp: added a Real property to the IHostNetworkInterface, make the interface name be honored in VM settings

Location:
trunk/src/VBox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r16858 r16967  
    10381038# endif
    10391039
    1040         if (OpenReq.enmTrunkType == kIntNetTrunkType_NetFlt)
    1041         {
    1042             /*
    1043              * <Describe what this does here or/and in the function docs of drvIntNetWinIfGuidToBindName>.
    1044              */
    1045             char szBindName[INTNET_MAX_TRUNK_NAME];
    1046             rc = drvIntNetWinIfGuidToBindName(OpenReq.szTrunk, szBindName, INTNET_MAX_TRUNK_NAME);
    1047             AssertLogRelMsgRCReturn(rc, ("drvIntNetWinIfGuidToBindName failed, rc=%Rrc", rc), rc);
    1048             strcpy(OpenReq.szTrunk, szBindName);
    1049         }
    1050         else
    1051         {
    1052             strcpy(OpenReq.szTrunk, "dummy name");
    1053         }
     1040        /*
     1041         * <Describe what this does here or/and in the function docs of drvIntNetWinIfGuidToBindName>.
     1042         */
     1043        char szBindName[INTNET_MAX_TRUNK_NAME];
     1044        rc = drvIntNetWinIfGuidToBindName(OpenReq.szTrunk, szBindName, INTNET_MAX_TRUNK_NAME);
     1045        AssertLogRelMsgRCReturn(rc, ("drvIntNetWinIfGuidToBindName failed, rc=%Rrc", rc), rc);
     1046        strcpy(OpenReq.szTrunk, szBindName);
    10541047    }
    10551048#endif /* WINDOWS && NETFLT */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp

    r16927 r16967  
    156156    mAdapter.SetCableConnected (mCbCable->isChecked());
    157157
    158     if (type == KNetworkAttachmentType_HostInterface)
     158    if (type == KNetworkAttachmentType_HostInterface
     159#if defined (Q_WS_WIN) && defined (VBOX_WITH_NETFLT)
     160            || type == KNetworkAttachmentType_HostOnly
     161#endif
     162            )
    159163    {
    160164#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
     
    715719    /* Load current inner list */
    716720    QList<QTreeWidgetItem*> itemsList;
    717     CHostNetworkInterfaceVector interfaces =
    718 #if defined(Q_WS_WIN) && defined(VBOX_WITH_NETFLT)
    719             enmAttachmentType == KNetworkAttachmentType_HostOnly ?
    720                     vboxGlobal().virtualBox().GetHost().GetTapInterfaces()
    721                     :
    722 #endif
    723                     vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces();
     721    CHostNetworkInterfaceVector interfaces = vboxGlobal().virtualBox().GetHost().GetNetworkInterfaces();
    724722    for (CHostNetworkInterfaceVector::ConstIterator it = interfaces.begin();
    725723         it != interfaces.end(); ++it)
    726         itemsList << new VBoxNIListItem (it->GetName());
     724    {
     725#if defined(Q_WS_WIN) && defined(VBOX_WITH_NETFLT)
     726        /* display real for not host-only and viceversa */
     727        if((enmAttachmentType == KNetworkAttachmentType_HostOnly) != it->GetReal())
     728#endif
     729            itemsList << new VBoxNIListItem (it->GetName());
     730    }
    727731
    728732    /* Save current list item name */
     
    855859
    856860#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
    857         if (type == KNetworkAttachmentType_HostInterface &&
    858             page->interfaceName().isNull())
     861        if ((type == KNetworkAttachmentType_HostInterface
     862#if defined (Q_WS_WIN) && defined (VBOX_WITH_NETFLT)
     863                || type == KNetworkAttachmentType_HostOnly
     864#endif
     865                ) && page->interfaceName().isNull())
    859866        {
    860867            valid = false;
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r16960 r16967  
    13701370                                          N_("Inexistent host networking interface, name '%ls'"),
    13711371                                          HifName.raw());
     1372                    }
     1373
     1374                    BOOL real;
     1375                    hrc = hostInterface->COMGETTER(Real)(&real);
     1376                    if(FAILED(hrc))
     1377                    {
     1378                        LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1379                        H();
     1380                    }
     1381
     1382                    if(!real)
     1383                    {
     1384                        LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1385                        return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
     1386                                                              N_("Interface ('%ls') is a Host Adapter interface"),
     1387                                                              HifName.raw());
    13721388                    }
    13731389
     
    16371653                rc = CFGMR3InsertString(pLunL0, "Driver", "IntNet");            RC_CHECK();
    16381654                rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);                 RC_CHECK();
     1655#if defined(RT_OS_WINDOWS)
     1656                Bstr HifName;
     1657                hrc = networkAdapter->COMGETTER(HostInterface)(HifName.asOutParam());
     1658                if(FAILED(hrc))
     1659                {
     1660                    LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(HostInterface) failed, hrc (0x%x)", hrc));
     1661                    H();
     1662                }
     1663
     1664                Utf8Str HifNameUtf8(HifName);
     1665                const char *pszHifName = HifNameUtf8.raw();
     1666                ComPtr<IHostNetworkInterface> hostInterface;
     1667                rc = host->FindHostNetworkInterfaceByName(HifName, hostInterface.asOutParam());
     1668                if (!SUCCEEDED(rc))
     1669                {
     1670                    AssertBreakpoint();
     1671                    LogRel(("NetworkAttachmentType_HostOnly: FindByName failed, rc (0x%x)", rc));
     1672                    return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
     1673                                      N_("Inexistent host networking interface, name '%ls'"),
     1674                                      HifName.raw());
     1675                }
     1676
     1677                BOOL real;
     1678                hrc = hostInterface->COMGETTER(Real)(&real);
     1679                if(FAILED(hrc))
     1680                {
     1681                    LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1682                    H();
     1683                }
     1684
     1685                if(real)
     1686                {
     1687                    LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1688                    return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
     1689                                                          N_("Interface ('%ls') is not a Host Adapter interface"),
     1690                                                          HifName.raw());
     1691                }
     1692
     1693                Guid hostIFGuid;
     1694                hrc = hostInterface->COMGETTER(Id)(hostIFGuid.asOutParam());
     1695                if(FAILED(hrc))
     1696                {
     1697                    LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Id) failed, hrc (0x%x)", hrc));
     1698                    H();
     1699                }
     1700                char szDriverGUID[RTUUID_STR_LENGTH];
     1701                strcpy(szDriverGUID , hostIFGuid.toString().raw());
     1702                const char *pszTrunk = szDriverGUID;
     1703
     1704                /* TODO: set the proper Trunk and Network values, currently the driver uses the first adapter instance */
     1705                rc = CFGMR3InsertInteger(pCfg, "TrunkType", kIntNetTrunkType_NetAdp); RC_CHECK();
     1706                rc = CFGMR3InsertString(pCfg, "Trunk", pszTrunk);               RC_CHECK();
     1707                char szNetwork[80];
     1708                RTStrPrintf(szNetwork, sizeof(szNetwork), "HostInterfaceNetworking-%s", pszHifName);
     1709                rc = CFGMR3InsertString(pCfg, "Network", szNetwork);            RC_CHECK();
     1710#elif defined(RT_OS_DARWIN)
    16391711                rc = CFGMR3InsertString(pCfg, "Trunk", "vboxnet0");             RC_CHECK();
    16401712                rc = CFGMR3InsertString(pCfg, "Network", "HostInterfaceNetworking-vboxnet0"); RC_CHECK();
    1641 #if defined(RT_OS_WINDOWS) || defined(RT_OS_DARWIN)
    1642                 /* TODO: set the proper Trunk and Network values, currently the driver uses the first adapter instance */
    16431713                rc = CFGMR3InsertInteger(pCfg, "TrunkType", kIntNetTrunkType_NetAdp); RC_CHECK();
    16441714#else
     1715                rc = CFGMR3InsertString(pCfg, "Trunk", "vboxnet0");             RC_CHECK();
     1716                rc = CFGMR3InsertString(pCfg, "Network", "HostInterfaceNetworking-vboxnet0"); RC_CHECK();
    16451717                rc = CFGMR3InsertInteger(pCfg, "TrunkType", kIntNetTrunkType_NetFlt); RC_CHECK();
    16461718#endif
  • trunk/src/VBox/Main/HostImpl.cpp

    r16929 r16967  
    614614    ComObjPtr<HostNetworkInterface> IfObj;
    615615    IfObj.createObject();
    616     if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid))))
     616    if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid), true)))
    617617        pList->push_back(IfObj);
    618618}
     
    729729            iface.createObject();
    730730            /* remove the curly bracket at the end */
    731             if (SUCCEEDED (iface->init (name, Guid (IfGuid))))
     731            if (SUCCEEDED (iface->init (name, Guid (IfGuid), true)))
    732732            {
    733733                pPist->push_back (iface);
     
    744744    return rc;
    745745}
    746 
    747 STDMETHODIMP Host::COMGETTER(TapInterfaces) (ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces))
    748 {
    749     if (ComSafeArrayOutIsNull (aNetworkInterfaces))
    750         return E_POINTER;
    751 
    752     AutoWriteLock alock (this);
    753     CHECK_READY();
    754 
    755     std::list <ComObjPtr <HostNetworkInterface> > list;
    756 #ifdef VBOX_WITH_HOSTNETIF_API
    757     int rc = NetIfListTap(list);
    758     if (rc)
    759     {
    760         Log(("Failed to get host tap network interface list with rc=%Vrc\n", rc));
    761     }
    762 #else
    763 #endif
    764     SafeIfaceArray <IHostNetworkInterface> networkInterfaces (list);
    765     networkInterfaces.detachTo (ComSafeArrayOutArg (aNetworkInterfaces));
    766 
    767     return S_OK;
    768 }
    769 #else /* !defined(RT_OS_WINDOWS) || !defined(VBOX_WITH_NETFLT) */
    770 STDMETHODIMP Host::COMGETTER(TapInterfaces) (ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces))
    771 {
    772     return NS_ERROR_NOT_IMPLEMENTED;
    773 }
    774 #endif /* !defined(RT_OS_WINDOWS) && !defined(VBOX_WITH_NETFLT) */
    775 
     746#endif /* defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) */
    776747/**
    777748 * Returns a list of host network interfaces.
     
    804775        ComObjPtr<HostNetworkInterface> IfObj;
    805776        IfObj.createObject();
    806         if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), Guid(pEtherNICs->Uuid))))
     777        if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), Guid(pEtherNICs->Uuid), true)))
    807778            list.push_back(IfObj);
    808779
     
    959930                    /* remove the curly bracket at the end */
    960931                    szNetworkGUID [strlen(szNetworkGUID) - 1] = '\0';
    961                     if (SUCCEEDED (iface->init (name, Guid (szNetworkGUID + 1))))
     932                    if (SUCCEEDED (iface->init (name, Guid (szNetworkGUID + 1), true)))
    962933                        list.push_back (iface);
    963934                }
     
    10851056                        ComObjPtr<HostNetworkInterface> IfObj;
    10861057                        IfObj.createObject();
    1087                         if (SUCCEEDED(IfObj->init(Bstr(pReq->ifr_name), Guid(uuid))))
     1058                        if (SUCCEEDED(IfObj->init(Bstr(pReq->ifr_name), Guid(uuid), true)))
    10881059                            list.push_back(IfObj);
    10891060                    }
     
    30713042                        /* initialize the object returned to the caller by
    30723043                         * CreateHostNetworkInterface() */
    3073                         rc = d->iface->init (d->name, guid);
     3044                        rc = d->iface->init (d->name, guid, false);
    30743045                        endLoop = true;
    30753046                        break;
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r15511 r16967  
    5151 * @param   aGuid GUID of the host network interface
    5252 */
    53 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid)
     53HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, BOOL aReal)
    5454{
    5555    LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n",
     
    6565    unconst (mInterfaceName) = aInterfaceName;
    6666    unconst (mGuid) = aGuid;
     67    mReal = aReal;
     68
    6769
    6870    /* Confirm a successful initialization */
     
    110112 * @param   aGuid GUID of the host network interface
    111113 */
    112 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, PNETIFINFO pIf)
     114HRESULT HostNetworkInterface::init (Bstr aInterfaceName, BOOL aReal, PNETIFINFO pIf)
    113115{
    114116//    LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n",
     
    125127    unconst (mInterfaceName) = aInterfaceName;
    126128    unconst (mGuid) = pIf->Uuid;
     129    mReal = aReal;
     130
    127131    m.IPAddress = pIf->IPAddress.u;
    128132    m.networkMask = pIf->IPNetMask.u;
     
    311315}
    312316
     317/**
     318 * Returns true if this is a "real" adapter, false if this is  a Virtualbox Host Adapter
     319 *
     320 * @returns COM status code
     321 * @param   aReal address of result pointer
     322 */
     323STDMETHODIMP HostNetworkInterface::COMGETTER(Real) (BOOL *aReal)
     324{
     325    CheckComArgOutPointerValid(aReal);
     326
     327    AutoCaller autoCaller (this);
     328    CheckComRCReturnRC (autoCaller.rc());
     329
     330    *aReal = mReal;
     331
     332    return S_OK;
     333
     334}
     335
    313336/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/NetworkAdapterImpl.cpp

    r16560 r16967  
    943943    if (!(attachmentNode = aAdapterNode.findKey ("HostOnlyNetwork")).isNull())
    944944    {
     945#if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT)
     946        Bstr name = attachmentNode.stringValue ("name");
     947        /* name can be empty, but not null */
     948        ComAssertRet (!name.isNull(), E_FAIL);
     949
     950        rc = COMSETTER(HostInterface) (name);
     951        CheckComRCReturnRC (rc);
     952#endif
     953
    945954        /* Host Interface Networking */
    946955        rc = AttachToHostOnlyNetwork();
     
    10421051        {
    10431052            Key attachmentNode = aAdapterNode.createKey ("HostOnlyNetwork");
     1053#if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT)
     1054            Assert (!mData->mHostInterface.isNull());
     1055            attachmentNode.setValue <Bstr> ("name", mData->mHostInterface);
     1056#endif
    10441057            break;
    10451058        }
     
    12001213        case NetworkAttachmentType_HostOnly:
    12011214        {
     1215#if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT)
     1216            /* reset handle and device name */
     1217            mData->mHostInterface = "";
     1218#endif
    12021219            break;
    12031220        }
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r16966 r16967  
    64416441  <interface
    64426442     name="IHostNetworkInterface" extends="$unknown"
    6443      uuid="832720ac-2df6-41d4-a867-a0b40df14c7f"
     6443     uuid="4fc2445f-fb73-4f55-b3b4-ecee47c7077b"
    64446444     wsmap="managed"
    64456445     >
     
    64856485      <desc>Status of the interface.</desc>
    64866486    </attribute>
     6487   
     6488    <attribute name="real" type="boolean" readonly="yes">
     6489      <desc>True if this is a real interface false
     6490      if this is a Virtualbox Host Adapter interface.</desc>
     6491    </attribute>
    64876492  </interface>
    64886493
     
    65556560    <attribute name="networkInterfaces" type="IHostNetworkInterface" safearray="yes" readonly="yes">
    65566561      <desc>List of host network interfaces currently defined on the host.</desc>
    6557     </attribute>
    6558 
    6559     <attribute name="tapInterfaces" type="IHostNetworkInterface" safearray="yes" readonly="yes">
    6560       <desc>List of host tap interfaces currently defined on the host.</desc>
    65616562    </attribute>
    65626563
  • trunk/src/VBox/Main/include/HostImpl.h

    r16929 r16967  
    9898
    9999    // IHost methods
    100     STDMETHOD(COMGETTER(TapInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
    101100#ifdef RT_OS_WINDOWS
    102101
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r15570 r16967  
    6060
    6161    // public initializer/uninitializer for internal purposes only
    62     HRESULT init (Bstr interfaceName, Guid guid);
     62    HRESULT init (Bstr interfaceName, Guid guid, BOOL aReal);
    6363#ifdef VBOX_WITH_HOSTNETIF_API
    64     HRESULT init (Bstr aInterfaceName, struct NETIFINFO *pIfs);
     64    HRESULT init (Bstr aInterfaceName, BOOL aReal, struct NETIFINFO *pIfs);
    6565#endif
    6666
     
    7575    STDMETHOD(COMGETTER(Type)) (HostNetworkInterfaceType_T *aType);
    7676    STDMETHOD(COMGETTER(Status)) (HostNetworkInterfaceStatus_T *aStatus);
     77    STDMETHOD(COMGETTER(Real)) (BOOL *aReal);
    7778
    7879    // for VirtualBoxSupportErrorInfoImpl
     
    8283    const Bstr mInterfaceName;
    8384    const Guid mGuid;
     85    BOOL mReal;
     86
    8487    struct Data
    8588    {
    8689        Data() : IPAddress (0), networkMask (0),
    8790            type (HostNetworkInterfaceType_Unknown),
    88             status(HostNetworkInterfaceStatus_Down) {}
    89        
     91            status(HostNetworkInterfaceStatus_Down){}
     92
    9093        ULONG IPAddress;
    9194        ULONG networkMask;
  • trunk/src/VBox/Main/include/netif.h

    r16927 r16967  
    7777int NetIfList(std::list <ComObjPtr <HostNetworkInterface> > &list);
    7878
    79 #if defined(VBOX_WITH_NETFLT) && defined(RT_OS_WINDOWS)
    80 int NetIfListTap(std::list <ComObjPtr <HostNetworkInterface> > &list);
    8179#endif
    8280
    83 #endif
    84 
  • trunk/src/VBox/Main/win/NetIfList-win.cpp

    r16927 r16967  
    151151# define VBOX_APP_NAME L"VirtualBox"
    152152
    153 static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc)
     153static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, bool bReal)
    154154{
    155155    LPWSTR              lpszName;
     
    183183            iface.createObject();
    184184            /* remove the curly bracket at the end */
    185             if (SUCCEEDED (iface->init (name, &Info)))
     185            if (SUCCEEDED (iface->init (name, bReal, &Info)))
    186186            {
    187187                pPist->push_back (iface);
     
    268268}
    269269#endif /* #ifndef VBOX_WITH_NETFLT */
     270
     271
     272static int NetIfListHostAdapters(std::list <ComObjPtr <HostNetworkInterface> > &list)
     273{
     274#ifndef VBOX_WITH_NETFLT
     275    /* VBoxNetAdp is available only when VBOX_WITH_NETFLT is enabled */
     276    return VERR_NOT_IMPLEMENTED;
     277#else /* #  if defined VBOX_WITH_NETFLT */
     278    INetCfg              *pNc;
     279    INetCfgComponent     *pMpNcc;
     280    LPWSTR               lpszApp = NULL;
     281    HRESULT              hr;
     282    IEnumNetCfgComponent  *pEnumComponent;
     283
     284    /* we are using the INetCfg API for getting the list of miniports */
     285    hr = VBoxNetCfgWinQueryINetCfg( FALSE,
     286                       VBOX_APP_NAME,
     287                       &pNc,
     288                       &lpszApp );
     289    Assert(hr == S_OK);
     290    if(hr == S_OK)
     291    {
     292        hr = VBoxNetCfgWinGetComponentEnum(pNc, &GUID_DEVCLASS_NET, &pEnumComponent);
     293        if(hr == S_OK)
     294        {
     295            while((hr = VBoxNetCfgWinGetNextComponent(pEnumComponent, &pMpNcc)) == S_OK)
     296            {
     297                ULONG uComponentStatus;
     298                hr = pMpNcc->GetDeviceStatus(&uComponentStatus);
     299#ifndef DEBUG_bird
     300                Assert(hr == S_OK);
     301#endif
     302                if(hr == S_OK)
     303                {
     304                    if(uComponentStatus == 0)
     305                    {
     306                        LPWSTR pId;
     307                        hr = pMpNcc->GetId(&pId);
     308                        Assert(hr == S_OK);
     309                        if(hr == S_OK)
     310                        {
     311                            if(!_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
     312                            {
     313                                vboxNetWinAddComponent(&list, pMpNcc, false);
     314                            }
     315                            CoTaskMemFree(pId);
     316                        }
     317                    }
     318                }
     319                VBoxNetCfgWinReleaseRef(pMpNcc);
     320            }
     321            Assert(hr == S_OK || hr == S_FALSE);
     322
     323            VBoxNetCfgWinReleaseRef(pEnumComponent);
     324        }
     325        else
     326        {
     327            LogRel(("failed to get the sun_VBoxNetFlt component, error (0x%x)", hr));
     328        }
     329
     330        VBoxNetCfgWinReleaseINetCfg(pNc, FALSE);
     331    }
     332    else if(lpszApp)
     333    {
     334        CoTaskMemFree(lpszApp);
     335    }
     336#endif /* #  if defined VBOX_WITH_NETFLT */
     337    return VINF_SUCCESS;
     338}
    270339
    271340int NetIfList(std::list <ComObjPtr <HostNetworkInterface> > &list)
     
    401470                                    ULONG uComponentStatus;
    402471                                    hr = pMpNcc->GetDeviceStatus(&uComponentStatus);
    403 #ifndef DEBUG_bird
    404                                     Assert(hr == S_OK);
    405 #endif
     472//#ifndef DEBUG_bird
     473//                                    Assert(hr == S_OK);
     474//#endif
    406475                                    if(hr == S_OK)
    407476                                    {
    408477                                        if(uComponentStatus == 0)
    409478                                        {
    410                                             vboxNetWinAddComponent(&list, pMpNcc);
     479                                            vboxNetWinAddComponent(&list, pMpNcc, true);
    411480                                        }
    412481                                    }
     
    435504        VBoxNetCfgWinReleaseINetCfg(pNc, FALSE);
    436505    }
     506
     507    NetIfListHostAdapters(list);
    437508#endif /* #  if defined VBOX_WITH_NETFLT */
    438509    return VINF_SUCCESS;
    439510}
    440 
    441 int NetIfListTap(std::list <ComObjPtr <HostNetworkInterface> > &list)
    442 {
    443 #ifndef VBOX_WITH_NETFLT
    444     /* VBoxNetAdp is available only when VBOX_WITH_NETFLT is enabled */
    445     return VERR_NOT_IMPLEMENTED;
    446 #else /* #  if defined VBOX_WITH_NETFLT */
    447     INetCfg              *pNc;
    448     INetCfgComponent     *pMpNcc;
    449     LPWSTR               lpszApp = NULL;
    450     HRESULT              hr;
    451     IEnumNetCfgComponent  *pEnumComponent;
    452 
    453     /* we are using the INetCfg API for getting the list of miniports */
    454     hr = VBoxNetCfgWinQueryINetCfg( FALSE,
    455                        VBOX_APP_NAME,
    456                        &pNc,
    457                        &lpszApp );
    458     Assert(hr == S_OK);
    459     if(hr == S_OK)
    460     {
    461         hr = VBoxNetCfgWinGetComponentEnum(pNc, &GUID_DEVCLASS_NET, &pEnumComponent);
    462         if(hr == S_OK)
    463         {
    464             while((hr = VBoxNetCfgWinGetNextComponent(pEnumComponent, &pMpNcc)) == S_OK)
    465             {
    466                 ULONG uComponentStatus;
    467                 hr = pMpNcc->GetDeviceStatus(&uComponentStatus);
    468 #ifndef DEBUG_bird
    469                 Assert(hr == S_OK);
    470 #endif
    471                 if(hr == S_OK)
    472                 {
    473                     if(uComponentStatus == 0)
    474                     {
    475                         LPWSTR pId;
    476                         hr = pMpNcc->GetId(&pId);
    477                         Assert(hr == S_OK);
    478                         if(hr == S_OK)
    479                         {
    480                             if(!_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
    481                             {
    482                                 vboxNetWinAddComponent(&list, pMpNcc);
    483                             }
    484                             CoTaskMemFree(pId);
    485                         }
    486                     }
    487                 }
    488                 VBoxNetCfgWinReleaseRef(pMpNcc);
    489             }
    490             Assert(hr == S_OK || hr == S_FALSE);
    491 
    492             VBoxNetCfgWinReleaseRef(pEnumComponent);
    493         }
    494         else
    495         {
    496             LogRel(("failed to get the sun_VBoxNetFlt component, error (0x%x)", hr));
    497         }
    498 
    499         VBoxNetCfgWinReleaseINetCfg(pNc, FALSE);
    500     }
    501     else if(lpszApp)
    502     {
    503         CoTaskMemFree(lpszApp);
    504     }
    505 #endif /* #  if defined VBOX_WITH_NETFLT */
    506     return VINF_SUCCESS;
    507 }
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r16509 r16967  
    607607    <xsd:element name="HostOnlyNetwork">
    608608      <xsd:complexType>
     609        <xsd:attribute name="name" type="xsd:string" use="optional"/>
    609610      </xsd:complexType>
    610611    </xsd:element>
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