Architecture
Why three phases?
Two constraints force the work to be split across separate boot environments.Safe Mode is required for DDU
Display Driver Uninstaller (DDU) must run in Safe Mode to fully remove GPU drivers. In a normal boot, the kernel has already loaded the graphics driver, locking its files and preventing complete removal. Safe Mode loads only the minimum set of drivers, leaving GPU driver files accessible and unlocked. Running DDU outside Safe Mode risks leaving behind driver residue that can cause conflicts with the freshly installed driver.TrustedInstaller is required for security settings
Several Windows security features — Tamper Protection, Virtualization-Based Security (VBS), memory integrity (HVCI), and Smart App Control — cannot be disabled by a standard administrator process. They are owned by theTrustedInstaller / NT SERVICE\TrustedInstaller principal, which sits above even SYSTEM for certain registry keys.
WinSux works around this using the Run-Trusted function, present in both stepone.ps1 and steptwo.ps1. The function temporarily replaces the TrustedInstaller service binary path with a cmd.exe call that executes an encoded PowerShell command, starts the service (causing that command to run as TrustedInstaller), then restores the original binary path and stops the service again.
Execution chain
The three scripts are connected using two standard Windows persistence mechanisms:- Winlogon
Userinit— Phase 1 writesstepone.ps1into theUserinitregistry value. Windows calls Userinit during logon to start the shell; replacing it with a PowerShell script causes that script to run immediately on the next logon (which happens to be the Safe Mode boot). RunOnce— Phase 1 also writessteptwo.ps1intoHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce. This key runs its entries exactly once on the next normal boot, then deletes them automatically.
stepone.ps1) restores Winlogon to userinit.exe as its very first action, before doing anything else, so that if Safe Mode is exited or the machine reboots mid-script, the system still logs in normally rather than looping back into the script.
The three phases
Detailed breakdown of every action performed in each phase.
Configuration
Learn what WinSux installs and configures on your system.