tags:

views:

190

answers:

3

Hi Everyone,

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 ?

Regards, Kedar

A: 

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

On Freund
+2  A: 

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".

Hans Passant