i am currently trying to create a custom script for installing a program. i need to check if the runtime engine of crystal reports 13 is installed, if not then installed. this is what i am trying to do:
//check crystalReports
if (not RegKeyExists(HKLM, 'Software\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports')) then
begin
crystalReportsNeeded := true;
if (not IsAdminLoggedOn()) then begin
MsgBox('GasSoft needs the Crystal Reports to be installed by an Administrator', mbInformation, MB_OK);
Result := false;
end
else
begin
memoDependenciesNeeded := memoDependenciesNeeded + ' Crystal Reports' #13;
SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
end;
end else
begin
MsgBox('installed cr', mbInformation, MB_OK);
end;
so this is updating a var caleed crystallreportsneeded to true or false. this variable will be use on the check function of the file. i have check on the control panel that the runtime engine is installed, but every time i run the setup it tries to installed the file. What am i missing., is the regkey correct?
After a bit of search i found out that some people instead of searching the folder goes to uninstal folder in HKLM->Windowns->CurrentVersion->Unistall.. in my case there is a register of the sap component with a product code but this does create a problem, if by any mean i update the version of the sap crystal reports through the web, and then try to run the setup script it creates a problem where the current version installed is newer than the one i am currently trying to install...
14/10/2014 - Update... So i still cant check if the program is installed or not, i have also tried doing this
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{{1D8E6291-B0D5-35EC-8441-6616F567A0F7}}'); //Your App GUID/ID
sUnInstallString := '';
if RegQueryStringValue(HKLM, sUnInstPath, 'InstallDate', sUnInstallString) then
MsgBox('Exists... ' , mbInformation, MB_OK);
this 1D8E6291-B0D5-35EC-8441-6616F567A0F7 refers to app id in this case vcc+... and i also tried this
RegQueryDWordValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{1D8E6291-B0D5-35EC-8441-6616F567A0F7}}', 'Version', version);
it doesnt show the message,, for the moment there are 2 options, one always install, and two check if file exists with FileExists..so any help is appreciated..
Update - 15/10/2014 So i think i have found a workaround, i dont think that this a solution because i cant explain some of the things that are happening.. This workaround is only in the case you are using Crystal reports and still needs to be tested in a 32 bits machine,but i almost certain that it will also work. for the moment i am testing on 64bits machine with win 8.1,and i will test the scripts in a 32bits also.
So i need to separate the scripts one for x32 and other for x64. the diference was in the [setup] parameters, if setup is for 64 bits it needs these 2 lines:
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
these are the description:
ArchitecturesAllowed=x64 specifies that Setup cannot run on anything but x64. ArchitecturesInstallIn64BitMode=x64" requests that the install be done in "64-bit mode" on x64, meaning it should use the native 64-bit Program Files directory and the 64-bit view of the registry.
so i am currently stating that the script can only work on 64bits, and that the folder system is 64bits..
after adding these 2 lines the code for finding the key executes with success. the code for trying to find if the key exists is below..
sKey:=ExpandConstant('SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports');
MsgBox('Before if' , mbInformation, MB_OK); //trying to test if is reaching this statement..
if( RegKeyExists(HKLM, sUnInstPath)) then begin
MsgBox('key found' , mbInformation, MB_OK);
this only happens if you need to install the crystal reports runtime engine 64bits. on my script i am checking for the existence of sql server are installed, if not exists then install.
if you have installed crruntime engine 32bits in a 64bits machine then you dont need to add the lines.. the path of the key is now SOFTWARE\Wow6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports i dont know if it is possible to add an if condition on the [Setup] that state that the 2lines of code are added if i am running the setup in a 64 bits machine..
if there are new updates to the situation i will update the post... Thanks in advance..
IsWin64
function can tell you that) and your setup will run in 32-bit mode (if you omit theArchitecturesInstallIn64BitMode
directive), you can access the 64-bit registry view by usingHKLM64
root key. There are two views on registry, 32-bit and 64-bit one. Because Inno Setup is 32-bit application, it maps by default to 32-bit registry view and as you describe, the key you are looking for is stored in 64-bit registry view (that's what you can see under non Wow node if you run 64-bit regedit, which is the default one on 64-bit Windows). – TLamaWow6432Node
. The 32-bit one does it vice versa. You are not accessing theWow6432Node
node directly. You are having the redirector for that. Inno Setup allows you to access both views. If you are running it in 32-bit mode (withoutArchitecturesInstallIn64BitMode
directive), theHKLM
(orHKLM32
) maps to 32-bit registry view whilstHKLM64
to 64-bit. – TLamathis topic
. It sounds complicated, but in short it's easy. 32-bit apps (whatever they are) are by default accessing 32-bit registry view, 64-bit apps. 64-bit view. What you are (by default) opening in 64-bit Windows is 64-bit regedit which shows 32-bit view under theWow6432Node
node. And by default Inno Setup runs in so called 32-bit mode which maps root keys (likeHKLM
) to 32-bit registry view. – TLamaWow6432Node
(64-bit view). Then they try to open such key under the default view in their 32-bit application wondering "where's my key ?". And yes, when you useHKLM64
, you are always accessing 64-bit view (that's why you must check if you are on 64-bit system, because there is no such view on 32-bit systems). – TLama