Hi.
I developing remote control system and I have a question about how to reproduce keyboard and mouse buttons on remote system.
I wrote service app and (it’s working as ‘Local system’ ). When user logged can I use keybd_event and mouse_event functions, but I can’t use these functions on log screen dialog (they don’t work there).
Could anyone can say something about this situation, do I need to write driver in this case to reproduce keyboard and mouse buttons everywhere?
I believe it’s not working because the login screen is running in a
different desktop session (session 0, IIRC).
In theory it might be possible to figure this out and route the messages
appropriately via various tricks, but it’s probably easiest and most
reliable to write a driver. The mouse_event and keybd_event functions
are obsolete, BTW… it’s more direct to just call SendInput.
This limitation is intentional, BTW…
Do be aware that any interface you create that allows injecting
keystrokes and mouse events into the system at a level below SendInput
can create a security hole in Vista if a malicious program can connect
to your interface (prior OS’s really didn’t have security in this area,
so it’s hard to call it a “hole”).
For example, the UAC dialog is shown on the session 0 desktop to prevent
malicious applications from calling SendInput to dismiss it.
Additionally, elevated applications are isolated from windows messages
(including those generated by SendInput and equivalents) from
non-elevated applications to prevent shatter attacks (among other things).
xxxxx@gmail.com wrote:
Hi.
I developing remote control system and I have a question about how to reproduce keyboard and mouse buttons on remote system.
I wrote service app and (it’s working as ‘Local system’ ). When user logged can I use keybd_event and mouse_event functions, but I can’t use these functions on log screen dialog (they don’t work there).
Could anyone can say something about this situation, do I need to write driver in this case to reproduce keyboard and mouse buttons everywhere?
–
Ray
(If you want to reply to me off list, please remove “spamblock.” from my
email address)
On Jan 2, 2008 10:53 PM, Ray Trent wrote:
> In theory it might be possible to figure this out and route the messages
> appropriately via various tricks, but it’s probably easiest and most
> reliable to write a driver. The mouse_event and keybd_event functions
> are obsolete, BTW… it’s more direct to just call SendInput.
In a pinch, one slightly cheating way of finding a way, would be to
look at the source code for one of the many available versions of
VNC… (http://en.wikipedia.org/wiki/VNC) It’s GPLed, so the OP can’t
copy the code, but perhaps get someone to have a peek…?
–
Rune