Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 57 additions & 10 deletions Installer/PassKey.iss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
[Setup]
AppId={{A7F3C2D1-8E4B-4F9A-B6D5-3C1E7A2F0D84}
AppName=PassKey
AppVersion=1.0.15
AppVerName=PassKey 1.0.15
AppVersion=1.0.16
AppVerName=PassKey 1.0.16
AppPublisher=Giuseppe Imperato
AppPublisherURL=https://github.com/pexatar/PassKey
AppSupportURL=https://github.com/pexatar/PassKey/issues
Expand Down Expand Up @@ -40,7 +40,7 @@ Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; Flags: unchecked

[Files]
; Windows App Runtime 1.8 redistributable — installed silently before the app launches.
; Windows App Runtime 1.8 redistributable — installed silently if not already present.
; PassKey.Desktop is published self-contained (.NET bundled), so no separate .NET
; installer is needed. The App Runtime provides Microsoft.UI.Xaml.dll and WinRT
; support; it is loaded at runtime via Bootstrap.Initialize().
Expand All @@ -61,11 +61,58 @@ Name: "{autodesktop}\PassKey"; Filename: "{app}\PassKey.Desktop.exe"; Tasks: des
; on uninstall).

[Run]
; 1. Install Windows App Runtime 1.8 silently.
; Idempotent: exits immediately if the same or newer version is already present.
Filename: "{tmp}\WindowsAppRuntimeInstall-x64.exe"; Parameters: "--quiet"; \
StatusMsg: "Installing Windows App Runtime 1.8..."; \
Flags: waituntilterminated

; 2. Launch PassKey after installation completes.
; Launch PassKey after installation completes.
; (Windows App Runtime installation is handled by the [Code] section below,
; which catches the 0xC0000142 DLL-init crash that occurs when the runtime
; is already installed on the system.)
Filename: "{app}\PassKey.Desktop.exe"; Description: "Launch PassKey"; Flags: nowait postinstall skipifsilent

[Code]
{ ── Windows App Runtime bootstrap ─────────────────────────────────────────── }
{ Runs WindowsAppRuntimeInstall-x64.exe via Exec() so errors are handled }
{ gracefully. The standalone EXE can crash with STATUS_DLL_INIT_FAILED }
{ (0xC0000142) on systems where the runtime is already installed, which causes }
{ a dialog when launched from the [Run] section. Using Exec() suppresses that. }

procedure TryInstallWindowsAppRuntime();
var
InstallerPath : String;
ResultCode : Integer;
begin
InstallerPath := ExpandConstant('{tmp}\WindowsAppRuntimeInstall-x64.exe');

if not FileExists(InstallerPath) then
begin
Log('WinAppRuntime: installer not found at ' + InstallerPath + ' — skipping.');
Exit;
end;

Log('WinAppRuntime: launching installer...');

if not Exec(InstallerPath, '--quiet', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
{ Exec returns False when the process could not be created at all. }
{ The most common cause on systems with the runtime already installed is }
{ STATUS_DLL_INIT_FAILED (0xC0000142): the installer EXE crashes immediately }
{ because a side-by-side manifest dependency can't load. This is benign — }
{ the runtime is already present and PassKey will launch correctly. }
Log('WinAppRuntime: installer failed to start (OS error ' + IntToStr(ResultCode)
+ '). Runtime is likely already installed — continuing.');
end
else
begin
{ ResultCode 0 = success / already at this or newer version }
{ 0x80073D21 (2147954465) = package already registered — also success }
if (ResultCode = 0) or (ResultCode = 2147954465) then
Log('WinAppRuntime: installer completed successfully (exit code ' + IntToStr(ResultCode) + ').')
else
Log('WinAppRuntime: installer returned exit code ' + IntToStr(ResultCode)
+ '. PassKey may still work if the runtime is already installed.');
end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
TryInstallWindowsAppRuntime();
end;
6 changes: 3 additions & 3 deletions src/PassKey.Desktop/PassKey.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<WindowsPackageType>None</WindowsPackageType>
<PublishAot>false</PublishAot>
<RootNamespace>PassKey.Desktop</RootNamespace>
<Version>1.0.15</Version>
<AssemblyVersion>1.0.15.0</AssemblyVersion>
<FileVersion>1.0.15.0</FileVersion>
<Version>1.0.16</Version>
<AssemblyVersion>1.0.16.0</AssemblyVersion>
<FileVersion>1.0.16.0</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Assets\PassKey.ico</ApplicationIcon>
<DefineConstants>DISABLE_XAML_GENERATED_MAIN</DefineConstants>
Expand Down
Loading