Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- ISearchResult *pResult;
- IUpdateSession *pSession;
- IUpdateSearcher *pSearcher;
- CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (LPVOID*)&pSession);
- pSession->CreateUpdateSearcher(&pSearcher);
- LONG updateSizeT, updateSizeB1, updateSizeB0;
- IUpdateCollection *pCollection;
- BSTR criteria = SysAllocString(L"IsInstalled=0");
- pSearcher->Search(criteria, &pResult);
- pResult->get_Updates(&pCollection);
- pCollection->get_Count(&updateSizeT);
- SysFreeString(criteria);
- criteria = SysAllocString(L"IsInstalled=0 and BrowseOnly=0");
- pSearcher->Search(criteria, &pResult);
- pResult->get_Updates(&pCollection);
- pCollection->get_Count(&updateSizeB0);
- SysFreeString(criteria);
- criteria = SysAllocString(L"IsInstalled=0 and BrowseOnly=1");
- pSearcher->Search(criteria, &pResult);
- pResult->get_Updates(&pCollection);
- pCollection->get_Count(&updateSizeB1);
- SysFreeString(criteria);
- wcout << L"Total: " << updateSizeT << endl
- << L"BrowseOnly=0: " << updateSizeB0 << endl
- << L"BrowseOnly=1: " << updateSizeB1 << endl;
- Total: 86
- BrowseOnly=0: 49
- BrowseOnly=1: 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement