]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.cpp
Allow maxtargets to be bypassed in LoopCall for JOIN
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.cpp
index 3cc4f240ee452cb6b0f73ef69defaad8e6260fe9..8291cd60d51e84f06c8f3d7c5fc821d1094939c6 100644 (file)
@@ -528,7 +528,7 @@ void FindDNS(std::string& server)
        /* If empty use default to 127.0.0.1 */
        if (nameserver.empty())
        {
-               ServerInstance->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
+               ServerInstance->Logs->Log("CONFIG",DEFAULT,"No viable nameserver found in registry! Defaulting to nameserver '127.0.0.1'!");
                server = "127.0.0.1";
                return;
        }
@@ -652,6 +652,7 @@ int getcpu()
                while (pEnumerator)
                {
                        VARIANT vtProp;
+                       VariantInit(&vtProp);
                        /* Next item */
                        HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
 
@@ -664,9 +665,10 @@ int getcpu()
                        if (!FAILED(hr))
                        {
                                /* Matches our process ID? */
-                               if (vtProp.uintVal == GetCurrentProcessId())
-                               {
-                                       VariantClear(&vtProp);
+                               UINT pid = vtProp.uintVal;
+                               VariantClear(&vtProp);
+                               if (pid == GetCurrentProcessId())
+                               {                                       
                                        /* Get CPU percentage for this process */
                                        hr = pclsObj->Get(L"PercentProcessorTime", 0, &vtProp, 0, 0);
                                        if (!FAILED(hr))
@@ -674,18 +676,19 @@ int getcpu()
                                                /* Deal with wide string ickyness. Who in their right
                                                 * mind puts a number in a bstrVal wide string item?!
                                                 */
-                                               VariantClear(&vtProp);
                                                cpu = 0;
                                                std::wstringstream out(vtProp.bstrVal);
                                                out >> cpu;
-                                               break;
+                                               VariantClear(&vtProp);
                                        }
+                                       pclsObj->Release();
+                                       break;
                                }
+                               pclsObj->Release();
                        }
                }
 
                pEnumerator->Release();
-               pclsObj->Release();
        }
 
        SysFreeString(Language);