注册表操作总结
MSDN设备GUID定义:
系统定义的设备设置类保留供系统使用
系统定义的设备设置类可供供应商使用
36FC9E60-C465-11CF-8056-444553540000}\0011
通过注册表遍历查找USB3.0驱动
// bios.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "windows.h"
#pragma warning(disable:4996)
#pragma comment (lib,"Advapi32.lib")
int main(int argc, char* argv[])
{
HKEY hKEY;//定义有关的hKEY,在查询结束时要关闭
//打开与路径data_Set相关的hKEY
LPCTSTR data_Set = _T("SYSTEM\\ControlSet001\\Control\\Class\\{4d36e96c-e325-11ce-bfc1-08002be10318}\\0001");
//访问注册表,hKEY则保存此函数所打开的键的句柄
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, data_Set, 0, KEY_READ, &hKEY))
{
char DriverVersion[256];
char DriverDate[256];
DWORD dwSzType = REG_SZ;
DWORD dwSizeDriverVersion = sizeof(DriverVersion);
DWORD dwSizeDriverDate = sizeof(DriverDate);
if (RegQueryValueEx(hKEY, "DriverVersion", 0, &dwSzType, (LPBYTE)&DriverVersion, &dwSizeDriverVersion) != ERROR_SUCCESS)
{
printf("Error: unable to query information about the registry");
}
if (RegQueryValueEx(hKEY, "DriverDate", 0, &dwSzType, (LPBYTE)&DriverDate, &dwSizeDriverDate) != ERROR_SUCCESS)
{
printf("Error: unable to query information about the registry");
}
//程序结束,关闭打开的hKEY
RegCloseKey(hKEY);
printf("%s %s\n", DriverVersion, DriverDate);
return 0;
}
else
{
printf("Error: unable to query information about the registry");
return 1;
}
}
位置:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class
This class includes battery devices and UPS devices.
(Windows Server 2003 and later versions of Windows) This class includes all biometric-based personal identification devices.
(Windows XP SP1 and later versions of Windows) This class includes all Bluetooth devices.
This class includes CD-ROM drives, including SCSI CD-ROM drives. By default, the system's CD-ROM class installer also installs a system-supplied CD audio driver and CD-ROM changer driver as Plug and Play filters.
This class includes hard disk drives. See also the HDC and SCSIAdapter classes.
This class includes video adapters. Drivers for this class include display drivers and video miniport drivers.
This class includes floppy disk drive controllers.
This class includes floppy disk drives.
This class includes GNSS devices that use the Universal Windows driver model introduced in Windows 10.
This class includes hard disk controllers, including ATA/ATAPI controllers but not SCSI and RAID disk controllers.
This class includes interactive input devices that are operated by the system-supplied HID class driver. This includes USB devices that comply with the USB HID Standard and non-USB devices that use a HID minidriver. For more information, see HIDClass Device Setup Class. (See also the Keyboard or Mouse classes later in this list.)
This class includes devices that control the operation of multifunction IEEE 1284.4 peripheral devices.
This class includes Dot4 print functions. A Dot4 print function is a function on a Dot4 device and has a single child device, which is a member of the Printer device setup class.
This class includes IEEE 1394 devices that support the IEC-61883 protocol device class.
The 61883 component includes the 61883.sys protocol driver that transmits various audio and video data streams over the 1394 bus. These currently include standard/high/low quality DV, MPEG2, DSS, and Audio. These data streams are defined by the IEC-61883 specifications.
This class includes IEEE 1394 devices that support the AVC protocol device class.
This class includes IEEE 1394 devices that support the SBP2 protocol device class.
This class includes 1394 host controllers connected on a PCI bus, but not 1394 peripherals. Drivers for this class are system-supplied.
This class includes still-image capture devices, digital cameras, and scanners.
This class includes infrared devices. Drivers for this class include Serial-IR and Fast-IR NDIS miniports, but see also the Network Adapter class for other NDIS network adapter miniports.
This class includes all keyboards. That is, it must also be specified in the (secondary) INF for an enumerated child HID keyboard device.
This class includes SCSI media changer devices.
This class includes memory devices, such as flash memory cards.
This class includes modem devices. An INF file for a device of this class specifies the features and configuration of the device and stores this information in the registry. An INF file for a device of this class can also be used to install device drivers for a controllerless modem or a software modem. These devices split the functionality between the modem device and the device driver. For more information about modem INF files and Microsoft Windows Driver Model (WDM) modem devices, see Overview of Modem INF Files and Adding WDM Modem Support.
This class includes display monitors. An INF for a device of this class installs no device driver(s), but instead specifies the features of a particular monitor to be stored in the registry for use by drivers of video adapters. (Monitors are enumerated as the child devices of display adapters.)
This class includes all mouse devices and other kinds of pointing devices, such as trackballs. That is, this class must also be specified in the (secondary) INF for an enumerated child HID mouse device.
This class includes combo cards, such as a PCMCIA modem and netcard adapter. The driver for such a Plug and Play multifunction device is installed under this class and enumerates the modem and netcard separately as its child devices.
This class includes Audio and DVD multimedia devices, joystick ports, and full-motion video capture devices.
This class includes intelligent multiport serial cards, but not peripheral devices that connect to its ports. It does not include unintelligent (16550-type) multiport serial controllers or single-port serial controllers (see the Ports class).
This class includes NDIS miniport drivers excluding Fast-IR miniport drivers, NDIS intermediate drivers (of virtual adapters), and CoNDIS MCM miniport drivers.
This class includes network and/or print providers.
This class includes network services, such as redirectors and servers.
This class includes NDIS protocols CoNDIS stand-alone call managers, and CoNDIS clients, in addition to higher level drivers in transport stacks.
This class includes devices that accelerate secure socket layer (SSL) cryptographic processing.
This class includes PCMCIA and CardBus host controllers, but not PCMCIA or CardBus peripherals. Drivers for this class are system-supplied.
This class includes serial and parallel port devices. See also the MultiportSerial class.
This class includes printers.
This class includes SCSI/1394-enumerated printers. Drivers for this class provide printer communication for a specific bus.
This class includes processor types.
This class includes SCSI HBAs (Host Bus Adapters) and disk-array controllers.
(Windows 7 and later versions of Windows) This class includes sensor and location devices, such as GPS devices.
This class includes smart card readers.
This class includes storage volumes as defined by the system-supplied logical volume manager and class drivers that create device objects to represent storage volumes, such as the system disk class driver.
This class includes HALs, system buses, system bridges, the system ACPI driver, and the system volume manager driver.
This class includes tape drives, including all tape miniclass drivers.
USBDevice includes all USB devices that do not belong to another class. This class is not used for USB host controllers and hubs.
This class includes Windows CE ActiveSync devices.
The WCEUSBS setup class supports communication between a personal computer and a device that is compatible with the Windows CE ActiveSync driver (generally, PocketPC devices) over USB.
(Windows Vista and later versions of Windows) This class includes WPD devices.
(Windows Vista and later versions of Windows) This class includes all devices that are compatible with Windows SideShow.