Reputation: 33
I have the following code in my Inno Setup script:
[Files]
Source: "C:\Users\Myname\Documents\Visual Studio
2010\Redistributional\vcredist_x86.exe"; DestDir: "{tmp}"; Flags:
deleteafterinstall;
Source: "C:\Users\Myname\Documents\Visual Studio
2010\Redistributional\vcredist_x64.exe"; DestDir: "{tmp}"; Flags:
deleteafterinstall;
[Run]
Filename: "{tmp}\vcredist_x86.exe"; Parameters: "/install /passive"; Check:
not IsWin64 and not VCinstalled32
Filename: "{tmp}\vcredist_x64.exe"; Parameters: "/install /passive"; Check:
IsWin64 and not VCinstalled64
Filename: "{app}\Myprogram.exe"; Description {cm:LaunchProgram,Myprogram}";
[Code]
function VCinstalled32: Boolean;
var
installed: Cardinal;
key: String;
begin
Result := False;
key := 'SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86';
if DirExists
('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x86')
then begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, key, 'Installed', installed)
then begin
if installed = 1 then begin
Result := True;
end;
end;
end;
end;
function VCinstalled64: Boolean;
var
installed: Cardinal;
key: String;
begin
Result := False;
key := 'SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64';
if DirExists
('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64')
then begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, key, 'Installed', installed)
then begin
if installed = 1 then begin
Result := True;
end;
end;
end;
end;
I have tried to run this on a 64 bits Windows 10 machine in which the directory HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64
does not exist, but I get an error message saying that MSVCR100 is not found.
Thanks in advance.
Thank you very much for you answer, but still I get the same error message. Maybe I have overlooked something.
I am not very acquainted with Inno script and don't know anything about how to log the result. I have tried to google the latter, but it seems to be very complicated, so I'll try to wait with this to later, if I can't find the answer in any other way.
Here is some of the output from the Log file:
2018-03-05 14:01:03.567 -- File entry --
2018-03-05 14:01:03.568 Dest filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x86.exe
2018-03-05 14:01:03.568 Time stamp of our file: 2018-02-18 14:27:32.000
2018-03-05 14:01:03.568 Installing the file.
2018-03-05 14:01:04.016 Successfully installed the file.
2018-03-05 14:01:04.017 -- File entry --
2018-03-05 14:01:04.018 Dest filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x64.exe
2018-03-05 14:01:04.018 Time stamp of our file: 2018-02-18 16:00:00.000
2018-03-05 14:01:04.018 Installing the file.
2018-03-05 14:01:04.937 Successfully installed the file.
2018-03-05 14:01:08.883 -- Run entry --
2018-03-05 14:01:08.883 Run as: Current user
2018-03-05 14:01:08.883 Type: Exec
2018-03-05 14:01:08.883 Filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x64.exe
2018-03-05 14:01:08.883 Parameters: /install /passive
2018-03-05 14:01:21.800 Process exit code: 0
2018-03-05 14:01:21.800 -- Run entry --
2018-03-05 14:01:21.800 Run as: Current user
2018-03-05 14:01:21.800 Type: Exec
2018-03-05 14:01:21.800 Filename: C:\Program Files (x86)\Myfile\myfile.exe
2018-03-05 14:01:28.020 Process exit code: 3221225781
2018-03-05 14:01:28.023 Need to restart Windows? No
2018-03-05 14:01:30.504 Deinitializing Setup.
2018-03-05 14:01:30.593 Log closed.
As I have understood, Process exit code: 0
means that the file has executed successfully, so I still don't understand what could be wrong.
Upvotes: 0
Views: 2156
Reputation: 19207
I just read up on MSVCR100.DLL:
MSVCR100.dll = Visual Studio 2010 Runtime
MSVCR110.dll = Visual Studio 2012 Runtime
MSVCR120.dll = Visual Studio 2013 Runtime
So are you actually installing the correct redistributables?
With respects to your script, why are you using DirExists
? That is designed to verify if a directory exists. You are working with the registry so you should be using RegKeyExists
. The help provides an example:
begin
if RegKeyExists(HKEY_CURRENT_USER, 'Software\Jordan Russell\Inno Setup') then
begin
// The key exists
end;
end;
I have not tested this but you would want something like:
function VCinstalled64: Boolean;
var
installed: Cardinal;
key: String;
begin
Result := False;
key := 'SOFTWARE\Microsoft\VisualStudio\10.0\VC\Runtimes\x64';
if RegKeyExists(HKEY_LOCAL_MACHINE, key) then
begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, key, 'Installed', installed)
then begin
if installed = 1 then begin
Result := True;
end;
end;
end;
end;
The other method VCinstalled32
would need similar changes.
The help system supplied with Inno Setup (also online) explains about logging:
/LOG Causes Setup to create a log file in the user's TEMP directory detailing file installation and [Run] actions taken during the installation process. This can be a helpful debugging aid. For example, if you suspect a file isn't being replaced when you believe it should be (or vice versa), the log file will tell you if the file was really skipped, and why.
The log file is created with a unique name based on the current date. (It will not overwrite or append to existing files.)
The information contained in the log file is technical in nature and therefore not intended to be understandable by end users. Nor is it designed to be machine-parsable; the format of the file is subject to change without notice.
/LOG="filename" Same as /LOG, except it allows you to specify a fixed path/filename to use for the log file. If a file with the specified name already exists it will be overwritten. If the file cannot be created, Setup will abort with an error message.
cmd
and click on Command Prompt:/log
parameter:Edit your question and add the output from the log to it. Also consider replacing your snippet of script with your complete script (the original script that used DirExists
.
I have done a bit more research and found this interesting question. If you look at your log output it only installs the 64 bit edition:
2018-03-05 14:01:08.883 -- Run entry --
2018-03-05 14:01:08.883 Run as: Current user
2018-03-05 14:01:08.883 Type: Exec
2018-03-05 14:01:08.883 Filename: C:\Users\Bruker\AppData\Local\Temp\is-SP07M.tmp\vcredist_x64.exe
2018-03-05 14:01:08.883 Parameters: /install /passive
2018-03-05 14:01:21.800 Process exit code: 0
Change this line from:
Filename: "{tmp}\vcredist_x86.exe"; Parameters: "/install /passive"; Check: not IsWin64 and not VCinstalled32
to:
Filename: "{tmp}\vcredist_x86.exe"; Parameters: "/install /passive"; Check: not VCinstalled32
Your executable appears to be 32 bit, and based on that question I referred to it states:
No, you need the x86 version to run 32-bit VC++ programs, and you need the x64 version to run 64-bit VC++ programs.
Upvotes: 2