allanzhou9527
驱动牛犊
驱动牛犊
  • 注册日期2006-03-01
  • 最后登录2008-01-17
  • 粉丝0
  • 关注0
  • 积分710分
  • 威望72点
  • 贡献值0点
  • 好评度71点
  • 原创分0分
  • 专家分0分
阅读:1576回复:5

几个简单的问题,帮我解除长时间的困惑

楼主#
更多 发布于:2007-09-25 18:45
1、系统标准输入输出设备如鼠标键盘等是系统独占的,可否通过CreateFile获得其句柄,从而得到该设备的VID和PID?
2、我想直接在注册表中找到我的USB设备的GUID,然后通过调用SetupDiGetClassDevs、SetupDiEnumDeviceInterfaces、SetupDiGetDeviceInterfaceDetail等函数得到设备路径,最后CreateFile得到设备句柄,该GUID应该在注册表的那个地方?(已知设备的VID和PID),该GUID会是函数SetupDiGetClassDevs的第一个参数。

谢谢!好几天了,困惑了好久,在这个坛子里搜索了所有的GUID的帖子,越看越糊涂,郁闷啊。
woiwoi0
驱动牛犊
驱动牛犊
  • 注册日期2008-03-22
  • 最后登录2008-09-12
  • 粉丝0
  • 关注0
  • 积分6分
  • 威望12点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2008-03-27 12:09
1.系统独占的用CreatFile可能是不能得到句柄的至少我没得到;
2.HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ Enum \ USB,下面还有一个USBSTOR,这两个的关系我也不清楚,正在找,知道了再说。
我也正在弄这个东西,很多东西也还不清楚,多多交流啦。
ylinux
驱动牛犊
驱动牛犊
  • 注册日期2007-10-09
  • 最后登录2009-02-25
  • 粉丝0
  • 关注0
  • 积分90分
  • 威望56点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2007-10-15 17:32
你应该想你的设备既是标准设又可以发送自定义数据吧?
把你的设备做成复合HID设备就行了.
gutian98
禁止发言
禁止发言
  • 注册日期2003-01-12
  • 最后登录2016-12-11
  • 粉丝4
  • 关注2
  • 积分760分
  • 威望8026点
  • 贡献值1点
  • 好评度364点
  • 原创分0分
  • 专家分21分
  • 金点子奖
  • 社区居民
地板#
发布于:2007-09-28 17:25
用户被禁言,该主题自动屏蔽!
yindajun
驱动牛犊
驱动牛犊
  • 注册日期2002-12-05
  • 最后登录2012-02-07
  • 粉丝0
  • 关注0
  • 积分24分
  • 威望221点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
地下室#
发布于: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.
rayyang2000
管理员
管理员
  • 注册日期2001-03-23
  • 最后登录2012-09-13
  • 粉丝3
  • 关注0
  • 积分1036分
  • 威望925点
  • 贡献值3点
  • 好评度823点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2007-09-28 12:12
第一个可以看一下usbview,它可以得到pid/vid
天天coding-debugging中----超稀饭memory dump file ======================================================== [b]Windows Device Driver Development and Consulting Service[/b] [color=blue][url]http://www.ybwork.com[/url][/color] ========================================================
游客

返回顶部