I am trying to determine the current session state using the Win32 API ::WTSQuerySessionInformation
function by querying for SessionFlags of the WTSINFOEX_LEVEL1
structure according to the answers to C++: check if computer is locked.
On my machine (Windows 10 1703) SesssionFlags can reach only two (of three documented) values: WTS_SESSIONSTATE_UNLOCK and WTS_SESSIONSTATE_UNKNOWN. The latter seems to mean the same as the expected WTS_SESSIONSTATE_LOCK which I cannot reach, neither through <WinKey>+<L>
nor by programmatically locking the session through ::LockWorkStation
.
So my questions are:
- Does WTS_SESSIONSTATE_LOCK exist?
- If yes, then how can I reach that state?
- If yes, what is the difference between both states (
LOCK
andUNKNOWN
)?
According to SessionChangeReason Enumeration the .NET Framework distinguishes (correctly?) between just two corresponding states SessionUnlock
and SessionUnlock
. So the state of a session is triple or binary?