Files
ThreadPilot/Installer/setup.iss
T
PrimeBuild-pc 7559b4af5a fix: migrate upgraded profiles off Automatic and say so (1.7.2)
v1.7.1 changed the shipped default CPU assignment mode to AffinityMask because
Automatic applies only Windows CPU Sets, a soft scheduling preference that
leaves the affinity mask in Task Manager unchanged. A new default only reaches a
profile that has no stored value, so every upgrading user kept Automatic and
still saw an affinity feature that appeared to do nothing. Confirmed against the
published 1.7.1 build: a fresh profile started on AffinityMask, an existing one
stayed on Automatic.

CpuAssignmentModeMigrationPolicy moves a stored Automatic to AffinityMask once
per profile and records that it ran. Two flags are needed, not one: without the
"seen" flag a user who closes the app before acknowledging the change would
never learn of it, and without the "migrated" flag a later deliberate return to
Automatic would be undone on the next launch. Both cases are covered by tests.

The change is announced through an overlay modelled on the existing startup
suggestion, so it is the app's own dialog rather than a system message box, and
it is translated into all seven supported languages. It is queued rather than
stacked when the startup suggestion is already up, and takes keyboard focus.

Persistence is deliberately non-fatal: a failed write is retried on the next
launch, where previously it would have fallen into the load handler's catch and
replaced the profile just loaded with defaults, silently swallowing the notice.
An out-of-range stored mode now repairs to the shipped default instead of
Automatic, so corrupt data is not reported back to the user as a choice they
made.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhS1xyuMPFvxrojERQ4NuY
2026-08-26 18:48:01 +02:00

120 lines
4.5 KiB
Plaintext

; ThreadPilot Installer Script for Inno Setup
; Copyright (C) 2025 Prime Build
#define MyAppName "ThreadPilot"
#define MyAppPublisher "Prime Build"
#define MyAppURL "https://github.com/PrimeBuild-pc/ThreadPilot"
#define MyAppExeName "ThreadPilot.exe"
#ifndef MyWizardStyle
#define MyWizardStyle "modern dynamic windows11"
#endif
#ifndef MyAppVersion
#define MyAppVersion "1.7.2"
#endif
#ifndef MyAppSourceDir
#define MyAppSourceDir "..\\artifacts\\release\\singlefile"
#endif
[Setup]
AppId={{E8F7A3B2-5C4D-4E6F-8A9B-1C2D3E4F5A6B}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}/issues
AppUpdatesURL={#MyAppURL}/releases
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=..\LICENSE
PrivilegesRequired=admin
OutputDir=..\artifacts\release\installer
OutputBaseFilename=ThreadPilot_v{#MyAppVersion}_Setup
SetupIconFile=..\assets\icons\ico.ico
Compression=lzma2/ultra64
SolidCompression=yes
WizardStyle={#MyWizardStyle}
ArchitecturesInstallIn64BitMode=x64compatible
ArchitecturesAllowed=x64compatible
MinVersion=10.0.17763
UninstallDisplayIcon={app}\{#MyAppExeName}
DisableReadyPage=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#MyAppSourceDir}\ThreadPilot.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppSourceDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
Source: "{#MyAppSourceDir}\*.pdb"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
; Normal/package-manager installs stay unattended. In-app updates opt in through
; /THREADPILOTUPDATE=1 and relaunch ThreadPilot after the replacement completes.
[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait; Check: IsThreadPilotUpdate
; ThreadPilot user data is preserved during install/update. Inno removes installed
; files and shortcuts automatically only when the generated uninstaller runs.
; Per-user AppData cleanup is limited to the account context used by uninstall.
[UninstallRun]
Filename: "taskkill.exe"; Parameters: "/IM ""{#MyAppExeName}"" /F"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallKillThreadPilot"
Filename: "schtasks.exe"; Parameters: "/Delete /TN ""ThreadPilot_Launch"" /F"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallRemoveThreadPilotLaunchTask"
Filename: "schtasks.exe"; Parameters: "/Delete /TN ""ThreadPilot_Startup"" /F"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallRemoveThreadPilotStartupTask"
Filename: "reg.exe"; Parameters: "delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\Run"" /v ""ThreadPilot"" /f"; Flags: runhidden waituntilterminated; RunOnceId: "UninstallRemoveThreadPilotRunEntry"
[UninstallDelete]
Type: filesandordirs; Name: "{userappdata}\ThreadPilot"
[Code]
const
LegacyBetaUninstallKey = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{A2A4C8B5-4A9A-4B1B-93F4-5F8B1C7E8C2A}_is1';
LegacyBetaDisplayName = 'ThreadPilot 0.1.0-beta';
function IsLegacyThreadPilotInstallPath(InstallLocation: string): Boolean;
var
NormalizedLocation: string;
ExpectedInstallRoot: string;
begin
NormalizedLocation := Lowercase(RemoveBackslashUnlessRoot(RemoveQuotes(InstallLocation)));
ExpectedInstallRoot := Lowercase(RemoveBackslashUnlessRoot(ExpandConstant('{autopf}\ThreadPilot')));
Result := (NormalizedLocation = ExpectedInstallRoot);
end;
procedure DeleteLegacyBetaUninstallEntry(RootKey: Integer);
var
DisplayName: string;
InstallLocation: string;
begin
if RegQueryStringValue(RootKey, LegacyBetaUninstallKey, 'DisplayName', DisplayName) and
RegQueryStringValue(RootKey, LegacyBetaUninstallKey, 'InstallLocation', InstallLocation) and
(DisplayName = LegacyBetaDisplayName) and
IsLegacyThreadPilotInstallPath(InstallLocation) then
begin
RegDeleteKeyIncludingSubkeys(RootKey, LegacyBetaUninstallKey);
end;
end;
function InitializeSetup(): Boolean;
begin
DeleteLegacyBetaUninstallEntry(HKLM);
DeleteLegacyBetaUninstallEntry(HKCU);
Result := True;
end;
function IsThreadPilotUpdate(): Boolean;
begin
Result := CompareText(ExpandConstant('{param:THREADPILOTUPDATE|0}'), '1') = 0;
end;