如何获取有关所有已安装设备驱动程序的所有信息? (C#)

时间:2013-06-21 08:50:52

标签: c# .net wmi device-driver

要获取有关已安装的设备驱动程序的信息,请使用以下代码。 我的问题是,我没有得到所有的信息。缺少一些信息。

public static void SetDriverInfos()
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2","SELECT * FROM Win32_PnPSignedDriver");

            foreach (ManagementObject queryobj in searcher.Get())
            {
                SystemDriver my = new SystemDriver
                    (
                        Convert.ToString(queryobj["ClassGuid"]),
                        Convert.ToString(queryobj["CompatID"]),
                        Convert.ToString(queryobj["Description"]),
                        Convert.ToString(queryobj["DeviceClass"]),
                        Convert.ToString(queryobj["DeviceID"]),
                        Convert.ToString(queryobj["DeviceName"]),
                        Convert.ToString(queryobj["DevLoader"]),
                        Convert.ToString(queryobj["DriverDate"]),
                        Convert.ToString(queryobj["DriverName"]),
                        Convert.ToString(queryobj["DriverVersion"]),
                        Convert.ToString(queryobj["FriendlyName"]),
                        Convert.ToString(queryobj["HardWareID"]),
                        Convert.ToString(queryobj["InfName"]),
                        Convert.ToString(queryobj["InstallDate"]),
                        Convert.ToBoolean(queryobj["IsSigned"]),
                        Convert.ToString(queryobj["Location"]),
                        Convert.ToString(queryobj["Manufacturer"]),
                        Convert.ToString(queryobj["Name"]),
                        Convert.ToString(queryobj["PDO"]),
                        Convert.ToString(queryobj["DriverProviderName"]),
                        Convert.ToString(queryobj["Signer"]),
                        Convert.ToBoolean(queryobj["Started"]),
                        Convert.ToString(queryobj["StartMode"]),
                        Convert.ToString(queryobj["Status"]),
                        Convert.ToString(queryobj["SystemCreationClassName"]),
                        Convert.ToString(queryobj["SystemName"])
                    );    
            }

有些字段有时是空的,但我认为没关系? 有些字段每次都是空的,但我需要所有的信息。 (DevLoader,DriverName,InstallDate,Name,StartMode,Status,SystemCreationClassName,SystemName) 这里有一个例子:

ClassGuid :{4d36e97d-e325-11ce-bfc1-08002be10318}
CompatID :PCI\VEN_8086&DEV_3B48&REV_05
Description :Intel(R) 5 Series/3400 Series Chipset Family PCI Express Root Port 4 - 3B48
DeviceClass :SYSTEM
DeviceID :PCI\VEN_8086&DEV_3B48&SUBSYS_38B317AA&REV_05\3&11583659&0&E3
DeviceName :Intel(R) 5 Series/3400 Series Chipset Family PCI Express Root Port 4 - 3B48
DevLoader :
DriverDate :20090406000000.******+***
DriverName :
DriverVersion :9.1.1.1013
FriendlyName :
HardWareID :PCI\VEN_8086&DEV_3B48&SUBSYS_38B317AA&REV_05
InfName :oem7.inf
InstallDate :
IsSigned :True
Location :PCI bus 0, device 28, function 3
Manufacturer :Intel
Name :
PDO :\Device\NTPNP_PCI0008
DriverProviderName :Intel
Signer :Microsoft Windows Hardware Compatibility Publisher
Started :False
StartMode :
Status :
SystemCreationClassName :
SystemName :

0 个答案:

没有答案