【问题标题】:Whats the difference between "IsPresent=1" and "IsInstalled=1" in search criteria of IUpdateSearcherIUpdateSearcher 搜索条件中的“IsPresent=1”和“IsInstalled=1”有什么区别
【发布时间】:2012-10-02 09:52:32
【问题描述】:

我正在尝试使用 IUpdateSearcher 接口的搜索方法的 WUA API 检索 Windows 更新。

我传递的搜索条件为“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.

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

【问题讨论】:

    标签: windows winapi desktop-application wmic


    【解决方案1】:

    这里有更好的解释: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,则可以为安装它的产品卸载更新。"

    【讨论】:

      猜你喜欢
      • 2011-02-27
      • 2018-08-26
      • 2019-01-12
      • 2015-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-15
      相关资源
      最近更新 更多