i am trying to vendor specifc attribute from this WMI class MSStorageDriver_FailurePredictData(HDD SMART information). Here is the used code :

 IEnumWbemClassObject* pEnumerator = NULL;
    hres = pSvc->ExecQuery( L"WQL", L"SELECT * FROM MSStorageDriver_FailurePredictData",

    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))
         //do smoething

i need to know why Next() is not working properly.

Details of your error code...

> wbemErrAccessDenied
>           Value is -2147217405 (0x80041003)

can you tell me how to fix it

i think i figured out the solution.I should run visual studio as Administrator.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.