Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to vendor specifc attribute from this WMI class MSStorageDriver_FailurePredictData(HDD SMART information). Here is the used code :
C++
IEnumWbemClassObject* pEnumerator = NULL;
    hres = pSvc->ExecQuery( L"WQL", L"SELECT * FROM MSStorageDriver_FailurePredictData",
    WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);

    IWbemClassObject *pclsObj = NULL;
    ULONG uReturn = 0;
      while (pEnumerator)
   {
    HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
            //**I am getting an issue here the method Next() returns hr=-2147217405 **

    if(0 == uReturn || FAILED(hr))
      break;
         //do smoething
     }

i need to know why Next() is not working properly.
Posted
Updated 15-Dec-20 20:14pm

All the clues are there

-2147217405 == 0x80041003 == WBEM_E_ACCESS_DENIED

Additionally, while(pEnumerator) is always going to be true
 
Share this answer
 
Comments
[no name] 28-Mar-14 0:05am    
The application of logic 5.
i think i figured out the solution.I should run visual studio as Administrator
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900