About SendInput in Lock Screen

Asked 2 years ago, Updated 2 years ago, 123 views

Create a resident application and press the Num key in SendInput while locking the Windows screen. The NumLock LED on the keyboard does not change when simulated.
(Windows doesn't seem to recognize it.)

Can't SendInput key processing be done while the screen is locked?

The environment is Visual C++.

c++ windows winapi

2022-09-30 16:38

1 Answers

Probably not.

In Windows, there is a desktop that bundles windows together and separates them from others.There can be more than one desktop, and the logon screen and screen saver use a different desktop from the usual UI.

So, I was wondering if the logon screen was secure or UIPI, so I tried various things, but it seems that SendInput doesn't work well while Desktop to which the process belongs is not active, not just the logon screen.

Learn more about Desktop here: Virtual Desktop with CreateDesktop - Notepad for kkAyataka.

Also, I saw the following answers in the English version of SO.

However, since the desktop is now inactive, it cannot receive input.GetForegroundWindow will return NULL (IIRC), and you can't use SendInput any longer, since input now Belongs to [a thread on] different desktop; no controls on that active desktop.present

Quoted from Brennan McK's answer to What happens 'beind' the windows lock screen?

I still don't know the detailed mechanism of how the keystrokes I usually send via SendInput are handled and why it's impossible if the desktop is different, but features to separate GUI objects from a security perspective


2022-09-30 16:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.