fix(service): start the Windows service after granting it its config (D157) #31
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/windows-start-after-grant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on the phase 18 walk (§34.3 step 4, one Rust instance under the SCM). It also affects the released ServUO installer, since the code is shared; the org lead chose to fix both games here (D157).
The defect
installon Windows left the service STOPPED:sc queryshowedWIN32_EXIT_CODE 1066(a service-specific error), and the sidecar's own log said why:sc startran inside registration, beforegrant_service_accesslet the new virtual account readsidecar.toml.protect_configlocks that file to SYSTEM and Administrators because it holds the token, so the first start couldn't read its own config. The SCM's restart-on-failure policy doesn't fire for a clean exit with an error code, so the service stayed stopped until someone started it by hand; by then the grant existed and the start worked.main(v0.2.0) has the same order ininstall.rs, so a first-time ServUO install on Windows does this too.The fix
register_windows_namedregisters, reconfigures and sets the restart policy. It no longer starts the service.service::start_registeredruns aftergrant_service_access(in bothinstall.rsandrustgame/install.rs), keeps the 1053/1069 diagnoses, and refreshes the reported state.Proof
Windows, elevated, from this branch: install →
START_PENDING, automatic start→ running;/healthanswered on the first probe; stop in 22 ms; restart;doctorclean (⚠ only for the server not running); uninstall removed everything it listed.fmt, andclippy -D warningsplus the tests on both Windows (163) and Linux (166).The ServUO path was not walked on Windows; it goes through the identical registration and start code.
AI-assisted: Claude Code (Claude Opus 5.5)
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY