我试图使用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/