Skip to content

Commit 32a4cf6

Browse files
author
Tajudeen
committed
Add Visual C++ Redistributables check to Windows installer
- Added IsVCRedistInstalled() function to check for VC++ runtime - Shows warning dialog if VC++ Redistributables are not detected - Helps prevent 'create process failed; code 2' errors - Users are informed they need to install VC++ Redistributables
1 parent f2666e8 commit 32a4cf6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

build/win32/code.iss

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,28 @@ begin
13041304
Result := not IsBackgroundUpdate();
13051305
end;
13061306
1307+
// Check if Visual C++ Redistributables are installed
1308+
function IsVCRedistInstalled(): Boolean;
1309+
var
1310+
Version: String;
1311+
begin
1312+
Result := False;
1313+
// Check for Visual C++ 2015-2022 Redistributable (x64)
1314+
#if "x64" == Arch
1315+
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', Version) or
1316+
RegQueryStringValue(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', Version) then begin
1317+
Result := True;
1318+
end;
1319+
#endif
1320+
// Check for Visual C++ 2015-2022 Redistributable (ARM64)
1321+
#if "arm64" == Arch
1322+
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\ARM64', 'Version', Version) or
1323+
RegQueryStringValue(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\ARM64', 'Version', Version) then begin
1324+
Result := True;
1325+
end;
1326+
#endif
1327+
end;
1328+
13071329
// Don't allow installing conflicting architectures
13081330
function InitializeSetup(): Boolean;
13091331
var
@@ -1313,6 +1335,17 @@ var
13131335
begin
13141336
Result := True;
13151337
1338+
// Check for Visual C++ Redistributables
1339+
if not IsVCRedistInstalled() and not WizardSilent() then begin
1340+
if MsgBox('Visual C++ Redistributables are not detected on this system. ' +
1341+
'CortexIDE requires Visual C++ Redistributables to run properly. ' +
1342+
'You can download them from: https://aka.ms/vs/17/release/vc_redist.x64.exe' + #13#10 + #13#10 +
1343+
'Do you want to continue with the installation anyway?',
1344+
mbConfirmation, MB_YESNO) = IDNO then begin
1345+
Result := False;
1346+
end;
1347+
end;
1348+
13161349
#if "user" == InstallTarget
13171350
if not WizardSilent() and IsAdmin() then begin
13181351
if MsgBox('This User Installer is not meant to be run as an Administrator. If you would like to install VS Code for all users in this system, download the System Installer instead from https://code.visualstudio.com. Are you sure you want to continue?', mbError, MB_OKCANCEL) = IDCANCEL then begin

0 commit comments

Comments
 (0)