Change your logon shell at HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon → Shell (REG_SZ)
from Explorer to a program that first calls LockWorkStation()
, followed by starting of the real Explorer.exe
.
Or do it even earlier by changing HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon → Userinit (REG_SZ)
to a wrapper for Userinit.exe.
(Do not use rundll32
Do not use rundll32
for locking, though. Write something in C# or Python or whatever else.)