Index: /trunk/src/VBox/Main/win/NetIfList-win.cpp
===================================================================
--- /trunk/src/VBox/Main/win/NetIfList-win.cpp	(revision 17693)
+++ /trunk/src/VBox/Main/win/NetIfList-win.cpp	(revision 17694)
@@ -231,44 +231,44 @@
         )
 {
-    HRESULT hres;
+    HRESULT hres = S_OK;
     // Step 6: --------------------------------------------------
     // Use the IWbemServices pointer to make requests of WMI ----
 
-    IWbemClassObject* pInParamsDefinition = NULL;
-    hres = pClass->GetMethod(MethodName, 0,
-        &pInParamsDefinition, NULL);
+    ComPtr<IWbemClassObject> pInParamsDefinition;
+    ComPtr<IWbemClassObject> pClassInstance;
+
+    if(cArgs)
+    {
+        hres = pClass->GetMethod(MethodName, 0,
+            pInParamsDefinition.asOutParam(), NULL);
+        if(SUCCEEDED(hres))
+        {
+            hres = pInParamsDefinition->SpawnInstance(0, pClassInstance.asOutParam());
+
+            if(SUCCEEDED(hres))
+            {
+                for(UINT i = 0; i < cArgs; i++)
+                {
+                    // Store the value for the in parameters
+                    hres = pClassInstance->Put(pArgNames[i], 0,
+                        pArgs[i], 0);
+                    if(FAILED(hres))
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
     if(SUCCEEDED(hres))
     {
-        IWbemClassObject* pClassInstance = NULL;
-        hres = pInParamsDefinition->SpawnInstance(0, &pClassInstance);
-
+        IWbemClassObject* pOutParams = NULL;
+        hres = pSvc->ExecMethod(ObjPath, MethodName, 0,
+                        NULL, pClassInstance, &pOutParams, NULL);
         if(SUCCEEDED(hres))
         {
-            for(UINT i = 0; i < cArgs; i++)
-            {
-                // Store the value for the in parameters
-                hres = pClassInstance->Put(pArgNames[i], 0,
-                    pArgs[i], 0);
-                if(FAILED(hres))
-                {
-                    break;
-                }
-            }
-
-            if(SUCCEEDED(hres))
-            {
-                IWbemClassObject* pOutParams = NULL;
-                hres = pSvc->ExecMethod(ObjPath, MethodName, 0,
-                        NULL, pClassInstance, &pOutParams, NULL);
-                if(SUCCEEDED(hres))
-                {
-                    *ppOutParams = pOutParams;
-                }
-            }
-
-            pClassInstance->Release();
-        }
-
-        pInParamsDefinition->Release();
+            *ppOutParams = pOutParams;
+        }
     }
 
@@ -396,5 +396,5 @@
                 if(SUCCEEDED(hr))
                 {
-                    Assert(varReturnValue.vt == VT_UINT);
+//                    Assert(varReturnValue.vt == VT_UINT);
                     int winEr = varReturnValue.uintVal;
                     switch(winEr)
@@ -2288,9 +2288,9 @@
             ComObjPtr <Progress> progress;
             progress.createObject();
-            ComPtr<IHost> host;
-            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
-            if(SUCCEEDED(rc))
-            {
-                rc = progress->init (vBox, host,
+//            ComPtr<IHost> host;
+//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
+//            if(SUCCEEDED(rc))
+            {
+                rc = progress->init (vBox, (IHostNetworkInterface*)pIf,
                                     Bstr ("Enabling Dynamic Ip Configuration"),
                                     FALSE /* aCancelable */);
@@ -2321,4 +2321,6 @@
                         /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
                         d.release();
+
+                        progress->WaitForCompletion(-1);
                     }
                 }
@@ -2344,9 +2346,9 @@
             ComObjPtr <Progress> progress;
             progress.createObject();
-            ComPtr<IHost> host;
-            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
-            if(SUCCEEDED(rc))
-            {
-                rc = progress->init (vBox, host,
+//            ComPtr<IHost> host;
+//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
+//            if(SUCCEEDED(rc))
+            {
+                rc = progress->init (vBox, (IHostNetworkInterface*)pIf,
                                     Bstr ("Enabling Dynamic Ip Configuration"),
                                     FALSE /* aCancelable */);
@@ -2377,4 +2379,6 @@
                         /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
                         d.release();
+
+                        progress->WaitForCompletion(-1);
                     }
                 }
@@ -2400,9 +2404,9 @@
             ComObjPtr <Progress> progress;
             progress.createObject();
-            ComPtr<IHost> host;
-            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
-            if(SUCCEEDED(rc))
-            {
-                rc = progress->init (vBox, host,
+//            ComPtr<IHost> host;
+//            HRESULT rc = vBox->COMGETTER(Host)(host.asOutParam());
+//            if(SUCCEEDED(rc))
+            {
+                rc = progress->init (vBox, (IHostNetworkInterface*)pIf,
                                     Bstr ("Enabling Dynamic Ip Configuration"),
                                     FALSE /* aCancelable */);
@@ -2431,4 +2435,6 @@
                         /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
                         d.release();
+
+                        progress->WaitForCompletion(-1);
                     }
                 }
