Solved Auto Login and Lock

osomphane

New Member
Hello,

I found a guide somewhere detailing the following instructions:
1) run "netplwiz" and uncheck "users must enter password..."
2) create a startup shortcut "rundll32 user32,LockWorkStation"

But, Raymond Chen says "Please don't do this. The LockWorkStation function was not designed to be run via Rundll32. To be run via Rundll32 a function needs to match a very specific function signature, which LockWorkStation doesn't. As a result, the stack is misaligned on return and what happens next is anybody's guess."

So, instead of that, I made a shurtcut for "tsdiscon.exe" which is goes into the switch user screen. Is that a proper way to do it, or is it improper like the runddl method above?
 

My Computer

Hello Osomphane, and welcome to Vista Forums.

I'm not certain what the purpose of this would be for. When an account is locked, you will have to enter the password anyway to unlock and log on to that account again anyway. It seems like it would serve the same purpose to just disable auto login and allow Vista to startup to the log on screen instead and to log in when ready. For sleep modes, you can enable the password protection on wakeup option to force a log in at wakeup to prevent unauthorized access.

Hope this helps some,
Shawn
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro 64-bit
    Manufacturer/Model
    Custom
    CPU
    Intel i7-8700K 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz (F4-3600C18D-32GTZR)
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    2 x Samsung Odyssey G7 27"
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Samsung 990 PRO M.2,
    4TB Samsung 990 PRO PRO M.2,
    8TB WD MyCloudEX2Ultra NAS
    PSU
    Seasonic Prime Titanium 850W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master 3
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Galaxy S23 Plus phone
  • Operating System
    Windows 10 Pro
    Manufacturer/Model
    HP Envy Y0F94AV
    CPU
    i7-7500U @ 2.70 GHz
    Memory
    16 GB DDR4-2133
    Graphics card(s)
    NVIDIA GeForce 940MX
    Sound Card
    Conexant ISST Audio
    Monitor(s) Displays
    17.3" UHD IPS touch
    Screen Resolution
    3480 x 2160
    Hard Drives
    512 GB M.2 SSD
Why are you after autologon+lock? As Brink (Shawn... man it's confusing when someone uses two names ;)) said, it's not immediately clear why you're trying to do something that's generally Not A Good Thing.

I presume you've got something running as a result of a logon, like a service except it's not really a "win32 Service", so that's why you need a logged-on session? If that's it, you're better off using SRVANY or one of its newer derivatives to turn your executable into a real service - the kind that interfaces with the Service Control Manager - so you don't need anyone logged on for that.

Otherwise, Raymond Chen is of course always right - not every exported function in every DLL is compatible with rundll32, and that can lead to all sorts of mayhem.
 

My Computer

I am running a headless and mousless eee box as a server and remoting in with live mesh. Hence the need to logon and then lock the computer..
 

My Computer

If you wrap the Live Mesh executable (whatever that may be) into a service, you'll no longer need to logon+lock because the service will run even with nobody on the console of the box.

Look up SRVANY if you'd like some pointers on where to begin. It's not particularly easy, but it's not rocket science either. If you're invoking functions in DLLs this is well within your skillset :)
 

My Computer

ok, so it seems that I went the retarded way about this.. the remote desktop component of live mesh is loaded as a service on windows boot, so there was no real need to have an automatic login..

thanks for the info!
 

My Computer

Existing methods to lock the desktop after auto logon just call the LockWorkStation function through rundll32.exe via some shortcut placed in Start Up or registry. That takes a while to lock depending on how bloated your Windows is and till then it just sits on the desktop. And Safe Mode doesn't get locked since the start up items don't run in Safe Mode. More importantly using rundll32.exe for these functions causes a stack corruption which will eventually crash the system or worse.

So I made a replacement shell (Windows starts lock.exe instead of Explorer) which locks first and then launches Explorer in the background. It also handles Safe Mode and Safe Mode with Command Prompt and detects and launches the x64 cmd.exe on an x64 system.

Auto Logon & Lock v1.0
 

My Computer

10x )
Works on W2k3 32-bit. You may update your 'tested on' info ; )))

Existing methods to lock the desktop after auto logon just call the LockWorkStation function through rundll32.exe via some shortcut placed in Start Up or registry. That takes a while to lock depending on how bloated your Windows is and till then it just sits on the desktop. And Safe Mode doesn't get locked since the start up items don't run in Safe Mode. More importantly using rundll32.exe for these functions causes a stack corruption which will eventually crash the system or worse.

So I made a replacement shell (Windows starts lock.exe instead of Explorer) which locks first and then launches Explorer in the background. It also handles Safe Mode and Safe Mode with Command Prompt and detects and launches the x64 cmd.exe on an x64 system.

Auto Logon & Lock v1.0
 

My Computer

Back
Top