在 Win 系统上阅读已安装的设备驱动程序详细信息(版本、安装日期、路径等) [英] Read Installed Device Driver Details (version, install date, path etc), on Win system

查看:10
本文介绍了在 Win 系统上阅读已安装的设备驱动程序详细信息(版本、安装日期、路径等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以在这方面提供帮助吗?可以从 win32 使用哪些 API 来获取已安装的设备驱动程序详细信息,例如版本、安装日期、安装路径?

Can anyone help please in this regard ? What API's can be used from win32 to get installed device drivers details like version, installation date, path where installed ?

问候,凯达

推荐答案

最好的方法是 WMI,.NET 通过 System.Management 命名空间很好地支持它.您需要使用 Win32_SystemDriverWMI 类.我从 WMICodeCreator,一个用于试验和自动生成您需要的代码的好工具:

The best way is WMI, .NET supports it well with the System.Management namespace. You'll want to use the Win32_SystemDriver WMI class. I copied and pasted this code from WMICodeCreator, a great tool to experiment and auto-generate the code you need:

using System;
using System.Management;  // Project + Add Reference required

public class MyWMIQuery {
  public static void Main() {
    ManagementObjectSearcher searcher =
        new ManagementObjectSearcher("root\\CIMV2",
        "SELECT * FROM Win32_SystemDriver");

    foreach (ManagementObject queryObj in searcher.Get()) {
      Console.WriteLine("Driver caption: {0}", queryObj["Caption"]);
    }
    Console.ReadLine();
  }
}

查看我在这篇文章中留下的链接,Win32_SystemDriver 除了Caption"之外还有许多其他属性.

Check out the links I left in this post, Win32_SystemDriver has many other properties beyond "Caption".

这篇关于在 Win 系统上阅读已安装的设备驱动程序详细信息(版本、安装日期、路径等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆