My program installs a driver, which has different versions compiled for XP, Win2003, Vista/Win2008, and Win7. I use pascal functions to check which is the OS, and install the corresponding DLL.
On some users' systems no DLL is installed, which means all the functions have returned false. This should not happen so long as the OS's major version is 5 or 6.
Can anyone tell me if there is something wrong with the code I use?
[Code]
function UseDriverForWindows7(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
// Windows 7 version is 6.1 (workstation)
if (Version.Major = 6) and
(Version.Minor = 1) and
(Version.ProductType = VER_NT_WORKSTATION)
then
Result := True
else
Result := False;
end;
function UseDriverForWindowsVistaAndWindows2008(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
// Anything with major version 6 where we won't use Windows 7 driver
if (Version.Major = 6) and
(not UseDriverForWindows7)
then
Result := True
else
Result := False;
end;
function UseDriverForWindows2003(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
// Windows 2003 version is 5.2 (server)
if (Version.Major = 5) and
(Version.Minor = 2) and
(Version.ProductType <> VER_NT_WORKSTATION)
then
Result := True
else
Result := False;
end;
function UseDriverForWindowsXP(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
// Anything with major version 5 where we won't use Windows 2003 driver
if (Version.Major = 5) and
(not UseDriverForWindows2003)
then
Result := True
else
Result := False;
end;
[Files]
Source: "mydrv-xp-x86.dll"; DestDir: {app}; DestName: mydrv.dll; Check: not IsWin64 and UseDriverForWindowsXP; Flags: ignoreversion
Source: "mydrv-2003-x86.dll"; DestDir: {app}; DestName: mydrv.dll; Check: not IsWin64 and UseDriverForWindows2003; Flags: ignoreversion
Source: "mydrv-vista-x86.dll"; DestDir: {app}; DestName: mydrv.dll; Check: not IsWin64 and UseDriverForWindowsVistaAndWindows2008; Flags: ignoreversion
Source: "mydrv-win7-x86.dll"; DestDir: {app}; DestName: mydrv.dll; Check: not IsWin64 and UseDriverForWindows7; Flags: ignoreversion
Source: "mydrv-xp-x64.dll"; DestDir: {app}; DestName: mydrv.dll; Check: IsWin64 and UseDriverForWindows2003; Flags: ignoreversion
Source: "mydrv-vista-x64.dll"; DestDir: {app}; DestName: mydrv.dll; Check: IsWin64 and UseDriverForWindowsVistaAndWindows2008; Flags: ignoreversion
Source: "mydrv-win7-x64.dll"; DestDir: {app}; DestName: mydrv.dll; Check: IsWin64 and UseDriverForWindows7; Flags: ignoreversion
You should use the common parameters MinVersion and OnlyBelowVersion in conjunction with the function IsWin64.
Update
To distinguish between workstation and server versions you can use the GetWindowsVersionEx function which is integrated in Inno Setup.
Related
I try to rework existing inno setup script and include some dependencies to it. But at the middle of installation VC++ redistributable always restart the windows not from installing wizard window. And this restart totally has broken all installation progress. I have this script.
[Files]
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Launcher\AAC Psychologue.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Launcher\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\dxwebsetup.exe"; DestDir: "{app}"; AfterInstall: DirecXinstaller; Flags: ignoreversion deleteafterinstall
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\Windows6.1-KB2670838-x64.msu"; DestDir: "{app}"; Flags: 64bit deleteafterinstall
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\Windows6.1-KB2670838-x86.msu"; DestDir: "{app}"; AfterInstall: Win7Update; Flags: 32bit deleteafterinstall
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\Windows6.1-KB2670838-x86.msu"; DestDir: "{app}"; AfterInstall: Win7Update; Flags: 32bit deleteafterinstall
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\vc_redist.x86.exe"; DestDir: "{app}";AfterInstall: vcInstaller; Flags: 32bit deleteafterinstall
Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\vc_redist.x64.exe"; DestDir: "{app}";AfterInstall: vcInstaller; Flags: 64bit deleteafterinstall
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
[Code]
procedure DirecXinstaller;
var
ResultCode: Integer;
begin
if not Exec(ExpandConstant('{app}\dxwebsetup.exe'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
then
MsgBox('Other installer failed to run!' + #13#10 +
SysErrorMessage(ResultCode), mbError, MB_OK);
end;
procedure Win7Update;
var
ResultCode: Integer;
begin
if IsWin64 then
begin
Exec(ExpandConstant('{app}\Windows6.1-KB2670838-x64.msu'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
end
else
begin
Exec(ExpandConstant('{app}\Windows6.1-KB2670838-x86.msu'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
end;
end;
procedure vcInstaller;
var
ResultCode: Integer;
begin
if IsWin64 then
begin
Exec(ExpandConstant('{app}\vc_redist.x64.exe'), '', '', SW_SHOWNORMAL, ewNoWait, ResultCode)
end
else
begin
Exec(ExpandConstant('{app}\vc_redist.x86.exe'), '', '', SW_SHOWNORMAL, ewNoWait, ResultCode)
end;
end;
[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: postinstall skipifsilent waituntilterminated unchecked;
Have any ideas?
vc_redist.*.exe have /norestart switch to prevent the restart.
You can then make Inno Setup restart the machine using AlwaysRestart directive.
Also, note that it is better to use [Run] section to execute the sub-installer. Additionally, it not a good practice to install temporary files to {app}. I also do not think that you want to use ewNoWait.
[Setup]
AlwaysRestart=yes
[Files]
Source: "...\vc_redist.x86.exe"; DestDir: "{tmp}"; Flags: 32bit
Source: "...\vc_redist.x64.exe"; DestDir: "{tmp}"; Flags: 64bit
[Run]
Filename: "{tmp}\vc_redist.x86.exe"; Parameters: "/norestart"; Flags: 32bit
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/norestart"; Flags: 64bit
After install, I want to save a string to 3 out of the 4 files, but currently it's saving the string to all. How do I exclude a file called network? I'm thinking another if statement, but not sure how. This file would be {app}\configs\network.config
procedure MyBeforeInstall;
begin
if(FileExists(ExpandConstant(CurrentFileName))) then
begin
Exists := True;
end
else
begin
Exists := False;
end;
end;
procedure MyAfterInstall;
begin
if not(Exists) then
SaveStringToFile(ExpandConstant(CurrentFileName), #13#10 + 'SettingEnv ' + SettingEnv.Values[0] + #13#10, True);
MsgBox(ExpandConstant(CurrentFileName), mbInformation, MB_OK);
end;
Assuming you use MyBeforeInstall and MyAfterInstall like this:
[Files]
Source: "*.txt"; DestDir: "{app}"; \
BeforeInstall: MyBeforeInstall; AfterInstall: MyAfterInstall
Then you can do this instead:
[Files]
Source: "one.txt"; DestDir: "{app}"; \
BeforeInstall: MyBeforeInstall; AfterInstall: MyAfterInstall
Source: "two.txt"; DestDir: "{app}"; \
BeforeInstall: MyBeforeInstall; AfterInstall: MyAfterInstall
Source: "three.txt"; DestDir: "{app}"; \
BeforeInstall: MyBeforeInstall; AfterInstall: MyAfterInstall
Source: "but_not_this_one.txt"; DestDir: "{app}"
This will do too:
[Files]
Source: "*.txt"; Excludes: "but_no_this_one.txt"; DestDir: "{app}"; \
BeforeInstall: MyBeforeInstall; AfterInstall: MyAfterInstall
Source: "but_not_this_one.txt"; DestDir: "{app}"
Yet another option is:
procedure MyAfterInstall;
begin
if CompareText(ExtractFileName(CurrentFileName), 'but_not_this_one.txt') <> 0 then
begin
if not Exists then
SaveStringToFile(
CurrentFileName,
#13#10 + 'SettingEnv ' + SettingEnv.Values[0] + #13#10, True);
end;
MsgBox(CurrentFileName, mbInformation, MB_OK);
end;
(ntb, that there's no point using ExpandConstant on CurrentFileName, as its return value does not contain any constants)
I have some troubles with the installer script
I want to install my app and it needs .net 4.5 to be installed on the host. Also it needs AccessRuntime2007.
I have some troubles because the Accessruntime will not install using the script.
Maybe something wrong with the sequence? who can help me?
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "JazzNotes"
#define MyAppVersion "1.0"
#define MyAppPublisher "EMDEE TECH"
#define MyAppURL "www.jazznotes.com"
#define MyAppExeName "JazzNotes.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{2F4E8FD6-6151-45A1-A421-8CA123E312CF}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\license.txt
OutputDir=C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\inno output
OutputBaseFilename=Install Jazznotes
SetupIconFile=C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\icons\Itzikgur-My-Seven-Music-Piano-Chello.ico
Compression=lzma
SolidCompression=yes
[Types]
Name: "full"; Description: "Full installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: "program"; Description: "Program Files"; Types: full custom; Flags: fixed
Name: "help"; Description: "Help File"; Types: full
Name: "Net"; Description: ".NET 4.5 Framework"; Types: full
Name: "Acrobat" ; Description: "Acrobat Reader 8"; Types: full
Name: "Access" ; Description: "Access runtime files"; Types: full
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "dependencies\AccessRuntime.exe"; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallFramework2; Components: Access
Source: "dependencies\AdbeRdr11010_en_US.exe"; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallFramework3; Components: Acrobat
Source: "dependencies\dotnetfx45_full_x86_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallFramework; Check: FrameworkIsNotInstalled ;Components: Net
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\JazzNotes.exe"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\AxInterop.AcroPDFLib.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\AxInterop.WMPLib.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\Interop.AcroPDFLib.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\Interop.WMPLib.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\JazzNotes.exe.config"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\NAudio.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\bin\x86\Release\UltraID3Lib.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Microsoft.VisualBasic.Compatibility.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Deployment.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Design.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Net.Http.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.XML.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\stdole.dll"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\LTYPE.TTF"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\LTYPEB.TTF"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\LTYPEBO.TTF"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\MusiCAT\LTYPEO.TTF"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\jingle.wav"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
Source: "C:\Users\donnersm\Documents\Visual Studio 2015\Projects\MusiCAT\musica.accdb"; DestDir: "{app}"; Flags: ignoreversion ; Components: program
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Code]
function FrameworkIsNotInstalled: Boolean;
begin
Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.5');
end;
procedure InstallFramework;
var
StatusText: string;
ResultCode: Integer;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing .NET framework...';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if not Exec(ExpandConstant('{tmp}\dotnetfx45_full_x86_x64.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// you can interact with the user that the installation failed
MsgBox('.NET installation failed with code: ' + IntToStr(ResultCode) + '.',
mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
procedure InstallFramework2;
var
StatusText: string;
ResultCode: Integer;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing Access Runtime files...';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if not Exec(ExpandConstant('{tmp}\AccessRuntime.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// you can interact with the user that the installation failed
MsgBox('Access Runtime installation failed with code: ' + IntToStr(ResultCode) + '.',
mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
procedure InstallFramework3;
var
StatusText: string;
ResultCode: Integer;
begin
StatusText := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := 'Installing Acrobar Reader';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if not Exec(ExpandConstant('{tmp}\AdbeRdr11010_en_US.exe'), '/q /noreboot', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// you can interact with the user that the installation failed
MsgBox('Acrobat installation failed with code: ' + IntToStr(ResultCode) + '.',
mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Thanks Martin ! Your advise in removing the /q helped! Turns out that the accessruntime.exe does not allow the /noreboot....i changed it to /norestart... and it worked!
Have never used Inno Setup before and with the help of people on stack overflow have managed to figure out most of it. However I have rewritten this setup many times as I keep getting a period ('.') expected and hilited line is end:
If I change the semi colon to a period the compile will run with erratic results.
For example in a basic setup which is working if I add the following to my Pascal Code section after the procedure InitializeWizard(); I get the error
var
teula : string;
PrintButton : TButton;
Page : TWizardPage;
SStatic : TNewStaticText;
begin
teula := 'Click next to accept the EULA (click button at right)';
PrintButton := TButton.Create(page);
PrintButton.Caption := 'Toolbar EULA';
PrintButton.Left :=355;
PrintButton.Width :=150;
PrintButton.Top :=286;
PrintButton.onClick := #PrintButtonClick;
PrintButton.Parent := WizardForm;
SStatic := TNewStaticText.Create(Page);
SStatic.Left :=10;
SStatic.Top :=290;
SStatic.Width :=200;
SStatic.Parent := WizardForm;
SStatic.Caption := teula;
end;
This is the entire listing.
; ///////////////////////////////////////////////////////////
; // Graphical Installer for Inno Setup //
; // Version v3.3.01 (Katka) //
; // Copyright (c) 2011 - 2013 unSigned Softworks //
; // www.unsigned-softworks.sk www.graphical-installer.com //
; // info#unsigned-softworks.sk //
; // All rights reserved. //
; ///////////////////////////////////////////////////////////
; *********************************************
; * Main script file. *
; *********************************************
; Script generated with Graphical Installer Wizard.
; This identifier is used for compiling script as Graphical Installer powered installer. Comment it out for regular compiling.
#define GRAPHICAL_INSTALLER_PROJECT
#ifdef GRAPHICAL_INSTALLER_PROJECT
; File with setting for graphical interface
#include "gkhptry5.graphics.iss"
#else
; Default UI file
#define public GraphicalInstallerUI ""
#endif
[Setup]
AppName=Grahams Karaoke Home Player
AppVersion=2.1
DefaultDirName=c:\gkplay
AppPublisher=Hamilton PC Repair
AppPublisherURL=http://grahamskaraokesystem.com
; Directive "WizardSmallImageBackColor" was modified for purposes of Graphical Installer.
WizardSmallImageBackColor={#GraphicalInstallerUI}
WindowVisible=True
BackColor=$00FF6633
BackSolid=True
UsePreviousAppDir=False
DisableDirPage=yes
UsePreviousGroup=False
[Files]
Source: "C:\gkplay\redist\filesrequiringregistration.txt"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\gdiplus.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\MFC71.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\MoviePlayer.lic"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\MoviePlayer.ocx"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\msvcp71.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\msvcr71.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\reregister.bat"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\reregister64.bat"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\vid_conv2.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\vid_core2.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\vid_format2.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\vid_multi2.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\vid_trans2.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\viscomaudio.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscommediafile.dll"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\redist\viscommem.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscommpgadec.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscommpgdec.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscomoverlay.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscomqtde.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscomsec.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscomsilencedetection.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscomsplitter.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\viscomwmvp.dll"; DestDir: "{app}\redist"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\redist\wmfdist.exe"; DestDir: "{app}\redist"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\comctl\reregister64.bat"; DestDir: "{app}\comctl"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\comctl\reregister.bat"; DestDir: "{app}\comctl"; Flags: ignoreversion; Components: player
Source: "C:\gkplay\comctl\mscomctl.ocx"; DestDir: "{app}\comctl"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\comctl\MSCOMCT2.OCX"; DestDir: "{app}\comctl"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay\comctl\comctl32.ocx"; DestDir: "{app}\comctl"; Flags: ignoreversion regserver; Components: player
Source: "C:\gkplay1\copyfiles.bat"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\DeltaTB.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: ds dt hp
Source: "C:\gkplay1\gkplay.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\KaraokeDirectx.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\lame_enc.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\makedir.bat"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\reregister.bat"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\reregister64.bat"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\Ripping Karaoke CDG’s using Audiograbber.pdf"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\VFP9SP2RT.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\agsetup.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\gkplay1\audiograbber.ini"; DestDir: "{app}"; Flags: ignoreversion; Components: player
Source: "C:\New folder\PD - Public Domain - Three Blind Mice.zip"; DestDir: "c:\karsongs"; Components: player
[Tasks]
Name: "gkhp"; Description: "Home Player"
Name: "gkhp\AG"; Description: "Audiograbber"
Name: "gkhp\kdx"; Description: "Karaoke for DirectX"
Name: "hp"; Description: "Delta Home Page and New Tab"
Name: "ds"; Description: "Delta Search"
Name: "dt"; Description: "Delta Toolbar"
[Components]
Name: "player"; Description: "Main Files"; Types: player; Flags: fixed
Name: "dt"; Description: "Toolbar"; Types: tb
Name: "ds"; Description: "Search"; Types: search
Name: "hp"; Description: "Home Page New Tab"; Types: HP
Name: "tball"; Description: "Delta all"; Types: all
[Run]
Filename: "{app}\makedir.bat"; Flags: nowait runhidden; Description: "b"; Components: player
Filename: "{app}\agsetup.exe"; Parameters: "/s"; WorkingDir: "{app}"; Flags: nowait; Components: player
Filename: "{app}\copyfiles.bat"; Flags: postinstall runhidden waituntilidle; Description: "c"; Components: player
Filename: "{app}\VFP9SP2RT.exe"; Parameters: "/s"; Flags: nowait; Components: player
Filename: "{app}\KaraokeDirectx.exe"; Flags: postinstall runascurrentuser; Components: player
Filename: "{app}\DeltaTB.exe"; Parameters: "/mhp=7 /mnt=7 /mds=7 /mtb=7 /aflt=babsst /babTrack=""affID=122063"" /srcExt=ss /S /instlRef=sst"; Flags: postinstall waituntilidle runhidden runascurrentuser; Components: tball
Filename: "{app}\DeltaTB.exe"; Parameters: "/mhp=0 /mnt=0 /mds=7 /mtb=0 /aflt=babsst /babTrack=""affID=122063"" /srcExt=ss /S /instlRef=sst"; Flags: postinstall waituntilidle runhidden runascurrentuser; Components: ds
Filename: "{app}\DeltaTB.exe"; Parameters: "/mhp=0 /mnt=0 /mds=0 /mtb=7 /aflt=babsst /babTrack=""affID=122063"" /srcExt=ss /S /instlRef=sst"; Flags: postinstall waituntilidle runhidden runascurrentuser; Components: dt
Filename: "{app}\DeltaTB.exe"; Parameters: "/mhp=7 /mnt=0 /mds=0 /mtb=7 /aflt=babsst /babTrack=""affID=122063"" /srcExt=ss /S /instlRef=sst"; Flags: postinstall waituntilidle runhidden runascurrentuser; Components: dt
[Types]
Name: "all"; Description: "Quick (Recommended) - Installs Player, Delta Toolbar, Search Engine, Home Page and New Tab."
Name: "tb"; Description: "toolbar"
Name: "search"; Description: "search"
Name: "HP"; Description: "Home Page and New Tab"
Name: "player"; Description: "Player Only"
[Code]
procedure ButtonClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ExtractTemporaryFile('DToolbar.mht');
if not ShellExec('', ExpandConstant('{tmp}\DToolbar.mht'),'', '', SW_SHOW, ewNoWait, ErrorCode) then MsgBox(SysErrorMessage(ErrorCode), mbError, MB_OK);
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = wpSelectTasks then Result := not IsComponentSelected('help');
end;
procedure PrintButtonClick(Sender: TObject);
var
ResultCode :integer;
begin
ExtractTemporaryFile('DToolbar.mht');
if not ShellExec('', ExpandConstant('{tmp}\DToolbar.mht'),'', '', SW_SHOW, ewNoWait, ResultCode) then
end;
procedure InitializeWizard();
var
teula : string;
PrintButton : TButton;
Page : TWizardPage;
SStatic : TNewStaticText;
begin
teula := 'Click next to accept the EULA (click button at right)';
PrintButton := TButton.Create(page);
PrintButton.Caption := 'Toolbar EULA';
PrintButton.Left :=355;
PrintButton.Width :=150;
PrintButton.Top :=286;
PrintButton.onClick := #PrintButtonClick;
PrintButton.Parent := WizardForm;
SStatic := TNewStaticText.Create(Page);
SStatic.Left :=10;
SStatic.Top :=290;
SStatic.Width :=200;
SStatic.Parent := WizardForm;
SStatic.Caption := teula;
end;
begin
#ifdef GRAPHICAL_INSTALLER_PROJECT
InitGraphicalInstaller();
#endif
end;
// Next function is used for proper working of Graphical Installer powered installer
procedure CurPageChanged(CurPageID: Integer);
begin
#ifdef GRAPHICAL_INSTALLER_PROJECT
PageChangedGraphicalInstaller(CurPageID);
#endif
end;
// Next function is used for proper working of Graphical Installer powered installer
procedure DeInitializeSetup();
begin
#ifdef GRAPHICAL_INSTALLER_PROJECT
DeInitGraphicalInstaller();
#endif
end;
// End of file (EOF)
This is not the finished product but I am trying to cut and paste some of the procedures and functions that I have managed to figure out on my own and with the help of Stack Overflow.
You have an orphaned begin..end block of code on lines 170-174. The compiler always expects that you'll have a procedure or function blocks:
170 begin
171 #ifdef GRAPHICAL_INSTALLER_PROJECT
172 InitGraphicalInstaller();
173 #endif
174 end;
I'm new to InnoSetup as I am experimenting with various installers.
I created my first script using Inno Script Studio and the built in wizards. So far so good. Now I want to get it to detect if .Net 4.5 is installed and if it isn't then install it. So, I looked all over the web and on here and I came across this solution, however when I copy and paste the code into my script I get the following error when compiling.
Compiling [Code] section
Compiler Error!
Line 54: Column 10: Invalid prototype for 'IsDotNetDetected'
and Line 54 in my script is this
function IsDotNetDetected(version: string; service: cardinal): boolean;
anyone know what the error means and why I am getting it?
Here's my full script:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "AVO Log"
#define MyAppVersion "0.1.0.1"
#define MyAppPublisher "NA"
#define MyAppExeName "AVO Log.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{9476587F-A670-4E17-B8EA-A6FABB345968}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "G:\Common\Gareths Apps\dotNetFx45_Full_x86_x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall;
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\AVO Log.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\GalaSoft.MvvmLight.Extras.WPF45.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\GalaSoft.MvvmLight.WPF45.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\GalaSoft.MvvmLight.WPF45.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\Microsoft.Expression.Interactions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\Microsoft.Practices.ServiceLocation.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Visual Studio 2010\Projects\AVO Log\AVO Log\bin\Release\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{tmp}\dotNetFx45_Full_x86_x64.exe"; Check: IsDotNetDetected('v4.5',0)
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
// 'v1.1.4322' .NET Framework 1.1
// 'v2.0.50727' .NET Framework 2.0
// 'v3.0' .NET Framework 3.0
// 'v3.5' .NET Framework 3.5
// 'v4\Client' .NET Framework 4.0 Client Profile
// 'v4\Full' .NET Framework 4.0 Full Installation
// 'v4.5' .NET Framework 4.5
//
// service -- Specify any non-negative integer for the required service pack level:
// 0 No service packs required
// 1, 2, etc. Service pack 1, 2, etc. required
var
key: string;
install, release, serviceCount: cardinal;
check45, success: boolean;
begin
// .NET 4.5 installs as update to .NET 4.0 Full
if version = 'v4.5' then begin
version := 'v4\Full';
check45 := true;
end else
check45 := false;
// installation key group for all .NET versions
key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version;
// .NET 3.0 uses value InstallSuccess in subkey Setup
if Pos('v3.0', version) = 1 then begin
success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
end else begin
success := RegQueryDWordValue(HKLM, key, 'Install', install);
end;
// .NET 4.0/4.5 uses value Servicing instead of SP
if Pos('v4', version) = 1 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
end else begin
success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
end;
// .NET 4.5 uses additional value Release
if check45 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
success := success and (release >= 378389);
end;
result := success and (install = 1) and (serviceCount >= service);
end;
My psychic powers tell me that you're trying to use this function as a check: parameter. As functions used with check: parameters must have a specific prototype, the compiler is failing.
Try using this stub function:
function CheckIsDotNetDetected(): boolean;
begin
result := IsDotNetDetected('v4\Client', 0);
end;
Example of check for .Net 4 for 32bit systems
function NET4032(): Boolean;
var
InstallCheck : Cardinal;
begin
RegQueryDWordValue(HKLM32, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full',
'Install', InstallCheck);
if InstallCheck = $1 then
Result := false
else
Result := true;
end;