SendInput doesn't work but it doesn't return an error
Hi all,
The other day a customer of mine was trying to use SendInput to simulate mouse and keyboard input on WinLogon desktop. The API was returning successfully, but it was not doing anything at all. He had no issues to use the API on Default desktop (more info on Desktops here).
SendInput will just ignore our actions if the calling thread of the API is not the active desktop, and if we have no journal playback access to that desktop.
In this case, the app was on active desktop (app running as localsystem and attached to winsta0\winlogon desktop), but it had no journal playback access on it.
So we added DESKTOP_JOURNALPLAYBACK to the access mask passed to OpenDesktop API when attaching to winsta0\winlogon desktop, and SendInput started working just fine.
Desktop Security and Access Rights
"
DESKTOP_JOURNALPLAYBACK (0x0020L) Required to perform journal playback on a desktop.
"
I hope this helps.
Regards,
Alex (Alejandro Campos Magencio)