阅读:1576回复:5
几个简单的问题,帮我解除长时间的困惑
1、系统标准输入输出设备如鼠标键盘等是系统独占的,可否通过CreateFile获得其句柄,从而得到该设备的VID和PID?
2、我想直接在注册表中找到我的USB设备的GUID,然后通过调用SetupDiGetClassDevs、SetupDiEnumDeviceInterfaces、SetupDiGetDeviceInterfaceDetail等函数得到设备路径,最后CreateFile得到设备句柄,该GUID应该在注册表的那个地方?(已知设备的VID和PID),该GUID会是函数SetupDiGetClassDevs的第一个参数。 谢谢!好几天了,困惑了好久,在这个坛子里搜索了所有的GUID的帖子,越看越糊涂,郁闷啊。 |
|
沙发#
发布于:2008-03-27 12:09
1.系统独占的用CreatFile可能是不能得到句柄的至少我没得到;
2.HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Enum \ USB,下面还有一个USBSTOR,这两个的关系我也不清楚,正在找,知道了再说。 我也正在弄这个东西,很多东西也还不清楚,多多交流啦。 |
|
板凳#
发布于:2007-10-15 17:32
你应该想你的设备既是标准设又可以发送自定义数据吧?
把你的设备做成复合HID设备就行了. |
|
地板#
发布于:2007-09-28 17:25
用户被禁言,该主题自动屏蔽! |
|
地下室#
发布于:2007-09-28 14:08
for a USB bus, an identifier consists of a vendor ID (VID) for the hardware vendor that made the device and a product ID (PID) that the vendor assigned to the device. (See the DDK for more information on device ID formats.) Together these IDs form what Plug and Play calls a device ID. The PnP manager also queries the bus driver for an instance ID to help it distinguish different instances of the same hardware. The instance ID can describe either a bus-relative location (for example, the USB port) or a globally unique descriptor (for example, a serial number). The device ID and instance ID are combined to form a device instance ID (DIID), which the PnP manager uses to locate the device's key in the enumeration branch of the registry (HKLM\SYSTEM\CurrentControlSet\Enum). Figure 9-28 presents an example of a keyboard's enumeration subkey. The device's key contains descriptive data and includes values named Service and ClassGUID (which are obtained from a driver's INF file) that help the PnP manager locate the device's drivers.
|
|
5楼#
发布于:2007-09-28 12:12
第一个可以看一下usbview,它可以得到pid/vid
|
|
|