简体   繁体   English

低级鼠标挂钩不会在管理进程中触发mousedown / mouseup事件

[英]Low level mouse hook doesn't fire mousedown/mouseup event on admin process

I'm now editing this item since I think I have pinpointed the issue, this seems to be an OS bug for Win8.1 and Win10. 我现在正在编辑这个项目,因为我认为我已经确定了问题,这似乎是Win8.1和Win10的操作系统错误。 Issue summary is still same as before "Low level mouse hook doesn't fire mousedown/mouseup event on admin process" ... for admin apps if a non-admin starts its own low level hook. 问题摘要仍然与以前相同“低级鼠标挂钩不会在管理进程上触发mousedown / mouseup事件” ...对于管理员应用程序,如果非管理员启动其自己的低级别挂钩。

Steps to reproduce issue: 重现问题的步骤:

  1. Download demo app here 在这里下载演示应用
  2. Run the app as admin 以管理员身份运行该应用
  3. Make sure to monitor mouse up/down/click events 确保监控鼠标上/下/点击事件
  4. Confirm that the app started on step #2 is able to monitor mouse up/down/click events on admin processes (including on its own window) 确认在步骤#2上启动的应用程序能够监控管理进程上的鼠标上/下/点击事件(包括在其自己的窗口上)
  5. Run another instance of the app as non-admin 以非管理员身份运行该应用的另一个实例
  6. Make sure to monitor mouse up/down/click events 确保监控鼠标上/下/点击事件

Result: notice that the app's instance running as admin (started on #2) is now unable to get mouse up/down/click events, but it can still get other mouse events and all keyboard events 结果:请注意,作为管理员运行的应用程序实例(从#2开始)现在无法获得鼠标上/下/点击事件,但它仍然可以获取其他鼠标事件和所有键盘事件

Has anyone encountered this issue? 有没有人遇到过这个问题?

OP: OP:

...and it confirmed that mouseup/mousedown events are not getting triggered when foreground window is running as admin . ...它证实,当前台窗口正在作为管理员的mouseup / MouseDown事件中,没有得到触发。

OP: OP:

if my app is not running as admin then I cannot get all mouse/keyboard events, 如果我的应用程序没有 以管理员身份运行那么我无法获得所有鼠标/键盘事件,

Starting with Vista, it was not possible for an app to post messages to or install hooks on an elevated app. 从Vista开始,应用程序无法在提升的应用程序上发布消息或安装挂钩。 This is accomplished via User Interface Privilege Isolation (UIPI) and integrity (see below). 这是通过用户界面权限隔离(UIPI)和完整性 (见下文)完成的。

MSDN: MSDN:

UIPI does not interfere with or change the behavior of window messaging between applications at the same privilege (or integrity) level. UIPI不会干扰或更改同一特权(或完整性)级别的应用程序之间窗口消息传递的行为。 UIPI prevents lower-privilege processes from accessing higher-privilege processes by blocking the following behavior. UIPI通过阻止以下行为来防止低权限进程访问更高权限的进程 A lower-privilege process cannot : 较低权限的进程不能

  • Perform a window handle validation of a process running with higher rights. 对具有更高权限的进程执行窗口句柄验证。
  • Use SendMessage or PostMessage to application windows running with higher rights. 将SendMessage或PostMessage用于以更高权限运行的应用程序窗口。 These APIs return success but silently drop the window message. 这些API返回成功但静默删除窗口消息。
  • Use thread hooks to attach to a process running with higher rights. 使用线程挂钩附加到以更高权限运行的进程。
  • Use journal hooks to monitor a process running with higher rights . 使用日志挂钩来监视以更高权限运行的进程
  • Perform dynamic link library (DLL) injection to a process running with higher rights. 对运行具有更高权限的进程执行动态链接库(DLL)注入。 Tell me more... 告诉我更多......

I remember just before Vista came out there was a lovely Word document tome all about preparing your app for Windows Vista but sadly I cannot locate it. 我记得在Vista发布之前,有一个可爱的Word文档,主要是关于为Windows Vista准备应用程序,但遗憾的是我无法找到它。

but if my app is running as admin then it cannot get mousedown/mouseup events 但如果我的应用程序以管理员身份运行,则无法获取mousedown / mouseup事件

Perhaps there is a problem with your mouse hook? 也许你的鼠标钩有问题? Impossible to tell without seeing your code. 没有看到你的代码就无法分辨。

Is this a known issue for Windows 这是Windows的已知问题

From my understanding, not for Windows Vista+. 根据我的理解,不适用于Windows Vista +。

Tell me more 告诉我更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM