Index: /trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp	(revision 60637)
+++ /trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp	(revision 60638)
@@ -61,4 +61,5 @@
 #define VBOX_NETCFG_LOCK_TIME_OUT     5000  /** @todo r=bird: What does this do? */
 
+#define VBOXNETCFGWIN_NETADP_ID L"sun_VBoxNetAdp"
 
 /*
@@ -324,15 +325,19 @@
             */
             res = pTempComponent->OpenParamKey(&hkey);
-            if(SUCCEEDED(res) && hkey != NULL)
+
+            /* Set default metric value for host-only interface only */
+            if (SUCCEEDED(res) && hkey != NULL && wcsnicmp(pszwComponentId, VBOXNETCFGWIN_NETADP_ID, 256) == 0)
+            {
                 res = vboxNetCfgWinSetupMetric(hkey);
-            if (FAILED(res))
-            {
-                /*  
-                 *   The setting of Metric is not very important functionality,
-                 *   So we will not break installation process due to this error.
-                 */
-                NonStandardLogFlow(("VBoxNetCfgWinInstallComponent Warning! "
-                                    "vboxNetCfgWinSetupMetric failed, default metric "
-                                    "for new interface will not be set, hr (0x%x)\n", res));
+                if (FAILED(res))
+                {
+                    /*
+                     *   The setting of Metric is not very important functionality,
+                     *   So we will not break installation process due to this error.
+                     */
+                    NonStandardLogFlow(("VBoxNetCfgWinInstallComponent Warning! "
+                        "vboxNetCfgWinSetupMetric failed, default metric "
+                        "for new interface will not be set, hr (0x%x)\n", res));
+                }
             }
             if (ppComponent != NULL)
@@ -2165,5 +2170,4 @@
 }
 
-#define VBOXNETCFGWIN_NETADP_ID L"sun_VBoxNetAdp"
 static HRESULT vboxNetCfgWinNetAdpUninstall(IN INetCfg *pNc, LPCWSTR pwszId, DWORD InfRmFlags)
 {
@@ -3425,6 +3429,6 @@
 
     rc = g_pfnGetIpInterfaceEntry(&row);
-    if (rc != 0)
-        return E_FAIL;
+    if (rc != NO_ERROR)
+        return HRESULT_FROM_WIN32(rc);
 
     *Metric = row.Metric;
@@ -3452,5 +3456,5 @@
 
     // change settings
-    return g_pfnSetIpInterfaceEntry(&newRow);
+    return HRESULT_FROM_WIN32(g_pfnSetIpInterfaceEntry(&newRow));
 }
 
@@ -3469,6 +3473,6 @@
     res = RegQueryValueExW(hKey, L"NetLuidIndex", NULL,
         &dwValueType, (LPBYTE)&luidIndex, &cbSize);
-    if (FAILED(res))
-        return res;
+    if (res != 0)
+        return HRESULT_FROM_WIN32(res);
 
     cbSize = sizeof(ifType);
@@ -3476,6 +3480,6 @@
     res = RegQueryValueExW(hKey, L"*IfType", NULL,
         &dwValueType, (LPBYTE)&ifType, &cbSize);
-    if (FAILED(res))
-        return res;
+    if (res != 0)
+        return HRESULT_FROM_WIN32(res);
 
     ZeroMemory(pLUID, sizeof(NET_LUID));
