简体   繁体   English

如何以编程方式检测是否已安装Windows 8.1更新

[英]How to programmatically detect if Windows 8.1 Update is installed

I'd like to detect from a C# application whether the latest Windows 8.1 Update (KB 2919355) is installed 我想从C#应用程序中检测是否安装了最新的Windows 8.1更新 (KB 2919355)

I haven't been able to find anything on any of microsoft's sites or via google that indicates how one might do this. 我无法在微软的任何网站上找到任何内容,也无法通过谷歌查看指示如何做到这一点。

Thanks! 谢谢!

That update is actually a "rollup" or a collection of other separate smaller updates. 该更新实际上是“汇总”或其他单独的较小更新的集合。 If you go to the Knowledge base page for the update and scroll down to the "File information" you can see the update is actually the combination of the following other updates. 如果您转到知识库页面进行更新并向下滚动到“文件信息”,您可以看到更新实际上是以下其他更新的组合。

  • KB2919442 KB2919442
  • KB2919355 KB2919355
  • KB2932046 KB2932046
  • KB2937592 KB2937592
  • KB2938439 KB2938439
  • KB2934018 KB2934018

You will then need to either check that all of the above listed updates are applied or the single master update is applied. 然后,您需要检查是否已应用上面列出的所有更新,或者是否应用了单个主更新。 I am not sure how to do that in C# alone but via the commandline you can just do it by the console command 我不确定如何在C#中单独执行此操作,但通过命令行,您可以通过console命令执行此操作

wmic qfe get hotfixid | find "KB2919355"

I installed Windows 8.1 Update from an MSDN download before it went live on Windows Update. 我在Windows Update上安装之前从MSDN下载安装了Windows 8.1 Update。 It was distributed as a series of MSU files with a ReadMe. 它作为一系列带有自述文件的MSU文件分发。 The list of updates in the ReadMe may be useful, if you choose to detect their presence. 如果您选择检测其状态,则自述文件中的更新列表可能很有用。

Windows 8.1, Windows Server 2012 R2, Windows RT 8.1 Update

Recommended Install Order
1.  KB2919442
2.  KB2919355
3.  KB2932046
4.  KB2937592
5.  KB2938439
6.  KB2949621

This may be the culprit: 这可能是罪魁祸首:

Operating system version changes in Windows 8.1 and Windows Server 2012 R2 Windows 8.1和Windows Server 2012 R2中的操作系统版本更改

Manifestation 表现

In Windows 8.1, the GetVersion(Ex) APIs have been deprecated. 在Windows 8.1中,不推荐使用GetVersion(Ex)API。 That means that while you can still call the APIs, if your app does not specifically target Windows 8.1, you will get Windows 8 versioning (6.2.0.0). 这意味着虽然您仍然可以调用API,但如果您的应用程序没有专门针对Windows 8.1,您将获得Windows 8版本控制(6.2.0.0)。

Solution

In order to target Windows 8.1, you need to either include the app manifest or include _NT_TARGET_VERSION=$ (_NT_TARGET_VERSION_LATEST) in the source file. 要以Windows 8.1为目标,您需要包含应用程序清单或在源文件中包含_NT_TARGET_VERSION = $(_NT_TARGET_VERSION_LATEST)。

Mode details of the required manifest contents are given in the article. 文章中给出了所需清单内容的模式详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM