Quote Originally Posted by Niya View Post
It is actually a Windows Service that runs under the LocalSystem account which I believe is the most powerful account on a Windows system, even more powerful than Administrator accounts. It's used as part of a system I created to implement my own home grown version of Team Viewer. One of the problems I ran into early in it's design was not being able to screen capture and transmit input to and from the WinLogon desktop. I had to dive into the world of Window Stations and Desktops to implement that functionality. Once I got it, I never really explored what other possiblities there were with these series of APIs. Here is a small piece of code I used to capture the screen of the console session:-

A lot of API functions like SendInput are sensitive to what Desktop/WindowStation/Session they are called from. The above function can in a sense project the function call from one session like where a Windows Service is executed to the session/Window Station/Desktop of the currently logged in user or even in WinLogon(no user logged in).
A Window Service can do it of course. It would need admin rights to setup.

I noticed that XInput was processed on multiple desktops, so I needed to add desktop awareness to the instances. Essentially turning them idle if the current desktop was not the same as the desktop that it started on. Only one instance per desktop can be run at once, so the code needs to allow multiple instances but still detect that condition. Finally got it working recently.