SetupAPI 根据类GUID获取类描述符信息SetupDiGetClassDescriptionEx devcon.exe classes
2022-01-27
266
0
Windows设备的一种管理方式就是在安装设备驱动的时候,通过INF文件中的Class和ClassGUID来设置,如
Class=USB
ClassGuid={36FC9E60-C465-11CF-8056-444553540000}
当设备驱动安装后,可以通过SetupDiClassNameFromGuidEx和SetupDiClassGuidsFromNameEx函数在Class名和ClassGUID之间进行转换。
当然我们也可以使用SetupDiGetClassDescriptionEx函数获取类的描述符信息。
#define LINE_LEN 256
TCHAR classDesc[LINE_LEN];
if(!SetupDiGetClassDescriptionEx(&guids[index],classDesc,LINE_LEN,NULL,Machine,NULL))
{
if (FAILED(StringCchCopy(classDesc,LINE_LEN,className)))
{
goto final;
}
}
当然我们也可以通过DevCon来显示系统中所有的设备类,命令行为:
devcon.exe classes
输出内容如下:
- XboxComposite : Xbox Peripherals
- RemotePosDevice : POS Remote Device
- DigitalMediaDevices : Digital Media Devices
- PrintQueue : Print queues
- PSM : Intel?Power Sharing Manager
- WCEUSBS : Mobile devices
- Security Accelerator: Security accelerators
- HidMsr : POS HID Magnetic Stripe Reader
- SystemRecovery : FS System recovery filters
- USB : Universal Serial Bus controllers
- ContentScreener : FS Content screener filters
- Media Center Extender: Media Center Extenders
- PnpPrinters : IEEE 1394 and SCSI printers
- Dot4 : IEEE 1284.4 devices
- Replication : FS Replication filters
- Dot4Print : IEEE 1284.4 compatible printers
- CDROM : DVD/CD-ROM drives
- Computer : Computer
- DiskDrive : Disk drives
- Display : Display adapters
- FDC : Floppy drive controllers
- HDC : IDE ATA/ATAPI controllers
- Keyboard : Keyboards
- MEDIA : Sound, video and game controllers
- Modem : Modems
- Monitor : Monitors
- Mouse : Mice and other pointing devices
- MTD : Memory technology devices
- MultiFunction : Multifunction adapters
- Net : Network adapters
- NetClient : Network Client
- NetService : Network Service
- NetTrans : Network Protocol
- PCMCIA : PCMCIA adapters
- Ports : Ports (COM & LPT)
- Printer : Printers
- SCSIAdapter : Storage controllers
- System : System devices
- Unknown : Other devices
- FloppyDisk : Floppy disk drives
- Processor : Processors
- MultiPortSerial : Multi-port serial adapters
- Memory : Memory devices
- SmartCardReader : Smart card readers
- Sensor : Sensors
- VolumeSnapshot : Storage volume shadow copies
- ScmDisk : Persistent memory disks
- ScmVolume : Storage Class Memory volumes
- Biometric : Biometric devices
- Proximity : Proximity devices
- AudioProcessingObject: Audio Processing Objects (APOs)
- SoftwareComponent : Software components
- FSFilterSystem : FS System filters
- SoftwareDevice : Software devices
- PhysicalQuotaManagement: FS Physical quota management filters
- 1394 : IEEE 1394 host controllers
- Infrared : Infrared devices
- Image : Imaging devices
- TapeDrive : Tape drives
- Volume : Storage volumes
- ContinuousBackup : FS Continuous backup filters
- Battery : Batteries
- HIDClass : Human Interface Devices
- HidCashDrawer : POS Cash Drawer
- 61883 : 61883 devices
- QuotaManagement : FS Quota management filters
- TS_Generic : Generic Remote Desktop devices
- USBDevice : Universal Serial Bus devices
- CopyProtection : FS Copy protection filters
- LegacyDriver : Non-Plug and Play drivers
- SmartCard : Smart cards
- Ramdisk : RAM Disk drives
- EhStorSilo : IEEE 1667 silo and control devices
- SDHost : SD host adapters
- Encryption : FS Encryption filters
- AntiVirus : FS Anti-virus filters
- ActivityMonitor : FS Activity monitor filters
- USBFunctionController: Universal Serial Bus Function controllers
- AVC : Audio/video control devices
- AudioEndpoint : Audio inputs and outputs
- BarcodeScanner : POS Barcode Scanner
- WSDPrintDevice : WSD Print Provider
- POSPrinter : POS Receipt Printer
- CFSMetadataServer : FS CFS metadata server filters
- MediumChanger : Medium Changer devices
- SecurityEnhancer : FS Security enhancer filters
- Miracast : Miracast display devices
- SBP2 : SBP2 IEEE 1394 devices
- HSM : FS HSM filters
- XnaComposite : Xbox 360 Peripherals
- SecurityDevices : Security devices
- SmartCardFilter : Smart card filters
- Bluetooth : Bluetooth
- Extension : Extensions
- Infrastructure : FS Infrastructure filters
- WPD : Portable Devices
- Firmware : Firmware
- Compression : FS Compression filters
- Virtualization : FS Virtualization filters
- OpenFileBackup : FS Open file backup filters
- Undelete : FS Undelete filters