2012-03-20 23 views
1

誰能幫我試圖找到用於檢索的硬件地址和IRQ的一個WMI方法?WMI硬件地址和IRQ的

我已經看了到目前爲止類似乎告訴你什麼設備實際使用的資源略偏空 - 但它必須是可能的,如果是在Windows'‘系統信息’工具可用。

最後,我想創建一個地址映射和IRQ映射在我的C#應用​​程序。

我簡要地看着下面的類:

  • Win32_DeviceMemoryAddress
  • Win32_IRQResource

,我只是第二次看到了另一個,但我還沒有真正看着它:

  • Win32_AllocatedResource

也許與Win32_PnPEntity配對呢?

+0

? – RRUZ 2012-03-21 01:52:04

+0

C#,但只要我知道要查找哪些類/ SQL語句來運行,我可以用我的自定義框架很好地拉動WMI數據。 – CJxD 2012-03-21 07:40:17

回答

3

要獲得這些信息,你必須使用ASSOCIATORS OF WQL句子創建 Win32_DeviceMemoryAddress之間的聯繫 - >Win32_PnPEntity - >Win32_IRQResource類。

檢查您正在使用哪種語言此示例應用程序

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Management; 
using System.Text; 

namespace WMIIRQ 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      foreach(ManagementObject Memory in new ManagementObjectSearcher(
       "select * from Win32_DeviceMemoryAddress").Get()) 
      { 

       Console.WriteLine("Address=" + Memory["Name"]); 
       // associate Memory addresses with Pnp Devices 
       foreach(ManagementObject Pnp in new ManagementObjectSearcher(
        "ASSOCIATORS OF {Win32_DeviceMemoryAddress.StartingAddress='" + Memory["StartingAddress"] + "'} WHERE RESULTCLASS = Win32_PnPEntity").Get()) 
       { 
        Console.WriteLine(" Pnp Device =" + Pnp["Caption"]); 

        // associate Pnp Devices with IRQ 
        foreach(ManagementObject IRQ in new ManagementObjectSearcher(
         "ASSOCIATORS OF {Win32_PnPEntity.DeviceID='" + Pnp["PNPDeviceID"] + "'} WHERE RESULTCLASS = Win32_IRQResource").Get()) 
        { 
         Console.WriteLine(" IRQ=" + IRQ["Name"]); 
        } 
       } 

      } 
      Console.ReadLine(); 
     } 
    } 
} 
+0

聖潔的嘿,這實際上是我第一次調試後,甚至在重新安排遍佈整個地方後。 看起來將硬盤驅動器及其SMART數據鏈接在一起也很有用。謝謝! – CJxD 2012-03-22 15:09:17

+0

好吧,也許不是。盤驅動在CIMV2命名空間和MSStorageDriver_ATAPISmartData是在WMI命名空間 – CJxD 2012-03-22 15:35:22

+0

而且我的話,這是否需要很長的時間去電腦! – CJxD 2012-03-22 22:04:59