@@ -110,8 +110,8 @@ Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#NameLong}"; File
110110; Automatically install Visual C++ Redistributables if not already installed (silent, no user interaction)
111111Filename : " powershell.exe" ; Parameters : " -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command " " $url='https://aka.ms/vs/17/release/vc_redist.x64.exe'; $out='{tmp} \vc_redist.x64.exe'; if (-not (Test-Path $out)) { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing }; Start-Process -FilePath $out -ArgumentList '/install','/quiet','/norestart' -Wait -NoNewWindow" " " ; StatusMsg : " Installing Visual C++ Redistributables..." ; Check : not IsVCRedistInstalled() and (Arch = " x64" ); Flags : runhidden waituntilterminated
112112Filename : " powershell.exe" ; Parameters : " -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command " " $url='https://aka.ms/vs/17/release/vc_redist.arm64.exe'; $out='{tmp} \vc_redist.arm64.exe'; if (-not (Test-Path $out)) { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $url -OutFile $out -UseBasicParsing }; Start-Process -FilePath $out -ArgumentList '/install','/quiet','/norestart' -Wait -NoNewWindow" " " ; StatusMsg : " Installing Visual C++ Redistributables..." ; Check : not IsVCRedistInstalled() and (Arch = " arm64" ); Flags : runhidden waituntilterminated
113- Filename : " {app} \{#ExeBasename}.exe" ; Description : " {cm:LaunchProgram,{#NameLong}}" ; Tasks: runcode; Flags : nowait postinstall ; Check : ShouldRunAfterUpdate()
114- Filename : " {app} \{#ExeBasename}.exe" ; Description : " {cm:LaunchProgram,{#NameLong}}" ; Flags : nowait postinstall ; Check : WizardNotSilent ()
113+ Filename : " {app} \{#ExeBasename}.exe" ; Description : " {cm:LaunchProgram,{#NameLong}}" ; Tasks: runcode; Flags : nowait postinstall ; Check : ShouldRunAfterUpdate() and ExecutableExists()
114+ Filename : " {app} \{#ExeBasename}.exe" ; Description : " {cm:LaunchProgram,{#NameLong}}" ; Flags : nowait postinstall ; Check : not WizardSilent() and ExecutableExists ()
115115
116116[Registry]
117117#if " user" == InstallTarget
@@ -1458,6 +1458,27 @@ begin
14581458 Result := True;
14591459end ;
14601460
1461+ // Verify that the executable file exists before trying to launch it
1462+ // This prevents "CreateProcess failed; code 2" errors
1463+ function ExecutableExists (): Boolean;
1464+ var
1465+ ExePath: String;
1466+ begin
1467+ ExePath := ExpandConstant(' {app}\{#ExeBasename}.exe' );
1468+ Result := FileExists(ExePath);
1469+ if not Result then
1470+ begin
1471+ Log(' Warning: Executable not found at: ' + ExePath);
1472+ // Try alternative locations or wait a bit for file system to sync
1473+ Sleep(100 );
1474+ Result := FileExists(ExePath);
1475+ if Result then
1476+ Log(' Executable found after retry' )
1477+ else
1478+ Log(' Executable still not found after retry' );
1479+ end ;
1480+ end ;
1481+
14611482function IsWindows11OrLater (): Boolean;
14621483begin
14631484 Result := (GetWindowsVersion >= $0A0055F0);
@@ -1556,9 +1577,27 @@ procedure CurStepChanged(CurStep: TSetupStep);
15561577var
15571578 UpdateResultCode: Integer;
15581579 StartServiceResultCode: Integer;
1580+ ExePath: String;
15591581begin
15601582 if CurStep = ssPostInstall then
15611583 begin
1584+ // Verify executable exists after installation
1585+ ExePath := ExpandConstant(' {app}\{#ExeBasename}.exe' );
1586+ if not FileExists(ExePath) then
1587+ begin
1588+ Log(' ERROR: Executable not found after installation at: ' + ExePath);
1589+ Log(' This will cause "CreateProcess failed; code 2" error when trying to launch.' );
1590+ // Try to find the actual executable name
1591+ // This is a fallback in case the executable has a different name
1592+ if FileExists(ExpandConstant(' {app}\{#ApplicationName}.exe' )) then
1593+ Log(' Found alternative executable: {#ApplicationName}.exe' )
1594+ else
1595+ Log(' No alternative executable found either.' );
1596+ end
1597+ else
1598+ begin
1599+ Log(' Executable verified at: ' + ExePath);
1600+ end ;
15621601#ifdef AppxPackageName
15631602 // Remove the old context menu registry keys for insiders
15641603 if QualityIsInsiders() and WizardIsTaskSelected(' addcontextmenufiles' ) then begin
0 commit comments