【问题标题】:WMI Hardware Addresses and IRQsWMI 硬件地址和 IRQ
【发布时间】:2013-06-16 22:03:17
【问题描述】:

谁能帮我找到一种 WMI 方法来检索硬件地址和 IRQ?

到目前为止,我所查看的类似乎有点空洞,无法告诉您实际使用资源的设备是什么 - 但如果它在 Windows 的“系统信息”工具下可用,那么它一定是可能的。

最终我想在我的 C# 应用程序中创建一个地址映射和一个 IRQ 映射。

我简要地查看了以下课程:

  • Win32_DeviceMemoryAddress
  • Win32_IRQResource

我刚刚看到另一个,但我还没有真正研究过:

  • Win32_AllocatedResource

也许将它与 Win32_PnPEntity 配对?

【问题讨论】:

  • 您使用哪种语言?
  • C#,但只要我知道要查找哪些类/要运行的 SQL 语句,我就可以使用我的自定义框架很好地提取 WMI 数据。

标签: c# wmi memory-address irq


【解决方案1】:

要获取该信息,您必须使用 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();
        }
    }
}

【讨论】:

  • 天哪,这在我第一次调试时确实有效,即使在整个地方重新排列之后也是如此。看起来将硬盘驱动器及其 SMART 数据链接在一起也很有用。谢谢!
  • 好吧,也许不是。 DiskDrive 在 CIMV2 命名空间中,MSStorageDriver_ATAPISmartData 在 WMI 命名空间中
  • 我说这需要很长时间才能上电脑!
猜你喜欢
  • 2019-01-09
  • 1970-01-01
  • 2018-12-07
  • 1970-01-01
  • 2011-01-21
  • 2011-08-06
  • 2014-09-19
  • 2018-01-18
  • 1970-01-01
相关资源
最近更新 更多