Ticket #5306: win32_api.patch

File win32_api.patch, 1.9 KB (added by habdank@…, 12 years ago)

Patch for the problem

  • win32_api.hpp

     
    14721472            )
    14731473         )
    14741474      {
     1475             CoUninitialize();
    14751476         return false;
    14761477      }
    14771478 
     
    14891490      {
    14901491         pIWbemLocator->Release();
    14911492 
     1493                 CoUninitialize();
    14921494         return false;
    14931495      }
    14941496 
     
    15101512         pIWbemLocator->Release();
    15111513         pWbemServices->Release();
    15121514 
     1515                 CoUninitialize();
    15131516         return false;
    15141517      }
    15151518     
     
    15221525         pWbemServices->Release();
    15231526         pEnumObject->Release();
    15241527 
     1528         CoUninitialize();
    15251529         return false;
    15261530      }
    15271531
    15281532      wchar_variant vwchar;
    15291533
    1530       while( 0 == pEnumObject->Next( WBEM_INFINITE_IG, uCount, &pClassObject, &uReturned ) )
    1531       {
    1532          if ( 0 == pClassObject->Get( L"LastBootUpTime", 0, &vwchar, 0, 0 ) )
    1533          {
    1534             bRet = true;
    1535              strValue = vwchar.value.pbstrVal;
    1536              VariantClear(&vwchar );
    1537              break;
    1538          }
    1539       }
     1534          while( 0 == pEnumObject->Next( WBEM_INFINITE_IG, uCount, &pClassObject, &uReturned ) )
     1535          {
     1536                if (pClassObject != 0)
     1537                {
     1538                        if ( 0 == pClassObject->Get( L"LastBootUpTime", 0, &vwchar, 0, 0 ) )
     1539                        {
     1540                                bRet = true;
     1541                                strValue = vwchar.value.pbstrVal;
     1542                                VariantClear(&vwchar );
     1543                                break;
     1544                        }
     1545                }
     1546          }
    15401547 
    1541       pIWbemLocator->Release();
    1542       pWbemServices->Release();
    1543       pEnumObject->Release();
    1544       pClassObject->Release();
     1548      if (pIWbemLocator != 0)
     1549          pIWbemLocator->Release();
     1550
     1551      if (pWbemServices != 0)
     1552          pWbemServices->Release();
     1553
     1554      if (pEnumObject != 0)
     1555          pEnumObject->Release();
     1556
     1557      if (pClassObject != 0)
     1558          pClassObject->Release();
    15451559   }
    15461560 
    15471561   CoUninitialize();