Index: trunk/src/VBox/Main/win/NetIfList-win.cpp
===================================================================
--- trunk/src/VBox/Main/win/NetIfList-win.cpp	(revision 18121)
+++ trunk/src/VBox/Main/win/NetIfList-win.cpp	(revision 18136)
@@ -65,4 +65,21 @@
 
 #define VBOX_APP_NAME L"VirtualBox"
+
+static HRESULT netIfWinIsHostOnly(IWbemClassObject * pAdapterConfig, BOOL * pbIsHostOnly)
+{
+    VARIANT vtServiceName;
+    BOOL bIsHostOnly = FALSE;
+    VariantInit(&vtServiceName);
+
+    HRESULT hr = pAdapterConfig->Get(L"ServiceName", 0, &vtServiceName, 0, 0);
+    if(SUCCEEDED(hr))
+    {
+        *pbIsHostOnly = !Bstr(vtServiceName.bstrVal).compare(Bstr("VBoxNetAdp"));
+
+        VariantClear(&vtServiceName);
+    }
+
+    return hr;
+}
 
 static HRESULT netIfWinCreateIWbemServices(IWbemServices ** ppSvc)
@@ -794,27 +811,39 @@
             if(SUCCEEDED(hr))
             {
-                in_addr aIp[1];
-                in_addr aMask[1];
-                aIp[0].S_un.S_addr = ip;
-                aMask[0].S_un.S_addr = mask;
-
-                BSTR ObjPath;
-                hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
+                BOOL bIsHostOnly;
+                hr = netIfWinIsHostOnly(pAdapterConfig, &bIsHostOnly);
                 if(SUCCEEDED(hr))
                 {
-                    hr = netIfWinEnableStaticV4(pSvc, ObjPath, aIp, aMask, ip != 0 ? 1 : 0);
-                    if(SUCCEEDED(hr))
-                    {
+                    if(bIsHostOnly)
+                    {
+                        in_addr aIp[1];
+                        in_addr aMask[1];
+                        aIp[0].S_un.S_addr = ip;
+                        aMask[0].S_un.S_addr = mask;
+
+                        BSTR ObjPath;
+                        hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
+                        if(SUCCEEDED(hr))
+                        {
+                            hr = netIfWinEnableStaticV4(pSvc, ObjPath, aIp, aMask, ip != 0 ? 1 : 0);
+                            if(SUCCEEDED(hr))
+                            {
 #if 0
-                        in_addr aGw[1];
-                        aGw[0].S_un.S_addr = gw;
-                        hr = netIfWinSetGatewaysV4(pSvc, ObjPath, aGw, 1);
-                        if(SUCCEEDED(hr))
+                                in_addr aGw[1];
+                                aGw[0].S_un.S_addr = gw;
+                                hr = netIfWinSetGatewaysV4(pSvc, ObjPath, aGw, 1);
+                                if(SUCCEEDED(hr))
 #endif
-                        {
-//                            hr = netIfWinUpdateConfig(pIf);
+                                {
+        //                            hr = netIfWinUpdateConfig(pIf);
+                                }
+                            }
+                            SysFreeString(ObjPath);
                         }
                     }
-                    SysFreeString(ObjPath);
+                    else
+                    {
+                        hr = E_FAIL;
+                    }
                 }
             }
@@ -861,4 +890,5 @@
 static int netIfEnableStaticIpConfigV6(const Guid &guid, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
 {
+#if 0
     RTNETADDRIPV6 Mask;
     int rc = prefixLength2IPv6Address(aIPV6MaskPrefixLength, &Mask);
@@ -869,4 +899,7 @@
     }
     return rc;
+#else
+    return VERR_NOT_IMPLEMENTED;
+#endif
 }
 
@@ -882,14 +915,26 @@
             if(SUCCEEDED(hr))
             {
-                BSTR ObjPath;
-                hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
+                BOOL bIsHostOnly;
+                hr = netIfWinIsHostOnly(pAdapterConfig, &bIsHostOnly);
                 if(SUCCEEDED(hr))
                 {
-                    hr = netIfWinEnableDHCP(pSvc, ObjPath);
-                    if(SUCCEEDED(hr))
-                    {
-//                        hr = netIfWinUpdateConfig(pIf);
-                    }
-                    SysFreeString(ObjPath);
+                    if(bIsHostOnly)
+                    {
+                        BSTR ObjPath;
+                        hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
+                        if(SUCCEEDED(hr))
+                        {
+                            hr = netIfWinEnableDHCP(pSvc, ObjPath);
+                            if(SUCCEEDED(hr))
+                            {
+//                              hr = netIfWinUpdateConfig(pIf);
+                            }
+                            SysFreeString(ObjPath);
+                        }
+                    }
+                    else
+                    {
+                        hr = E_FAIL;
+                    }
                 }
             }
@@ -911,14 +956,26 @@
             if(SUCCEEDED(hr))
             {
-                BSTR ObjPath;
-                hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
+                BOOL bIsHostOnly;
+                hr = netIfWinIsHostOnly(pAdapterConfig, &bIsHostOnly);
                 if(SUCCEEDED(hr))
                 {
-                    hr = netIfWinDhcpRediscover(pSvc, ObjPath);
-                    if(SUCCEEDED(hr))
-                    {
+                    if(bIsHostOnly)
+                    {
+                        BSTR ObjPath;
+                        hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
+                        if(SUCCEEDED(hr))
+                        {
+                            hr = netIfWinDhcpRediscover(pSvc, ObjPath);
+                            if(SUCCEEDED(hr))
+                            {
 //                        hr = netIfWinUpdateConfig(pIf);
-                    }
-                    SysFreeString(ObjPath);
+                            }
+                            SysFreeString(ObjPath);
+                        }
+                    }
+                    else
+                    {
+                        hr = E_FAIL;
+                    }
                 }
             }
