windows - IUpdateSearcher的搜索条件中 "IsPresent=1"和 "IsInstalled=1"有什么区别

标签 windows winapi desktop-application wmic

我尝试使用 IUpdateSearcher 界面的搜索方法的 WUA API 检索 Windows Update。

我传递的搜索条件为“IsInstalled=1 或 IsPresent=1”。请在下面找到示例代码。

IUpdateSearcher* searcher;
ISearchResult* results;
/*
.
.
Code to initialize COM and get UpdateSearcher*/
.
.
*/

hRes = searcher->Search("IsInstalled=1 or IsPresent=1", &results);

我已经在MSDN中浏览了IsInstalled和IsPresent的定义(复制以供引用)。两者都谈论相似的事情。

IsPresent   
When set to 1, finds updates that are present on a computer.
"IsPresent=1" finds updates that are present on a destination computer. If the update
is valid for one or more products, the update is considered present if it is installed
for one or more of the products."IsPresent=0" finds updates that are not installed 
for any product on a destination   computer.

IsInstalled
Finds updates that are installed on the destination computer.
"IsInstalled=1" finds updates that are installed on the destination computer.
"IsInstalled=0" finds updates that are not installed on the destination computer.

有人可以澄清一下它们到底有什么不同吗?

最佳答案

这里有一个更好的解释:http://msdn.microsoft.com/en-us/library/windows/desktop/aa386103(v=vs.85).aspx

以下是相关文字:

“备注

如果为一个或多个产品安装了更新,则视为存在更新。例如,如果某个更新同时适用于 Microsoft Office Word 和 Microsoft Office Excel,并且为其中一个或两个产品安装了更新,则 IsPresent 属性将返回 VARIANT_TRUE。

如果更新仅适用于一种产品,则 IsPresent 和 IsInstalled 属性是等效的。如果更新适用于所有产品,则视为已安装该更新。

如果 IsPresent 返回 VARIANT_TRUE 并且 IsInstalled 返回 VARIANT_FALSE,则可以为安装该更新的产品卸载该更新。”

关于windows - IUpdateSearcher的搜索条件中 "IsPresent=1"和 "IsInstalled=1"有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12844538/

相关文章:

c# - 保护无人值守桌面应用程序上的 SQL Server 连接字符串

windows - Notepad++ 右键在新窗口打开文件

c++ - C++,关闭后如何使控制台应用程序在后台运行?

c++ - 如何在 C++ 中创建文件映射?

c - 在C中获取进程内存信息

java - 独立的 war/java Web 应用程序

windows - 如何在使用 "delayed expansion local"模式的 Windows 批处理脚本之外保留变量的值?

windows - 远程访问 Windows Vista 到 Mac OSX?

c++ - 如何在 Windows 8.1/10 上可靠地窃取/重新获得 MFC/桌面应用程序的焦点?

Travis CI 上的 C++ 桌面 GUI 测试