views:

32

answers:

1

I'm trying to figure out, how to create a hardware inventory / report on Windows 7 including:

  • All devices in / attached to a system.
  • Driver / device information per device (Device Type, Manufacturer, Driver Version, Driver Date, Driver Provider, Driver Files, Hardware Ids)
    • If the drivers is digitally signed (WHQL) / has a valid signature

i've found this articles. http://www.codeproject.com/KB/system/SimpleSetup.aspx this one's a C++ App - i'd have to convert it. http://www.codeproject.com/KB/cs/EverythingInWmi03.aspx - this one's based on WMI (Windows Management Instrumentation)

Basically those links helped a lot, but both do not provide a complete solution. i started with the WMI approach and realised, that this way i do not get all necessary information.. especially the 'isDriverDigitallySigned' information is very important. i've seen articles where they mention, that checking whether a device driver is digitally signed or not can be check by retrieving a x509 Certificate like:

           X509Certificate xcert = null;
        try
        {
            var d = new DirectoryInfo(@"c:\windows\system32\drivers");
            FileInfo[] allFiles = d.GetFiles();
            foreach (FileInfo f in allFiles)
            {
                xcert = X509Certificate.CreateFromSignedFile(f.Name);
                Console.WriteLine(f.Name + "\t" + xcert.GetName() + "\t" +
                                  xcert.GetPublicKeyString());
            }
        }

but that snipped didn't work - on none of the .sys files a certificate can be 'extracted' (CreateFromSignedFile)

I'm coding in C#.

Help's appreciated.

A: 

What WMI class are you using for enumerating the drivers? Win32_PnPSignedDriver has a property named 'IsSigned'.

Uros Calakovic
Thanks, i know about this Class and Property. i tried and am still trying to find a way, to enumerate all drivers like DevCon dp_enum and SigVerif.exe and Verifier.exe - all in one code / solution. And i'm still trying to find information about this in particular..
Christian