//To get that info you must use the ASSOCIATORS OF WQL sentence to create a link between theWin32_DeviceMemoryAddress -> Win32_PnPEntity -> Win32_IRQResource classes. 1 static void Main(string[] args)
2 {
3 foreach (ManagementObject Memory in new ManagementObjectSearcher(
4 "select * from Win32_DeviceMemoryAddress").Get())
5 {
6
7 Console.WriteLine("Address=" + Memory["Name"]);
8 // associate Memory addresses with Pnp Devices
9 foreach (ManagementObject Pnp in new ManagementObjectSearcher(
10 "ASSOCIATORS OF {Win32_DeviceMemoryAddress.StartingAddress='" + Memory["StartingAddress"] + "'} WHERE RESULTCLASS = Win32_PnPEntity").Get())
11 {
12 Console.WriteLine(" Pnp Device =" + Pnp["Caption"]);
13
14 // associate Pnp Devices with IRQ
15 foreach (ManagementObject IRQ in new ManagementObjectSearcher(
16 "ASSOCIATORS OF {Win32_PnPEntity.DeviceID='" + Pnp["PNPDeviceID"] + "'} WHERE RESULTCLASS = Win32_IRQResource").Get())
17 {
18 Console.WriteLine(" IRQ=" + IRQ["Name"]);
19 }
20 }
21
22 }
23 Console.ReadLine();
24
25 }
|
请发表评论