Simulating input in Windows logon screen, using a

2020-06-06 04:41发布

I'm writing an open-source remote desktop tool, similar to VNC and TeamViewer. I've noticed that TeamViewer continues capturing the screen at the Switch Users or Workstation Locked screen - and allows the remote user to type in the password and unlock the workstation. I want to do the same.

I've read:

Updated: Interacting with the user on the windows logon screen

https://stackoverflow.com/questions/9485530/capturing-image-during-windows-logon-invalid-password

Adding command button to Windows Logon screen

hook a hotkey from windows logon screen

https://stackoverflow.com/questions/7183241/launch-windows-on-screen-keyboard-at-logon-screen-on-win7

Driver to Simulate Keypress

Removing Windows Logon screen through a service

How to catch a key in Windows 7 logon screen?

Displaying Window on Logon Screen Using C# in Windows XP

From these posts, I've gathered that simulating input in an isolated session definitely isn't a simple call to SendInput(). But is it possible using a driver (I believe it's specifically a keyboard filter driver, but I'm not sure)? If so, I'm thinking of writing, in C#, a service (so that it runs outside the user's session) that interacts with the Interception driver to simulate key presses.

In response to: "why don't you just try it?", there isn't a .NET wrapper for Interception yet for me to test such a service, and so if the general consensus concludes that this isn't possible, I don't want to spend the time writing that .NET wrapper.

I found an keyboard driver called Interception (that will be released open-source in the future). You can directly find the source here (the source is only the C communication API wrapper surrounding the actual kernel driver).

Another question I have...I'm confused about what files make up a driver. His Interception DLL library programmed in C compiles to a .DLL. But aren't drivers of some .sys extension - how would you compile that Interception DLL into an actual driver - and then how would you install it?

EDIT: A .NET wrapper does exist. I modded the sample console app to type my entire password when I pressed the 'x' key, and it worked successfully - not only at the workstation locked screen, but also at the Windows logon screen. So it works.

Edit: C# wrapper library for this keyboard driver is here.

2条回答
霸刀☆藐视天下
2楼-- · 2020-06-06 05:15

Currently, the actual drivers are not open source. The driver installer installs them (keyboard.sys and mouse.sys), what's open source is only the API of communication with them. I'm planning a rewriting of the kernel components before open sourcing it too.

查看更多
走好不送
3楼-- · 2020-06-06 05:22

For other people interested in the answer: yes, it works.

Use the .NET wrapper for the Interception keyboard driver found at https://github.com/candera/kchordr, and play around. It will replace keys even at the Windows logon screen.

查看更多
登录 后发表回答