SetupDi系列函数
SetupDiClassGuidsFromName
WINSETUPAPI BOOL SetupDiClassGuidsFromNameA( PCSTR ClassName,
LPGUID ClassGuidList,
DWORD ClassGuidListSize,
PDWORD RequiredSize );
SetupDiClassGuidsFromName函数检索与指定类名关联的GUID。
ClassName:要检索的GUID的类名字;
ClassGuidList:一个数组的指针,以获得与指定类名称关联的GUID列表;
ClassGuidListSize:ClassGuidList列表数组中GUID的数量;
RequiredSize :提供一个指向变量的指针,该变量接收与类名关联的guid数。如果这个数字大于ClassGuidList缓冲区的大小,那么这个数字表示为了存储所有的guid,数组必须有多大。
返回值:
如何调用成功返回TRUE,失败返回FALSE;
SetupDiGetClassDevs
WINSETUPAPI HDEVINFO SetupDiGetClassDevsW( const GUID *ClassGuid,
PCWSTR Enumerator,
HWND hwndParent,
DWORD Flags );
该函数返回一个设备信息集的句柄看,该设备信息集包含本地计算机所请求的设备信息元素。
参数:
ClassGuid:一个指向设备安装类或设备接口类的GUID的指针;该指针是随意的也可以为空。
Enumerator:一个指向空字符结尾的字符串,列举如下:
即插即用设备枚举树的ID,此ID既可以是全局唯一标识符(GUID)也可以是符号名称。比如:“PCI”可以用于指定PCI的PnP值,符号名称则包括像“USB”,“PCMCIA”和“SCSI”这样的Pnp值。
一个PnP设备句柄ID。当指定了一个PnP设备句柄ID时,DIGCF_DEVICEINTERFACE必须在Flag参数上被设置。
hwndParent:用于与在设备信息集中安装设备实例相关联的用户界面的顶级窗口句柄。该句柄是可选的,并且可以为NULL。
Flags : Flags是一个DWORD类型的变量,通过此参数来过滤指定的设备信息集中的设备。此参数可以是以下标志位中的一个或多个的按位或组合。
DIGCF_ALLCLASSES
返回所有已安装设备的列表或所有设备接口类。
DIGCF_DEVICEINTERFACE
返回支持指定设备接口类的设备。如果Enumerators参数制定了设备的实例ID,那么必须在Flags参数中设置此标志位。
DIGCF_DEFAULT
对于指定的设备接口类,只返回与系统默认设备接口相关联的设备(如果已设置的话)。
DIGCF_PRESENT
只返回当前系统中存在的(已连接)设备。
DIGCF_PROFILE
只返回当前硬件列表中的一部分设备。
返回值
如果调用成功,SetupDiGetClassDevs将返回一个设备信息集的句柄,该句柄包含了与所提供参数所匹配的所有设备。如果调用失败,函数返回INVALID_HANDLE_VALUE。要进一步获取错误信息,请调用GetLastError。
SetupDiEnumDeviceInfo 函数
WINSETUPAPI BOOL SetupDiEnumDeviceInfo( HDEVINFO DeviceInfoSet,
DWORD MemberIndex,
PSP_DEVINFO_DATA DeviceInfoData );
说明:
功能:返回一个SP_DEVINFO_DATA结构体,这个结构体是在一个设备信息集中指定的一个设备信息元素
反复的调用该函数会返回不同设备的设备信息元素。
枚举设备信息元素,最初调用该函数时要将MemberIndex参数设置为0,然后每次调用递增MemberIndex参数的值,直到没有更多设备的设备信息元素返回(即
SetupDiEnumDeviceInfo函数调用失败,使用GetLastError函数会返回ERROR_NO_MORE_ITEMS);
参数:
DeviceInfoSet:设备信息集的句柄,用于返回表示设备信息元素的PSP_DEVINFO_DATA 数据结构。
MemberIndex:要检索的从零开始的设备信息元素。
DeviceInfoData :指向PSP_DEVINFO_DATA 数据结构的指针,用于接收关于枚举设备信息元素的信息。调用者必须设置DeviceInfoData。
cbSize设置成sizeof(PSP_DEVINFO_DATA )。
返回值:
如果成功返回TRUE,失败返回FALSE;
SetupDiGetDeviceRegistryProperty 函数
WINSETUPAPI BOOL SetupDiGetDeviceRegistryPropertyA( HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
DWORD Property,
PDWORD PropertyRegDataType,
PBYTE PropertyBuffer,
DWORD PropertyBufferSize,
PDWORD RequiredSize );
该函数用于检索一个指定的即插即用设备的属性;
参数:
DeviceInfoSet:指向一个设备信息集的指针,表示要检索即插即用属性的设备。
DeviceInfoData:一个PSP_DEVINFO_DATA 结构体,指定DeviceInfoSet中的设备信息元素。
Property:以下要被检索的指定属性:
SPDRP_ADDRESS
The function retrieves the device's address.
SPDRP_BUSNUMBER
The function retrieves the device's bus number.
SPDRP_BUSTYPEGUID
The function retrieves the GUID for the device's bus type.
SPDRP_CAPABILITIES
The function retrieves a bitwise OR of the following CM_DEVCAP_Xxx flags in a DWORD. The device capabilities that are represented by these flags correspond to the device capabilities that are represented by the members of the DEVICE_CAPABILITIES structure. The CM_DEVCAP_Xxx constants are defined in Cfgmgr32.h.
CM_DEVCAP_Xxx flag | Corresponding DEVICE_CAPABILITIES structure member |
---|---|
CM_DEVCAP_LOCKSUPPORTED | LockSupported |
CM_DEVCAP_EJECTSUPPORTED | EjectSupported |
CM_DEVCAP_REMOVABLE | Removable |
CM_DEVCAP_DOCKDEVICE | DockDevice |
CM_DEVCAP_UNIQUEID | UniqueID |
CM_DEVCAP_SILENTINSTALL | SilentInstall |
CM_DEVCAP_RAWDEVICEOK | RawDeviceOK |
CM_DEVCAP_SURPRISEREMOVALOK | SurpriseRemovalOK |
CM_DEVCAP_HARDWAREDISABLED | HardwareDisabled |
CM_DEVCAP_NONDYNAMIC | NonDynamic |
SPDRP_CHARACTERISTICS
The function retrieves a bitwise OR of a device's characteristics flags in a DWORD. For a description of these flags, which are defined in Wdm.h and Ntddk.h, see the DeviceCharacteristics parameter of the IoCreateDevice function.
SPDRP_CLASS
The function retrieves a REG_SZ string that contains the device setup class of a device.
SPDRP_CLASSGUID
The function retrieves a REG_SZ string that contains the GUID that represents the device setup class of a device.
SPDRP_COMPATIBLEIDS
The function retrieves a REG_MULTI_SZ string that contains the list of compatible IDs for a device. For information about compatible IDs, see Device Identification Strings.
SPDRP_CONFIGFLAGS
The function retrieves a bitwise OR of a device's configuration flags in a DWORD value. The configuration flags are represented by the CONFIGFLAG_Xxx bitmasks that are defined in Regstr.h.
SPDRP_DEVICE_POWER_DATA
(Windows XP and later) The function retrieves a CM_POWER_DATA structure that contains the device's power management information.
SPDRP_DEVICEDESC
The function retrieves a REG_SZ string that contains the description of a device.
SPDRP_DEVTYPE
The function retrieves a DWORD value that represents the device's type. For more information, see Specifying Device Types.
SPDRP_DRIVER
The function retrieves a string that identifies the device's software key (sometimes called the driver key). For more information about driver keys, see Registry Trees and Keys for Devices and Drivers.
SPDRP_ENUMERATOR_NAME
The function retrieves a REG_SZ string that contains the name of the device's enumerator.
SPDRP_EXCLUSIVE
The function retrieves a DWORD value that indicates whether a user can obtain exclusive use of the device. The returned value is one if exclusive use is allowed, or zero otherwise. For more information, see IoCreateDevice.
SPDRP_FRIENDLYNAME
The function retrieves a REG_SZ string that contains the friendly name of a device.
SPDRP_HARDWAREID
The function retrieves a REG_MULTI_SZ string that contains the list of hardware IDs for a device. For information about hardware IDs, see Device Identification Strings.
SPDRP_INSTALL_STATE
(Windows XP and later) The function retrieves a DWORD value that indicates the installation state of a device. The installation state is represented by one of the CM_INSTALL_STATE_Xxxvalues that are defined in Cfgmgr32.h. The CM_INSTALL_STATE_Xxx values correspond to the DEVICE_INSTALL_STATE enumeration values.
SPDRP_LEGACYBUSTYPE
The function retrieves the device's legacy bus type as an INTERFACE_TYPE value (defined in Wdm.h and Ntddk.h).
SPDRP_LOCATION_INFORMATION
The function retrieves a REG_SZ string that contains the hardware location of a device.
SPDRP_LOCATION_PATHS
(Windows Server 2003 and later) The function retrieves a REG_MULTI_SZ string that represents the location of the device in the device tree.
SPDRP_LOWERFILTERS
The function retrieves a REG_MULTI_SZ string that contains the names of a device's lower-filter drivers.
SPDRP_MFG
The function retrieves a REG_SZ string that contains the name of the device manufacturer.
SPDRP_PHYSICAL_DEVICE_OBJECT_NAME
The function retrieves a REG_SZ string that contains the name that is associated with the device's PDO. For more information, see IoCreateDevice.
SPDRP_REMOVAL_POLICY
(Windows XP and later) The function retrieves the device's current removal policy as a DWORD that contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.
SPDRP_REMOVAL_POLICY_HW_DEFAULT
(Windows XP and later) The function retrieves the device's hardware-specified default removal policy as a DWORD that contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.
SPDRP_REMOVAL_POLICY_OVERRIDE
(Windows XP and later) The function retrieves the device's override removal policy (if it exists) from the registry, as a DWORD that contains one of the CM_REMOVAL_POLICY_Xxx values that are defined in Cfgmgr32.h.
SPDRP_SECURITY
The function retrieves a SECURITY_DESCRIPTOR structure for a device.
SPDRP_SECURITY_SDS
The function retrieves a REG_SZ string that contains the device's security descriptor. For information about security descriptor strings, see Security Descriptor Definition Language (Windows). For information about the format of security descriptor strings, see Security Descriptor Definition Language (Windows).
SPDRP_SERVICE
The function retrieves a REG_SZ string that contains the service name for a device.
SPDRP_UI_NUMBER
The function retrieves a DWORD value set to the value of the UINumber member of the device's DEVICE_CAPABILITIES structure.
SPDRP_UI_NUMBER_DESC_FORMAT
The function retrieves a format string (REG_SZ) used to display the UINumber value.
SPDRP_UPPERFILTERS
The function retrieves a REG_MULTI_SZ string that contains the names of a device's upper filter drivers.
PropertyRegDataType:指向一个变量的指针,该变量接收正在检索的属性的数据类型。这是标准注册表数据类型之一。此参数是可选的,可以为空。
PropertyBuffer:一个指向缓冲区的指针,该缓冲区接收要检索的属性。如果将该参数设置为NULL,并将PropertyBufferSize设置为0,则函数将在RequiredSize中返回 缓冲区所需的大小。
PropertyBufferSize:属性缓冲区大小;
RequiredSize:指向类型为DWORD的变量的指针,该变量接收PropertyBuffer缓冲区所需大小(以字节为单位),该缓冲区用于保存所请求属性的数据。此参数是可选 的,可以为空
返回值:
如果调用成功返回TRUE,失败返回FALSE;
SetupDiOpenDevRegKey
WINSETUPAPI HKEY SetupDiOpenDevRegKey( HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
DWORD Scope,
DWORD HwProfile,
DWORD KeyType,
REGSAM samDesired );
SetupDiOpenDevRegKey函数为特定设备的配置信息打开注册表项。
参数:
DeviceInfoSet:设备信息集的句柄,该句柄包含一个设备信息元素,该元素表示要为其打开注册表项的设备。
DeviceInfoData:一个指向SP DEVINFO数据结构的指针,该结构指定DeviceInfoSet中的设备信息元素。
Scope:要打开的注册表项的范围。范围决定信息存储在何处。范围可以是全局的,也可以是特定于硬件配置文件的。范围由下列值之一指定:
DICS_FLAG_GLOBAL
打开存储全局配置信息的键值项。此信息并不特定于特定的硬件配置文件。这将打开一个根在 HKEY_LOCAL_MACHINE。打开的确切键取决于KeyType的值。
DICS_FLAG_CONFIGSPECIFIC
打开存储特定于硬件概要文件的配置信息的键值项。此键根植于硬件配置文件特定的分支之一,而不是HKEY_LOCAL_MACHINE。打开的确切键取决于KeyType的值。
HwProfile:硬件配置文件值,设置如下:
- If Scope is set to DICS_FLAG_CONFIGSPECIFIC, HwProfile specifies the hardware profile of the key that is to be opened.
- If HwProfile is 0, the key for the current hardware profile is opened.
- If Scope is DICS_FLAG_GLOBAL, HwProfile is ignored.
(如果HwProfile为0,打开当前硬件配置文件的键。)
KeyType:要打开的注册表存储键的类型,可以是以下值之一:
DIREG_DEV
Open a hardware key for the device.
DIREG_DRV
Open a software key for the device.
For more information about a device's hardware and software keys, see Registry Trees and Keys for Devices and Drivers.
samDesired:请求的键值项所需的注册表安全访问。
返回值:
如果函数成功,它将返回打开的注册表项的句柄,其中可以存储/检索关于此设备实例的私有配置数据。
如果失败返回INVALID_HANDLE_VALUE。
RegQueryValueEx(E)函数
函数RegQueryValueEx找回一个打开的注册表键值相关联的给定的变量数据或者变量。
LONG RegQueryValueEx(
HKEY hKey, // handle to key 主键句柄
LPCTSTR lpValueName, // value name 子键名称
LPDWORD lpReserved, // reserved 保留
LPDWORD lpType, // type buffer
LPBYTE lpData, // data buffer 存储返回值的缓冲区
LPDWORD lpcbData // size of data buffer存储返回值的缓冲区的大小
);
---------------------
作者:ju_feng
来源:CSDN
原文:https://blog.csdn.net/ju_feng/article/details/6459
版权声明:本文为博主原创文章,转载请附上博文链接!
SetupDi系列函数的更多相关文章
- PHP进程通信基础——shmop 、sem系列函数使用
PHP进程通信基础--shmop .sem系列函数使用 进程通信的原理就是在系统中开辟出一个共享区域,不管是管道也好,还是共享内存,都是这个原理.如果心中有了这个概念,就会很方便去理解代码.由于官网上 ...
- PHP 使用 curl_* 系列函数和 curl_multi_* 系列函数进行多接口调用时的性能对比
在页面中调用的服务较多时,使用并行方式,即使用 curl_multi_* 系列函数耗时要小于 curl_* 系列函数. 测试环境 操作系统:Windows x64 Server:Apache PHP: ...
- 第8章 用户模式下的线程同步(1)_Interlocked系列函数
8.1 原子访问:Interlocked系列函数(Interlock英文为互锁的意思) (1)原子访问的原理 ①原子访问:指的是一线程在访问某个资源的同时,能够保证没有其他线程会在同一时刻访问该资源. ...
- PHP ob系列函数详解
一. 相关函数简介: 1.Flush:刷新缓冲区的内容,输出. 函数格式:flush() 说明:这个函数经常使用,效率很高. 2.ob_start :打开输出缓冲区 函数 ...
- Linux中exec()执行文件系列函数的使用说明
函数原型: 描述: exec()系列函数使用新的进程映像替换当前进程映像. 工作方式没有什么差别, 只是参数传递的方式不同罢了. 说明: 1. 这6个函数可分为两大类: execl( ...
- php Output Control 函数 ob_系列函数详解
<?php /* * 输出缓冲控制 * * flush — 刷新输出缓冲 ob_clean — 清空(擦掉)输出缓冲区 ob_end_clean — 清空(擦除)缓冲区并关闭输出缓冲 ob_en ...
- 从简单需求到OLAP的RANK系列函数
同事问了一个非常简单的问题,怎么取出每个partition里面另外一个列的最小值? create table t1 (int c1, int c2); 假如按照c2分区,0-10,10-20,20 ...
- PHP 载入图像 imagecreatefrom_gif_jpeg_png 系列函数
imagecreatefrom 系列函数用于从文件或 URL 载入一幅图像. 载入图像 imagecreatefrom 系列函数用于从文件或 URL 载入一幅图像,成功返回图像资源,失败则返回一个空字 ...
- PHP中ob系列函数整理
ob,输出缓冲区,是output buffering的简称,而不是output cache.ob用对了,是能对速度有一定的帮助,但是盲目的加上ob函数,只会增加CPU额外的负担. 下面我说说ob的基本 ...
随机推荐
- 一、Nginx的安装
1.下载nginx软件 http://nginx.org/download/ 2.安装依赖包 [root@client ~]# useradd -s /sbin/nologin nginx 创建ngi ...
- 从Vehicle-ReId到AI换脸,应有尽有,解你所惑
最近在做视频搜索的技术调研,已经初步有了一些成果输出,算法准确性还可以接受,基本达到了调研的预期.现将该技术调研过程中涉及到的内容总结一篇文章分享出来,内容比较多,初看起来可能关系不大,但是如果接触面 ...
- 彻底删除Docker
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-la ...
- Spring Cloud Gateway简单入门,强大的微服务网关
我最新最全的文章都在南瓜慢说 www.pkslow.com,欢迎大家来喝茶! 1 简介 见名知义,Spring Cloud Gateway是用于微服务场景的网关组件,它是基于Spring WebFlu ...
- 『言善信』Fiddler工具 — 17、Fiddler常用插件(Willow)
目录 1.Traific Difer插件 2.PDF View插件 3.JavaScript Formatter插件 4.CertMaker for iOS and Android插件 5.Synta ...
- C# 位图BitArray 小试牛刀
前面聊了布隆过滤器,回归认识一下位图BitMap,阅读前文的同学应该发现了布隆过滤器本身就是基于位图,是位图的一种改进. 位图 先看一个问题, 假如有1千万个整数,整数范围在1到1亿之间,如何快速确定 ...
- windows 安装Git详解
windows 安装Git详解 一.Git简介 Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理. Git 是 Linus Torvalds 为了帮助管理 Lin ...
- excel VBA数组运用
Sub a()Dim i人数 As Integer'定义变量Dim i考试成绩() As Integer'定义数组Dim i As Integer'定义变量i人数 = InputBox("输 ...
- MySQL基本sql语句总结
目录 约束 表操作 查看表结构与修改表名 修改字段名与字段数据类型 添加与删除字段 修改字段的排列位置 删除表的外键约束 增删改 插入数据 更新数据 删除数据 查询 单表查询 连接查询 子查询 视图 ...
- 10 一键部署LNMP网站平台
#!/bin/bash export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin NGINX_V=1.19.1 P ...