Windows Update Agent API 检查系统补丁安装情况的函数
2012-09-25 09:32
1756 查看
IUpdateSearcher interface
We are using the WUA to detect missing windows updates. Theproblem is that not all categories are returned. Comparing the result
from the WUA with the result from the update.microsoft.com is different.
For example the update.microsoft.com site shows a category called
"Microsoft Office 2003" which is not returned by the WUA.
Here is the code we are using:
CoInitialize(NULL); IUpdateSession* pUpdateSession = NULL; IUpdateServiceManager* pUpdateServiceManager = NULL; IUpdateService* pUpdateService = NULL; IUpdateSearcher* pUpdateSearcher = NULL; m_errorScan = failure; do { // create update session object. Log(llTrace, (CPString)L"Windows Update Scan : Create update session object"); HRESULT hr = CoCreateInstance ( CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (void**) &pUpdateSession ); if ( FAILED(hr) || pUpdateSession == NULL ) { break; } // create update service manager object. Log(llTrace, (CPString)L"Windows Update Scan : Create update service manager object"); hr = CoCreateInstance ( CLSID_UpdateServiceManager, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateServiceManager, (void**) &pUpdateServiceManager ); if ( FAILED(hr) || pUpdateServiceManager == NULL ) { break; } // create update searcher object. Log(llTrace, (CPString)L"Windows Update Scan : Create update searcher object"); hr = pUpdateSession->CreateUpdateSearcher(&pUpdateSearcher); if ( FAILED(hr) || pUpdateSearcher == NULL ) { break; } // select the update server source. Log(llTrace, (CPString)L"Windows Update Scan : Select the update server source"); hr = pUpdateSearcher->put_ServerSelection(ssWindowsUpdate); hr = pUpdateSearcher->put_CanAutomaticallyUpgradeService(VARIANT_TRUE); hr = pUpdateSearcher->put_IncludePotentiallySupersededUpdates(VARIANT_TRUE); hr = pUpdateSearcher->put_Online(VARIANT_TRUE); ISearchResult* pSearchResult = NULL; Log(llTrace, (CPString)L"Windows Update Scan : Start search"); hr = pUpdateSearcher->Search(BSTR(L"IsInstalled = 0"), &pSearchResult); if ( FAILED(hr) || pSearchResult == NULL ) { break; } // retrive and write the category collection content. ICategoryCollection* pCategoryCollection = NULL; hr = pSearchResult->get_RootCategories(&pCategoryCollection); if ( FAILED(hr) || pCategoryCollection == NULL ) { break; } else { WriteCategoryCollection(pCategoryCollection, m_aWindowsUpdateCategories); } LONG count = 0; HRESULT hr = pCategoryCollection->get_Count(&count); if(FAILED(hr)) { return eCreationErr; } for(int i = 0; i < count; i++) { ICategory* pCategory = NULL; hr = pCategoryCollection->get_Item(i, &pCategory); if(FAILED(hr)) { continue; } ...
Are there any informations about that ?
相关文章推荐
- 用Windows命令行如何检查Windows系统补丁(KBxxxxxx)的最后一次安装时间?
- [WUA APIs]Using the Windows Update Agent API
- Windows 安装补丁报错 0xc8000247 Windows update 当前无法检查更新,因为未运行服务。您可能需要重新启动计算机。
- Windows Update Downloader:系统补丁离线打
- windows系统cab补丁安装方法
- 批量安装Windows系统补丁的脚本
- Windows系统安装zabbix-agent客户端
- win7怎样重新安装卸载之后的Windows系统更新与补丁?
- 反盗版补丁&安装了windows genuine Advantage后系统提示让购买正版许可证该怎么办
- 确定系统中是否存在绑定变量的情况,ASKTOM提供函数remove_constans()来检查共享池中的SQL运行情况
- windows 2008安装KB971513,API3.0提示更新不会应用到系统
- Windows补丁:安装程序不能验证Update.inf文件的完整性,请确定加密服务正在此计算机上运行
- GDI+ / PNG 实现半透明窗口,正常情况下没有问题 将系统设置为16位色后UpdateLayeredWindow函数失败,GetLastError返回8(ERROR_NOT_ENOUGH_MEMORY)
- 在windows 2003下安装VS2005 SP1补丁错误,未通过数字签名检查
- windows系统exe和cab补丁文件批量安装脚本
- 用批处理一键安装两种扩展名的Windows系统补丁
- 安装解压版本的MySQL,安装过程中的常见命令,检查windows系统错误日志的方式来检查MySQL启动错误,关于Fatal error: Can't open and lock privilege
- Windows系统端口占用情况检查脚本
- 安装解压版本的MySQL,安装过程中的常见命令,检查windows系统错误日志的方式来检查MySQL启动错误,关于Fatal error: Can't open and lock privilege