详细的PCI-E信息,Windows

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了详细的PCI-E信息,Windows相关的知识,希望对你有一定的参考价值。

我有一个项目,我需要从带有图形卡的计算机中收集信息,从1到12,它有。然后将此信息保存在云中以供以后使用。

我需要的是,至少是:

它是什么GPU多少内存它使用哪个PCI插槽,1,2,3等(或者它的名字)

Windows WMI似乎有一些信息,我一直在寻找不同的类,但似乎很难找到PCI-E插槽。有谁知道如何获取这些信息?

答案

你应该寻找PCI插槽我没有在字符串中看到任何PCI-E定义(并不意味着没有)。如果我只尝试"PCI",结果会同时包含PCI和PCI-E设备。在BDS2006 C ++ / VCL中我只是通过更改匹配字符串来使用this(我很久以前就破坏了):

//---------------------------------------------------------------------------
//$$---- Form CPP ----
//---------------------------------------------------------------------------
#include <vcl.h>
#include <setupapi.h>
#pragma hdrstop
#include "win_main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMain *Main;
//---------------------------------------------------------------------------
bool USBinfo()
    {
    int i,n;
    AnsiString s,txt="";
    DWORD dwSize,dwPropertyRegDataType;
    HDEVINFO hDevInfo;
    SP_DEVINFO_DATA DeviceInfoData;
    TCHAR szDesc[1024];

//  hDevInfo = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);           // List all devices
//  hDevInfo = SetupDiGetClassDevs(NULL, TEXT("USB"), NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);    // List all connected USB devices
    hDevInfo = SetupDiGetClassDevs(NULL, TEXT("PCI"), NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);    // List all connected PCI devices
    if (hDevInfo == INVALID_HANDLE_VALUE) return false;
    // Find the ones that are driverless
    for (i=0;;i++)
        {
        DeviceInfoData.cbSize = sizeof(DeviceInfoData);
        if (!SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData)) break;
        SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_DEVICEDESC,&dwPropertyRegDataType, (BYTE*)szDesc,sizeof(szDesc),&dwSize);
        s=szDesc; n=48; while (s.Length()<n) s+=" "; if (s.Length()>n) s=s.SubString(1,n); txt+=s+" ";
        SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_HARDWAREID,&dwPropertyRegDataType, (BYTE*)szDesc,sizeof(szDesc),&dwSize);
        s=szDesc; n=64; while (s.Length()<n) s+=" "; if (s.Length()>n) s=s.SubString(1,n); txt+=s+" ";
        SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData, SPDRP_LOCATION_INFORMATION,&dwPropertyRegDataType, (BYTE*)szDesc,sizeof(szDesc),&dwSize);
        s=szDesc; n=40; while (s.Length()<n) s+=" "; if (s.Length()>n) s=s.SubString(1,n); txt+=s+" ";
        txt+="
";
        }
    Main->mm_log->Lines->Add(txt);
    return true;
    }
//-------------------------------------------------------------------------
__fastcall TMain::TMain(TComponent* Owner) : TForm(Owner)
    {
    USBinfo();
    }
//-------------------------------------------------------------------------

这里是"PCI"字符串的示例输出:

PCI standard host CPU bridge                     PCIVEN_1022&DEV_1400&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 0         
PCI standard host CPU bridge                     PCIVEN_1022&DEV_1401&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 1         
PCI standard host CPU bridge                     PCIVEN_1022&DEV_1402&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 2         
PCI standard host CPU bridge                     PCIVEN_1022&DEV_1403&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 3         
PCI standard host CPU bridge                     PCIVEN_1022&DEV_1404&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 4         
PCI standard host CPU bridge                     PCIVEN_1022&DEV_1405&SUBSYS_00000000&REV_00                     PCI bus 0, device 24, function 5         
PCI standard host CPU bridge                     PCIVEN_1022&DEV_1410&SUBSYS_14101022&REV_00                     PCI bus 0, device 0, function 0          
PCI Express standard Root Port                   PCIVEN_1022&DEV_1412&SUBSYS_12341022&REV_00                     PCI bus 0, device 2, function 0          
PCI Express standard Root Port                   PCIVEN_1022&DEV_1414&SUBSYS_12341022&REV_00                     PCI bus 0, device 4, function 0          
PCI Express standard Root Port                   PCIVEN_1022&DEV_1417&SUBSYS_12341022&REV_00                     PCI bus 0, device 7, function 0          
AMD IOMMU Device                                 PCIVEN_1022&DEV_1419&SUBSYS_14191022&REV_00                     PCI bus 0, device 0, function 2          
AMD SATA Controller                              PCIVEN_1022&DEV_7801&SUBSYS_B0021458&REV_40                     PCI bus 0, device 17, function 0         
Standard OpenHCD USB Host Controller             PCIVEN_1022&DEV_7807&SUBSYS_50041458&REV_11                     PCI bus 0, device 18, function 0         
Standard OpenHCD USB Host Controller             PCIVEN_1022&DEV_7807&SUBSYS_50041458&REV_11                     PCI bus 0, device 19, function 0         
Standard Enhanced PCI to USB Host Controller     PCIVEN_1022&DEV_7808&SUBSYS_50041458&REV_11                     PCI bus 0, device 18, function 2         
Standard Enhanced PCI to USB Host Controller     PCIVEN_1022&DEV_7808&SUBSYS_50041458&REV_11                     PCI bus 0, device 19, function 2         
Standard OpenHCD USB Host Controller             PCIVEN_1022&DEV_7809&SUBSYS_50041458&REV_11                     PCI bus 0, device 20, function 5         
AMD SMBus                                        PCIVEN_1022&DEV_780B&SUBSYS_780B1022&REV_14                     PCI bus 0, device 20, function 0         
High Definition Audio Controller                 PCIVEN_1022&DEV_780D&SUBSYS_A0021458&REV_01                     PCI bus 0, device 20, function 2         
PCI standard ISA bridge                          PCIVEN_1022&DEV_780E&SUBSYS_780E1022&REV_11                     PCI bus 0, device 20, function 3         
PCI standard PCI-to-PCI bridge                   PCIVEN_1022&DEV_780F&SUBSYS_00000000&REV_40                     PCI bus 0, device 20, function 4         
AMD USB 3.0 Host Controller                      PCIVEN_1022&DEV_7812&SUBSYS_50041458&REV_03                     PCI bus 0, device 16, function 0         
AMD USB 3.0 Host Controller                      PCIVEN_1022&DEV_7812&SUBSYS_50041458&REV_03                     PCI bus 0, device 16, function 1         
High Definition Audio Controller                 PCIVEN_10DE&DEV_0BEE&SUBSYS_35371458&REV_A1                     PCI bus 1, device 0, function 1          
NVIDIA GeForce GTX 550 Ti                        PCIVEN_10DE&DEV_1244&SUBSYS_35371458&REV_A1                     PCI bus 1, device 0, function 0          
Realtek PCIe GBE Family Controller               PCIVEN_10EC&DEV_8168&SUBSYS_E0001458&REV_06                     PCI bus 2, device 0, function 0          
MSI TV@Anywhere Plus                             PCIVEN_1131&DEV_7133&SUBSYS_62311462&REV_D1                     PCI bus 4, device 6, function 0          
Etron USB 3.0 Extensible Host Controller         PCIVEN_1B6F&DEV_7023&SUBSYS_50071458&REV_01                     PCI bus 3, device 0, function 0          

只是忽略VCL的东西。重要的是USBinfo()功能(是的,我用它来获取USB信息)。它将枚举所有设备(如在设备管理器中)匹配您启动它的字符串(其中3个类似的第2行补救)。要清楚AnsiString是字符串类(元素是从[1]而不是[0]访问)和DWORD是无符号32位int。 Main->mm_log只是TMemo,我输出结果。别忘了包括setupapi.h

该界面可以获取您在Windows设备管理器中找到的任何信息,只需使用您需要的SPDRP_属性(它们在setupapi.h中列出,这是我的包含:

#define SPDRP_DEVICEDE

以上是关于详细的PCI-E信息,Windows的主要内容,如果未能解决你的问题,请参考以下文章

Android:GoogleMaps 标记详细信息片段

PCI-E SSDM2 SSDSATA SSD测试

PCI-E SSDM2 SSDSATA SSD测试

如何让 Leanback 的详细信息片段不占用整个屏幕?

如何在Android中的主/细分片段之间进行适当的导航?

npm : 无法加载文件 D:softcodeProcess ode ode_global pm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.micr +(代码片段