英文:
Capture mouse HID packets on windows using C++?
问题
我想摒弃Razer Synapse,因为它占用了高达600MB的内存,却毫无用处。我只想使用我的宏来控制我Razer Deathadder上的两个额外按键。我已经成功地使用C++ HID API捕获了我的Corsair K95键盘的HID数据包,并执行了我的宏,最终能够告别iCUE。但我无法将鼠标作为HID设备打开。一切都应该配置正确,包括VID/PID、UsagePage和Usage。但有趣的是,Wireshark可以捕获鼠标,但对我来说却不能,即使我尝试以管理员权限打开它也不行。有人有任何想法我应该怎么做吗?
我尝试过HIDAPI C++库的hidapitester应用程序,它会自动关闭设备并不接收任何数据。如果不能以这种方式解决,我应该采取哪种方法来捕获数据包呢?
谢谢。
英文:
I want to ditch Razer Synapse because it eats up to 600MB of RAM for nothing. I just want to use my macros for two additional keys found on my Razer Deathadder. I've sucessfully captured the HID packets for my Corsair K95 keyboard with C++ HID API and executed my macros, finally was able to say bye bye to iCUE. But I'm not able to open mouse as HID device. Everything should be configured properly, VID/PID, UsagePage and Usage too. But the interesting thing is that wireshark is able to capture the mouse, for me it doesn't for even when I try to open it with admin priveliges. Does somebody have any idea what I should do?
I've tried hidapitester application which is part of HIDAPI C++ library, it automatically closes the device and doesn't receive anything. If it's not possible to solve it in this way, which approach I should use to be able to capture the packets?
Thank you.
答案1
得分: 1
你不能打开键盘和鼠标 HID 设备句柄,出于安全原因(这样你就无法编写键盘记录器等)。这是 Windows 的设计之一。
官方解决方法是编写键盘/鼠标过滤驱动程序。
英文:
You cannot open keyboard and mouse hid device handles for a security reasons (so you can’t write a keylogger etc). It by design in Windows.
Official workaround is to write a keyboard/mouse filter driver.
https://learn.microsoft.com/en-us/samples/microsoft/windows-driver-samples/mouse-input-wdf-filter-driver-moufiltr/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论