The first modern open-source tool for taking control of Windows shutdowns.
Unexpected shutdowns and reboots still interrupt gaming sessions, long-running builds, remote administration, and overnight workloads. Existing utilities are often closed-source, abandoned, or focused mainly on sleep prevention rather than transparent shutdown control. Wardoff is a Windows-native Rust project that tries to be explicit about both its current capabilities and its hard limits.
This repository is no longer just a planning scaffold. The current codebase implements a working MVP-level runtime with a tray surface, CLI, structured logging, single-instance coordination, and the safe user-space shutdown layers that fit the current branch scope.
Implemented in this repository today:
- working Windows tray/runtime application with Block and Allow state management
- CLI support for:
--block--allow--status--hide--log--tail--autostart on|off
- Layer 1 interactive shutdown blocking via
WM_QUERYENDSESSION,ShutdownBlockReasonCreate(), andSetProcessShutdownParameters() - Layer 2 standard-mode local
shutdown.exedetection via ETW process-start monitoring plus best-effortAbortSystemShutdownW(None)attempts - Layer 3 Windows Update reboot-task protection for
Microsoft\Windows\UpdateOrchestrator\Reboot - Layer 4 remote shutdown abort polling via
AbortSystemShutdownW(None) - sleep, hibernate, and display-idle blocking via
SetThreadExecutionState(...) - rotating structured JSONL logs under
%LOCALAPPDATA%\Wardoff\logs\ - Task Scheduler autostart management
- single-instance enforcement plus named-pipe IPC so secondary CLI invocations can control the primary runtime
- tray power actions for Shutdown, Reboot, Sleep, Hibernate, and Quit
These items are still missing in the current shipped implementation:
- opt-in aggressive IFEO mode for earlier local
shutdown.exeinterception - Windows Event Log integration
- native Windows toast notifications
- timer-based blocking windows
- profiles and a settings window
- packaging and distribution polish via GitHub Releases, Winget, Scoop, and Chocolatey
- Current Wardoff still does not promise to block local
shutdown /t 0 /f. Layer 2 now watches ETW process-start events for localshutdown.exelaunches and immediately triesAbortSystemShutdownW(None), but a forced zero-second local shutdown can still outrun a user-space abort attempt. - The current branch ships Layer 1, Layer 2 standard mode, Layer 3, Layer 4, and sleep/display blocking. It does not yet ship aggressive IFEO interception.
- Windows Update protection is tied to the
Microsoft\Windows\UpdateOrchestrator\Rebootscheduled task and requires administrator rights. - Remote shutdown abort logic only helps while Windows still exposes a shutdown timeout window and the process has the rights needed for
AbortSystemShutdownW(None). - Default no-argument startup is designed to request elevation so the full safe MVP can run. Some explicit CLI paths can still run without elevation, but elevated-only features may then be skipped and logged as unavailable.
- There is no Windows Event Log integration, toast UI, settings window, timer/profile system, or polished installer/distribution flow yet.
Wardoff is designed as a layered Windows-only tool because no single user-space API covers every shutdown origin. The architecture reference is documented in docs/WINDOWS_SHUTDOWN_LAYERS.md:
- Layer 1: standard interactive shutdown blocking
- Layer 2: local
shutdown.exehandling (standard mode) - Layer 3: Windows Update reboot task control
- Layer 4: remote shutdown abort polling
Wardoff also implements a separate power-state blocker for sleep, hibernate, and display idle prevention.
Wardoff is currently source-first. There is not yet a polished release/distribution pipeline.
Build from source on Windows with the MSVC toolchain:
cargo build --releaseThe resulting binary is typically:
target\release\wardoff.exe
Running wardoff with no arguments starts the primary runtime in Block mode with a visible tray icon. On the default startup path, Wardoff may relaunch itself elevated so Layer 3 and other privileged functionality can operate when available.
wardoff
wardoff --block
wardoff --allow
wardoff --status
wardoff --hide
wardoff --log
wardoff --log --tail 50
wardoff --autostart on
wardoff --autostart offCommand behavior in the current implementation:
wardoffstarts the tray runtime in Block mode--blockswitches the primary instance to Block mode or starts a headless Block-mode runtime--allowswitches the primary instance to Allow mode or starts a visible Allow-mode runtime--statusprints compact JSON describing the current state, active layers, uptime, and blocked count--hidestarts Block mode with the tray icon created but hidden--logprints recent structured JSONL records--tail Nchanges how many recent records--logprints--autostart on|offcreates, updates, or removes the current-user scheduled task used for Start with Windows
Example --status shape:
{"state":"block","layers":{"shutdown":true,"local_shutdown":true,"update":true,"remote":true,"sleep":true},"uptime_seconds":42,"blocked_count":3}If no primary runtime is active, --status returns:
{"state":"inactive"}The current tray menu includes:
- Block
- Allow
- Start with Windows
- Shutdown
- Reboot
- Sleep
- Hibernate
- Quit
Tray icons are red in Block mode and green in Allow mode.
Wardoff writes rotating structured JSONL logs to:
%LOCALAPPDATA%\Wardoff\logs\wardoff.jsonl
The current implementation keeps up to 3 log files and rotates when the active log grows past 5 MiB.
| Product | Source model | Stack | shutdown.exe handling |
Status |
|---|---|---|---|---|
| Wardoff | Open-source MIT project | Rust | ETW-based standard-mode monitoring for local shutdown.exe, plus Layers 1, 3, and 4; no aggressive IFEO mode yet |
MVP runtime implemented on current branch |
| ShutdownBlocker | Closed freeware | .NET Framework 4.0 | Uses IFEO for shutdown.exe |
Last known update March 2017 |
| ShutdownGuard | Open-source MIT project | Pure C with MinGW | Historical DLL injection approach | Archived as UNSUPPORTED since 2014 |
| Don't Sleep | Closed freeware | Closed-source Windows utility | Does not block shutdown.exe |
Actively maintained |
| PreventTurnOff | Closed freeware | Closed-source Windows utility | Same limitation as Don't Sleep | Actively maintained, simplified |
See docs/COMPARISON.md for the full comparison and trade-offs.
Contributions are welcome. Start with CONTRIBUTING.md, read PLAN.md, and keep changes aligned with the current MVP scope and the current branch's honest limitations.
Wardoff is licensed under the MIT License.