65.9K
CodeProject 正在变化。 阅读更多。
Home

提取 Windows XP 热修复程序

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.39/5 (8投票s)

2005年7月27日

viewsIcon

46558

downloadIcon

382

本文提供了一个类,用于提取安装在计算机上的 Windows XP 补丁。

代码的作用

这个类提取安装在计算机上的 Windows XP 补丁。

枚举注册表键“HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\HotFix”的所有条目,并关注“Fix Description”值。

如何使用

很简单 :). 声明一个名为“hf”的CXP_Hotfix类的对象。

CXP_Hotfix hf;

现在我们可以在中使用它,这里是一个小例子

  int nb_hotfix;
  nb_hotfix = hf.m_aHotFix.GetCount();

  if (nb_hotfix > 0) // display only if there is at least 1 Hotfix
  {

      // loop until we find an Hotfix and display it (them).
      for (int a = 0; a < hf.m_aHotFix.GetCount(); a++)
      {
         printf("%s\r\n", hf.m_aHotFix[a]);
      }
     
      printf("\r\n");
    
      // here we show number of Hotfix found.
      printf("Found %i Windows XP Hot-fix installed.\r\n\r\n", 
                                     hf.m_aHotFix.GetCount());
  }

  else // No Hotfix was found.
  {
      printf("No Windows XP Hot-fix installed.\r\n\r\n");
  }

就是这样。

灵感来源

当我看到 Robert Edward Caldecott 获取已安装应用程序列表的代码 (CinstalledSoftware) 时,我有了编写这段代码的想法。

限制

这段代码在 Windows XP SP1 上运行良好;对于其他 Windows 版本,我不知道,抱歉..

© . All rights reserved.