Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Bundling VC++ redist 14.21.27702 with the installer. Fixes #15
Browse files Browse the repository at this point in the history
This also eliminates the error message when VC redist is not installed (references #17, not fully silent yet, though)
  • Loading branch information
overheadhunter committed Aug 5, 2019
1 parent d137f44 commit d3eda6a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ Copy-Item resources/app/dlls/* app/Cryptomator/
Copy-Item -Recurse resources/innosetup/* app/
Set-Location app/
$env:CRYPTOMATOR_VERSION = "$buildVersion"
& 'C:\Program Files (x86)\Inno Setup 5\ISCC.exe' setup.iss /Qp "/sdefault=`"$signtool`""
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' setup.iss /Qp "/sdefault=`"$signtool`""
86 changes: 53 additions & 33 deletions resources/innosetup/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define FileInfoVersion GetFileVersion("Cryptomator/Cryptomator.exe")

SignTool=default /tr http://timestamp.comodoca.com /fd sha256 /d $qCryptomator$q $f
AppId={{Cryptomator}}
AppId=Cryptomator
AppName=Cryptomator
AppVersion={#AppVersion}
AppPublisher=cryptomator.org
Expand Down Expand Up @@ -37,6 +37,7 @@ VersionInfoVersion={#FileInfoVersion}
WizardImageFile=setup-welcome.bmp
WizardImageStretch=Yes
WizardSmallImageFile=setup-banner-icon.bmp
WizardStyle=classic
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64

Expand All @@ -45,7 +46,8 @@ Name: "en"; MessagesFile: "compiler:Default.isl"

[Components]
Name: "main"; Description: "Cryptomator"; Types: full compact custom; Flags: fixed
Name: "dokan"; Description: "Dokan File System Driver"; Check: not FileExists(ExpandConstant('{sys}\drivers\dokan1.sys')); Types: full
Name: "dokan"; Description: "Dokan File System Driver"; Types: full; Flags: disablenouninstallwarning
Name: "webdav"; Description: "WebDAV system configuration"; Types: full compact; ExtraDiskSpaceRequired: 50; Flags: disablenouninstallwarning

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Services\WebClient\Parameters"; ValueType: dword; ValueName: "FileSizeLimitInBytes"; ValueData: "$ffffffff"
Expand All @@ -58,45 +60,28 @@ Type: filesandordirs; Name: "{app}\runtime"
Type: filesandordirs; Name: "{userappdata}\Cryptomator"

[Files]
Source: "Cryptomator\Cryptomator.exe"; DestDir: "{app}"; Flags: ignoreversion sign
Source: "Cryptomator\Cryptomator.exe"; DestDir: "{app}"; Flags: ignoreversion sign;
Source: "Cryptomator\*.dll"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs signonce
Source: "Cryptomator\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Dokan_x64.msi"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall nocompression; Components: dokan
Source: "vc_redist.x64.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall nocompression; Components: dokan

[Icons]
Name: "{group}\Cryptomator"; Filename: "{app}\Cryptomator.exe"; IconFilename: "{app}\Cryptomator.ico"

[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\Dokan_x64.msi"""; StatusMsg: "Installing Dokan Driver..."; Flags: waituntilterminated; Components: dokan; Check: DokanDependencyCheck
Filename: "net"; Parameters: "stop webclient"; StatusMsg: "Stopping WebClient..."; Flags: waituntilterminated runhidden
Filename: "net"; Parameters: "start webclient"; StatusMsg: "Restarting WebClient..."; Flags: waituntilterminated runhidden
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/norestart /q /chainingpackage ADMINDEPLOYMENT"; StatusMsg: "Installing VC++ Redistributable 2019..."; Flags: waituntilterminated; Components: dokan; Check: not VCRedistInstalled
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\Dokan_x64.msi"""; StatusMsg: "Installing Dokan Driver..."; Flags: waituntilterminated; Components: dokan; Check: not FileExists(ExpandConstant('{sys}\drivers\dokan1.sys'))
Filename: "net"; Parameters: "stop webclient"; StatusMsg: "Stopping WebClient..."; Flags: waituntilterminated runhidden; Components: webdav
Filename: "net"; Parameters: "start webclient"; StatusMsg: "Restarting WebClient..."; BeforeInstall: PrepareForWebDAV; Flags: waituntilterminated runhidden; Components: webdav
Filename: "{app}\Cryptomator.exe"; Description: "{cm:LaunchProgram,Cryptomator}"; Flags: nowait postinstall skipifsilent

[Code]
const
RegNetworkProviderOrderSubkey = 'SYSTEM\CurrentControlSet\Control\NetworkProvider\Order';
RegProviderOrderValueName = 'ProviderOrder';
RegWebClientValue = 'webclient';
RegVcRedistKey = 'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64';
function DokanDependencyCheck(): Boolean;
var
major, minor, build: Cardinal;
begin
Result := False;
if RegKeyExists(HKEY_LOCAL_MACHINE, RegVcRedistKey) then
begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, RegVcRedistKey, 'Major', major) and RegQueryDWordValue(HKEY_LOCAL_MACHINE, RegVcRedistKey, 'Minor', minor) and RegQueryDWordValue(HKEY_LOCAL_MACHINE, RegVcRedistKey, 'Bld', build) then
begin
// Version info was found. Return true if later or equal to our 14.11.25325
Result := (major >= 14) and (minor >= 11) and (build >= 25325)
end;
end;
if not Result then
begin
MsgBox('The Dokan driver requires you to install Microsoft Visual C++ Redistributable 2017. Cryptomator installation will continue, but you will not be able to use Dokan-based drives.', mbInformation, MB_OK);
end;
end;
RegVcRedistKey = 'SOFTWARE\Classes\Installer\Dependencies\Microsoft.VS.VC_RuntimeMinimumVSU_amd64,v14';
function StrSplit(Text: String; Separator: String): TArrayOfString;
var
Expand All @@ -122,6 +107,42 @@ begin
Result := Dest
end;
function VCRedistInstalled(): Boolean;
var
VersionString: String;
Version: TArrayOfString;
MajorVersion, MinorVersion, BuildVersion: Integer;
FoundRequiredVersion: Boolean;
begin
Result := False;
if RegKeyExists(HKEY_LOCAL_MACHINE, RegVcRedistKey) then
begin
if RegQueryStringValue(HKEY_LOCAL_MACHINE, RegVcRedistKey, 'Version', VersionString)then
begin
Version := StrSplit(VersionString, '.');
if GetArrayLength(Version) >= 3 then
begin
MajorVersion := StrToIntDef(Version[0], 0);
MinorVersion := StrToIntDef(Version[1], 0);
BuildVersion := StrToIntDef(Version[2], 0);
if (MajorVersion > 14) then
begin
FoundRequiredVersion := true;
end
else if (MajorVersion = 14) and (MinorVersion > 21) then
begin
FoundRequiredVersion := true;
end
else if (MajorVersion = 14) and (MinorVersion = 21) and (BuildVersion >= 27702) then
begin
FoundRequiredVersion := true;
end;
end;
end;
end;
Result := FoundRequiredVersion;
end;
procedure PatchProviderOrderRegValue();
var
i: Integer;
Expand Down Expand Up @@ -176,6 +197,12 @@ begin
end;
end;
procedure PrepareForWebDAV();
begin
PatchHostsFile();
PatchProviderOrderRegValue();
end;
function InitializeSetup(): Boolean;
begin
// Possible future improvements:
Expand All @@ -184,10 +211,3 @@ begin
// Add pack200/unpack200 support?
Result := true;
end;
function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
PatchHostsFile();
PatchProviderOrderRegValue();
Result := '';
end;
Binary file added resources/innosetup/vc_redist.x64.exe
Binary file not shown.

0 comments on commit d3eda6a

Please sign in to comment.