eNkkk
eNkkk

Reputation: 31

Inno Setup program doesn't work because of .crt file, but works in source directory

I'm trying to create an installer for my own C++ program compiled with cygwin, if executed from the source directory the program runs perfectly, but if I try executing it from the installation directory created by Inno Setup it won't work.

I have found that the issue is caused by ca-bundle.crt located in {app}\etc\pki\tls\certs. If i copy the .crt file from the source directory to the Inno Setup installation dir everything works as it should.

What causes this? How can I fix it?

Here is my Inno Setup script:

#define MyAppName "cryptoProfit"
#define MyAppVersion "1.0"
#define MyAppPublisher "eNkkk"
#define MyAppExeName "cryptoProfit.exe"

[Setup]
AppId={{EBFEDF21-0134-4123-A0C6-25A5C3C50FC3}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DisableDirPage=yes
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=C:\Users\xxxx\Desktop\xxxx
OutputBaseFilename=cryptoProfit_installer
SetupIconFile=C:\Users\xxxx\Desktop\cryptoProfit\Stock.ico
SolidCompression=yes
Compression=lzma2/ultra64
LZMAUseSeparateProcess=yes
LZMADictionarySize=1048576
LZMANumFastBytes=273
WizardStyle=modern
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Users\xxxx\Desktop\cryptoProfit\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\xxxx\Desktop\cryptoProfit\Stock.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\xxxx\Desktop\cryptoProfit\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\xxxx\Desktop\cryptoProfit\etc\*"; DestDir: "{app}\etc"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\xxxx\Desktop\cryptoProfit\tmp\*"; DestDir: "{app}\tmp"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\xxxx\Desktop\cryptoProfit\usr\*"; DestDir: "{app}\usr"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
    ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{autopf}\{#MyAppName}\bin"; \

;[Run]
;Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

EDIT - to answer Martin Prikryl:

1 - Compare file contents bitwise:

 $ FC /B "C:\Users\xxxx\Desktop\cryptoProfit\etc\pki\tls\certs\ca-bundle.crt" "C:\Program Files (x86)\cryptoProfit\etc\pki\tls\certs\ca-bundle.crt"
Comparing files C:\USERS\XXXX\DESKTOP\CRYPTOPROFIT\ETC\PKI\TLS\CERTS\ca-bundle.crt and C:\PROGRAM FILES (X86)\CRYPTOPROFIT\ETC\PKI\TLS\CERTS\CA-BUNDLE.CRT
FC: no differences encountered

I have also compared the 2 files with windiff.exe and it says that the files are identical

2 - Compare file ACL:

Before:

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : BUILTIN\Users
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

After:

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : BUILTIN\Users
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

FileSystemRights  : ReadAndExecute, Synchronize
AccessControlType : Allow
IdentityReference : APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES
IsInherited       : True
InheritanceFlags  : None
PropagationFlags  : None

3 - Compare file attributes:

Before - After

$ attrib ca-bundle.crt
A        C:\Program Files (x86)\cryptoProfit\etc\pki\tls\certs\ca-bundle.crt

$ attrib ca-bundle.crt
A  S     C:\Program Files (x86)\cryptoProfit\etc\pki\tls\certs\ca-bundle.crt

Upvotes: 2

Views: 136

Answers (1)

eNkkk
eNkkk

Reputation: 31

Solution: (thanks to Martin Prikryl)

Inno Setup installer didn't give ca-bundle.crt the original attributes, in particular the SYSTEM attribute was missing, this was fixed by adding Attribs: system in the [Files] section for the \etc\ source directory in the Inno Setup script.

[Files]
Source: "C:\Users\gabri\Desktop\cryptoProfit\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\gabri\Desktop\cryptoProfit\Stock.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\gabri\Desktop\cryptoProfit\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\gabri\Desktop\cryptoProfit\etc\*"; DestDir: "{app}\etc"; Flags: ignoreversion recursesubdirs createallsubdirs; Attribs: system
Source: "C:\Users\gabri\Desktop\cryptoProfit\tmp\*"; DestDir: "{app}\tmp"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\gabri\Desktop\cryptoProfit\usr\*"; DestDir: "{app}\usr"; Flags: ignoreversion recursesubdirs createallsubdirs

Upvotes: 1

Related Questions