开发者

Read Installed Device Driver Details (version, install date, path etc), on Win system

Can anyone help p开发者_StackOverflow社区lease in this regard ? What API's can be used from win32 to get installed device drivers details like version, installation date, path where installed ?

Regards, Kedar


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();
  }
}

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


You need to consult the Setup API function for driver information.


I recently did something similar (Win32 via .NET). Here are some links that helped me:

http://www.codeproject.com/KB/system/SimpleSetup.aspx
http://www.pinvoke.net/default.aspx/setupapi/SetupDiGetDeviceRegistryProperty.html
http://www.codeguru.com/forum/showthread.php?t=360567

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜