fix(startup): Start with Windows honours an entry Task Manager turned off

Task Manager's Startup tab keeps the Run value and writes a StartupApproved\Run value whose odd first byte means
off. The client and the Uploader now show such an entry as off; ticking the box removes the marker so the entry
runs again, unticking removes it with the Run value, and re-pointing the command after an update leaves it as it
is. Core/IO/StartupApproval holds the rule; the registry hive is injectable for tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 16:02:23 +00:00
1 parent b344d2a527
commit 8eaaef5085
5 files changed
+231 -47

No files matched your search

@@ -0,0 +1,21 @@
using Titano.Core.IO;
using Titano.Testing;
namespace Titano.Core.Tests.Foundation;
/// <summary>The switch Task Manager's Startup tab keeps apart from a sign-in entry's command.</summary>
public sealed class StartupApprovalTests
{
[Test]
public void AnOddFirstByteMeansTurnedOff()
{
// As Task Manager writes them: a state, three zero bytes, then the time it was turned off.
Assert.True(StartupApproval.IsTurnedOff([0x03, 0, 0, 0, 0x60, 0x1B, 0x3C, 0x92, 0x8A, 0x3F, 0xDB, 0x01]));
Assert.True(StartupApproval.IsTurnedOff([0x01, 0, 0, 0]));
Assert.False(StartupApproval.IsTurnedOff([0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
Assert.False(StartupApproval.IsTurnedOff([0x06, 0, 0, 0]));
// Never touched in Task Manager, or a value of another type: the entry is on.
Assert.False(StartupApproval.IsTurnedOff(null));
Assert.False(StartupApproval.IsTurnedOff([]));
}
}