Simulating input in Windows logon screen, using a driver

只愿长相守 提交于 2019-12-09 07:51:46

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/9652358/simulating-input-in-windows-logon-screen-using-a-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!