Code.Blodded
Code.Blodded

Reputation: 231

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. 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.

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)
  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

Has anyone encountered this issue?

Upvotes: 2

Views: 1410

Answers (1)

user585968
user585968

Reputation:

OP:

...and it confirmed that mouseup/mousedown events are not getting triggered when foreground window is running as admin.

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. This is accomplished via User Interface Privilege Isolation (UIPI) and integrity (see below).

MSDN:

UIPI does not interfere with or change the behavior of window messaging between applications at the same privilege (or integrity) level. UIPI prevents lower-privilege processes from accessing higher-privilege processes by blocking the following behavior. 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. These APIs return success but silently drop the window message.
  • 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. 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.

but if my app is running as admin then it cannot get mousedown/mouseup events

Perhaps there is a problem with your mouse hook? Impossible to tell without seeing your code.

Is this a known issue for Windows

From my understanding, not for Windows Vista+.

Tell me more

Upvotes: 4

Related Questions