Your get_Item()
member of your collection requires an IUpdate
interface pointer; not an IUpdate2
interface pointer.
Note: this code is absolutely riddled with bugs, bad practices, and memory leaks. Aong them:
- Interface pointers that are never released
- BSTR's that are never freed.
- HRESULTs that are never checked.
- Invalid indexing into a zero-based collection
Just to name a few. Regardless The following should address your interface mismatch. The rest of this menagerie I leave to you:
while (0 != lUpdateCount)
{
IUpdate* pIUpd = NULL;
HRESULT hr = pIUpdateCollection->get_Item(lUpdateCount, &pIUpd);
if (SUCCEEDED(hr) && pIUpd)
{
hr = pIUpd->QueryInterface(__uuidof(pIUpdate), (LPVOID*)&pIUpdate);
pIUpd->Release();
if (SUCCEEDED(hr) && pIUpdate != NULL)
{
pIUpdate->get_CveIDs(&pIStrCollCVEs);
pIStrCollCVEs->get_Count(&lCount);
pIUpdate->get_Title(&buff);
printf("TITLE : %s \n", buff);
while(0 != lCount)
{
pIStrCollCVEs ->get_Item(lCount, &buff);
_bstr_t b(buff, false);
printf("CVEID = %s \n", buff);
lCount --;
}
}
}
printf("\n");
lUpdateCount--;
}