Is it possible to set the install mode in Inno Setup (32 or 64 bit)? - 32bit-64bit

I know that the directive ArchitecturesInstallIn64BitMode=x64 ia64 can be set, so that Inno Setup will decide on the processor type and install in 64 bit if its possible.
But I need some [Code] section function to set the install mode (32 or 64).
Is it even possible?
Example:
This function will return the Java installation architecture (32 or 64):
function CheckJavaInstallation()
According to the result I want to set Inno Setup to the correct install mode -> Selection of the correct Program Files or Program files (x86) and in the correct registry (normal or WOW6432Node).

I would suggest you to create two checker functions: IsJava32 and IsJava64. Then for every file, registry entry, etc you add the two versions with one of the checkers, example:
[Files]
Source: "SourceSetupDir32\aFile1.dll"; DestDir: "{pf32}\{#MyAppName}\"; Check: IsJava32;
Source: "SourceSetupDir64\aFile1.dll"; DestDir: "{pf64}\{#MyAppName}\"; Check: IsJava64;
;...
Source: "SourceSetupDir32\aFile4.dll"; DestDir: "{pf32}\{#MyAppName}\"; Check: IsJava32;
Source: "SourceSetupDir64\aFile4.dll"; DestDir: "{pf64}\{#MyAppName}\"; Check: IsJava64;
[Registry]
Root: HKCU32; Subkey: "Software\My Company"; Flags: uninsdeletekeyifempty; Check: IsJava32;
Root: HKCU64; Subkey: "Software\My Company"; Flags: uninsdeletekeyifempty; Check: IsJava64;
[Code]
Function IsJava32(): Boolean;
Begin
{ ... }
End;
Function IsJava64(): Boolean;
Begin
Result := Not IsJava32;
End;

A simpler solution can be find here. For those that are searching for an answer to this question.

Related

Firebase (Cloud Functions) - Compile FFmpeg with video stabilization (vidstab)

I'm using Firebase with the Cloud Functions feature and FFmpeg.
I see that FFmpeg is now included by default in the pre-installed packages, as you can see here.
This way, I can use it with a spawn command like this:
await spawn('ffmpeg', [
'-y',
'-i',
tempFilePath,
'-vf',
'transpose=2',
targetTempFilePath,
]);
and it works perfectly.
Unfortunately, when I'm trying to stabilize the video with vidstab, it seems that I have the following error:
ChildProcessError: `ffmpeg -i /tmp/1628240712871_edited.mp4 -vf vidstabdetect=result=transforms.trf -an -f null -` failed with code 1
I think it's because libvidstab is not activated with FFmpeg, as stated below:
To enable compilation of this filter, you need to configure FFmpeg with
--enable-libvidstab.
Do you have any idea how I can activate/use it?
Thank you in advance
For your information, I achieved to do it.
I had to upload my own binary. For that, I just downloaded a pre-compiled Debian-based Linux environment binary (here, but you can have your own anywhere else ;) ) and put it inside the functions directory.
After that, I just deployed the functions, as usual.
This would result in the functions being deployed along with the binary.
I can now call my own binary with a command like this:
import { spawn } from 'child-process-promise';
...
await spawn('./ffmpeg', [
// my commands
]);
I hope it helps ;)

Karate - how to set path to driver properly (executable)

I use Karate paralel run and everything is OK when I use driver configuration:
karate.configure('driver', { type: 'geckodriver', executable: '/Users/rabu/Downloads/geckodriver'});
But I need to change the executable URL from code above to:
project (driver is part of the test project), e.g.: "src/test/java/drivers/geckodriver"
HTTP/HTTPS url e.g. driver is available on "http://radimbukovsky.cz/extra/geckodriver"
I have tried many url variations but I have not been successfull.
Thank you for the help.
Try
karate.configure('driver', { type: 'geckodriver', executable: './src/test/java/drivers/geckodriver'});

Access environment variables inside a jam configuration file

I am trying to cross compile Boost python library with x86_64-w64-mingw32 compiler on a Linux host. I need to specify the path to python libraries and include files inside my user-config.jam file. Instead of hard coding this path I would like to read it through an environment variable.
Below are the contents of my user-config.jam file:
import os ;
local PYTHON_DEPS_1 = os.environ[PYTHON_DEPS] ;
using python : 2.7 : /usr/local/bin/python2.7 : $(PYTHON_DEPS_1)/usr/include/python2.7 : $(PYTHON_DEPS_1)/usr/lib ;
However the above expands to the below include path used during boost python module build in the compiler command line:
" -I"os.environ[PYTHON_DEPS]/usr/include/python2.7"
Can someone please guide how to properly use environment variables ?
Try changing your
local PYTHON_DEPS_1 = os.environ[PYTHON_DEPS] ;
to
local PYTHON_DEPS_1 = [ os.environ PYTHON_DEPS ] ;

Inno Setup: Make desktop icon 'Run as administrator' [duplicate]

I'm creating an installer using Inno Setup. As part of the install process I'm installing Tomcat. On Windows 7 I suffer from the problem described here:
http://blog.paulbouwer.com/2010/10/23/the-case-of-the-annoying-tomcat-6-monitor/
I can fix it by manually setting the 'Run as administrator' on tomcat7w.exe (the issue and the root cause is the same for tomcat7 as well), but I don't know how to do it through Inno Setup.
I'm finding threads that explain running some_program.exe as administrator, but here the program is started when the Tomcat service starts (e.g. on machine start-up), so I need a way to flag it using Inno Setup to 'Run as administrator' rather than actually run it.
You can add a Registry entry in [Registry] Section that will set run as Administrator as a default action for running this app.
Example:
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; \
ValueType: String; ValueName: "{app}\tomcat7w.exe"; ValueData: "RUNASADMIN"; \
Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1
If you really want to set the "Run as administrator" flag of the shortcut (as opposite to forcing the target application run with administrator privileges), you can use this code:
[Icons]
Name: "{userdesktop}\My Program"; Filename: "{app}\MyProg.exe"; \
AfterInstall: SetElevationBit('{userdesktop}\My Program.lnk')
[Code]
procedure SetElevationBit(Filename: string);
var
Buffer: string;
Stream: TStream;
begin
Filename := ExpandConstant(Filename);
Log('Setting elevation bit for ' + Filename);
Stream := TFileStream.Create(FileName, fmOpenReadWrite);
try
Stream.Seek(21, soFromBeginning);
SetLength(Buffer, 1);
Stream.ReadBuffer(Buffer, 1);
Buffer[1] := Chr(Ord(Buffer[1]) or $20);
Stream.Seek(-1, soFromCurrent);
Stream.WriteBuffer(Buffer, 1);
finally
Stream.Free;
end;
end;
This is based on:
LinkFlags in [MS-SHLLINK]: Shell Link (.LNK) Binary File Format;
How to create a Run As Administrator shortcut using Powershell;
How can I use JScript to create a shortcut that uses "Run as Administrator"
Tested on Unicode version of Inno Setup. But it should, even more naturally, work on Ansi version too, though you should use Unicode version anyway.
If you want to allow user to execute the program at the end of the installation using a postinstall entry in [Run] section, you will of course need to explicitly request the elevation.
If the installer runs with Administrator privileges, you can simply add runascurrentuser flag:
[Run]
Filename: "{app}\MyProg.exe"; Description: "Launch application"; \
Flags: postinstall nowait skipifsilent runascurrentuser
If the installer runs without Administrator privileges, set Verb parameter to runas (for that you also need shellexec flag):
[Run]
Filename: "{app}\MyProg.exe"; Verb: runas; Description: "Launch application"; \
Flags: postinstall nowait skipifsilent shellexec
Though, make sure you have a very good reason to run your application with Administrator privileges. User applications should not need Administrator privileges. If they need it, it's usually a sign of a bad design. One common (bad) reason to want an application to run with Administrator privileges, is that the application needs to write to its installation folder.
See Application does not work when installed with Inno Setup
Add the runascurrentuser flag attribute to the [Run] section
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: runascurrentuser nowait postinstall skipifsilent;

Inno Setup custom dialog with per user or per machine installation

I'm using Inno Setup (http://www.jrsoftware.org/isinfo.php) to create native bundle for my JavaFX application.
I'd like to create a custom step where ask the user if want a "per user" or "per machine" installation in order to permit both the unprivileged user, and the administrator to install the software.
It's this possible with Inno Setup? And if yes can you provide a trace to follow?
Take a look at this screenshot
Inno Setup 6
Inno Setup 6 has a built-in support for non-administrative install mode.
Basically, you can simply set PrivilegesRequiredOverridesAllowed:
[Setup]
PrivilegesRequiredOverridesAllowed=commandline dialog
Inno Setup 5
There's no such simple solution, in the previous versions of Inno Setup.
The easiest what you can do is to set PrivilegesRequired directive to none (undocumented value):
[Setup]
PrivilegesRequired=none
This will allow the installer to be run by an unprivileged user. It will install for him/her only.
For a privileged user, the Windows will typically detect that executable is an installer and it will popup a UAC prompt. It will install for all users afterwards.
For details see Make Inno Setup installer request privileges elevation only when needed
To make the installer install to "application data", when run by an unprivileged user, you can do:
[Setup]
DefaultDirName={code:GetDefaultDirName}
[Code]
function GetDefaultDirName(Param: string): string;
begin
if IsAdminLoggedOn then
begin
Result := ExpandConstant('{pf}\My Program');
end
else
begin
Result := ExpandConstant('{userappdata}\My Program');
end;
end;
If you really want the user to select, where to install to (though I do not think it is really necessary to allow the Administrator to install for him/herself), you can do this instead of the above DefaultDirName:
[Code]
var
OptionPage: TInputOptionWizardPage;
procedure InitializeWizard();
begin
OptionPage :=
CreateInputOptionPage(
wpWelcome,
'Choose installation options', 'Who should this application be installed for?',
'Please select whether you wish to make this software available for all users ' +
'or just yourself.',
True, False);
OptionPage.Add('&Anyone who uses this computer');
OptionPage.Add('&Only for me');
if IsAdminLoggedOn then
begin
OptionPage.Values[0] := True;
end
else
begin
OptionPage.Values[1] := True;
OptionPage.CheckListBox.ItemEnabled[0] := False;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = OptionPage.ID then
begin
if OptionPage.Values[1] then
begin
{ override the default installation to program files ({pf}) }
WizardForm.DirEdit.Text := ExpandConstant('{userappdata}\My Program')
end
else
begin
WizardForm.DirEdit.Text := ExpandConstant('{pf}\My Program');
end;
end;
Result := True;
end;

Resources