创建虚拟 HID 设备

发布于 2024-11-17 15:08:17 字数 567 浏览 10 评论 0原文

我想创建一个虚拟 HID 设备(用驱动程序模拟它)。

它必须对实现标准 HID 检测的客户端可见:

  • 调用 HidD_GetHidGuid() – 获取 HID 设备类 GUID
  • 调用 SetupDiGetClassDevs() – 获取 处理一组设备 实现 HID 接口
  • 调用 SetupDiEnumDeviceInterfaces() – 对于返回集中的每个设备 设备,获取接口 所有暴露的 HID 的信息 接口。
  • 称呼 SetupDiGetDeviceInterfaceDetail() – 对于每个接口中获得的 上次通话,获取详细信息 该接口的信息块。 这些详细信息包括 可以传递给的字符串 CreateFile() 打开一个句柄 设备
  • 调用SetupDiDestroyDeviceInfoList() – 释放设备信息集 这是在调用中获得的 设置DiGetClassDevs()。

该设备还应该支持读取,因此 CreateFile / ReadFile 将返回我从驱动程序提供的数据。

我真的不知道从哪里开始,因为我没有太多经验。在内核开发中。 :(

I'd like to create a virtual HID device (emulate it with a driver).

It must be visible to clients that implement standard HID detection:

  • Call HidD_GetHidGuid() – Get the HID
    device class GUID
  • Call SetupDiGetClassDevs() – Get a
    handle to a set of devices which
    implement the HID interface
  • Call SetupDiEnumDeviceInterfaces() –
    For each device in the returned set
    of devices, obtain the interface
    information for all exposed HID
    interfaces.
  • Call
    SetupDiGetDeviceInterfaceDetail() –
    For each interface obtained in the
    previous call, get the detailed
    information block for that interface.
    This detailed information includes
    the string that can be passed to
    CreateFile() to open a handle to the
    device
  • Call SetupDiDestroyDeviceInfoList() –
    Free up the device information set
    that was obtained in the call to
    SetupDiGetClassDevs().

The device should also support reading, so CreateFile / ReadFile would return data supplied by me from the driver.

I don't really know where to begin, as I don't have a lot of exp. in kernel dev. :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

挥剑断情 2024-11-24 15:08:17

有些人很幸运地将 vmulti 项目作为基础 http://code.google.com/p/ vmulti/

Some people have had luck with the vmulti project as a base http://code.google.com/p/vmulti/

回忆躺在深渊里 2024-11-24 15:08:17

您应该编写一个驱动程序,然后使用 DevCon(设备控制台工具)和 install 选项。


cmdInstall

cmdUpdate 的变体,用于在没有关联硬件时安装驱动程序。它创建一个新的根枚举设备实例,并将其与命令行上指定的组成硬件 ID 相关联(应对应于 INF 中的硬件 ID)。这无法在远程计算机上或在 Wow64 环境中完成。


http://code.msdn.microsoft.com/windowshardware/DevCon-Sample-4e95d71c < /一>

<一href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com /en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx

http://msdn.microsoft.com /en-us/library/windows/hardware/ff544780%28v=vs.85%29.aspx

You sholud write a driver, then use DevCon (Device Console Tool) with install option.


cmdInstall:

A variation of cmdUpdate to install a driver when there is no associated hardware. It creates a new root-enumerated device instance and associates it with a made up hardware ID specified on the command line (which should correspond to a hardware ID in the INF). This cannot be done on a remote machine or in the context of Wow64.


http://code.msdn.microsoft.com/windowshardware/DevCon-Sample-4e95d71c

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544780%28v=vs.85%29.aspx

沦落红尘 2024-11-24 15:08:17

请参阅 vhidmini ddk 示例驱动程序。它位于 1830 DDK 版本中,但不是最新版本。或者 Oney 书中的 hidfake 样本。

请参阅http://www.microsoft.com/mspress/books/sampchap/6262。 ASPX

see the vhidmini ddk sample driver. It was in the version 1830 DDK but is not in the latest version. alternatively the hidfake sample in Oney's book.

See http://www.microsoft.com/mspress/books/sampchap/6262.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文