How can I use the special character: á in Inno Setup?
For example:
Without special character at Parameters:
Filename: "{sys}\icacls.exe"; Parameters: """{app}\IRs\IRS.FDB"" /grant Todos:F /inheritance:d"; Flags: runhidden shellexec
But, when there is a special character the command doesn't work as below:
Filename: "{sys}\icacls.exe"; Parameters: """{app}\IRs\IRS.FDB"" /grant Usuários:F /inheritance:d"; Flags: runhidden shellexec
I workaround the issue by using the group SID:
Filename: "{sys}\icacls.exe"; Parameters: """{app}\IRs\IRS.FDB"" /grant *S-1-5-32-545:(F) /inheritance:d"; Flags: runhidden shellexec
Related
I am trying to sign my Inno Setup file. I get an exit error 0x1 ?? Here is the line I am using to configure the sign tool in Inno:
"c:\Digital certificate\signtool.exe" sign/a/t http://timestamp.digicert.com / f "c:\Digital cerificate\mycertificate.pfx"/p "mypassword"/d "C:\Flash projects\flash projects 2022\Reset\inno\reset setup file\ResetSetup.exe" $f
Is the syntax OK? I am not sure about the use of quotations when specifying file names, also the $f at the end of the command line? Do I need it?
Any links / examples to how to configure the signtool would be appreciated.
In Inno Setup I configure the Sign Tools:
SignTool="C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign $p
You would have to qualify the path to the signtool executable on your PC.
Then, in my script I have some definitions:
; SignTool parameters
#define SignedDesc "$qAppName$q"
#define SignedPfx "$qd:\My Certificate\2021\My Certificate.pfx$q"
#define SignedTimeStamp "$qhttp://timestamp.digicert.com$q"
;define SignedTimeStamp "$qhttp://timestamp.comodoca.com/authenticode$q"
;#define SignedTimeStamp "$qhttp://timestamp.globalsign.com/scripts/timestamp.dll$q"
;#define SignedTimeStamp "$qhttp://tsa.starfieldtech.com$q"
;#define SignedTimeStamp "$qhttp://timestamp.sectigo.com$q"
; The last server needs 15 seconds delay.
#define SignedPw "$qabc1234$q"
Adjust the values as required for your application etc..
In the [Setup] section (read more):
SignedUninstaller=yes
SignTool=SignTool /d {#SignedDesc} /du $q{#AppURL}$q /f {#SignedPfx} /p {#SignedPw} /t {#SignedTimeStamp} /v $f
SignToolRunMinimized=yes
SignToolMinimumTimeBetween=5000
In the [Files] section make sure you use either sign or signonce. Eg:
Source: "AppRestarter.exe"; DestDir: "{app}"; Flags: IgnoreVersion signonce
I am using special logging build to generate installation logs.
I have observed the logs are not generating when called another installer from installer script.
For ex -
ExecWait '"$INSTDIR\installer1.exe" /S _?=$INSTDIR'
The log is generating for main installer but not for installer1.exe
The installer1.exe contains lots of components and I need to print the logs for the same. I have tried enabling logset on in the installer1 script but no luck.
Tried using dumplog but it doesn't work with silent installation.
Any help would be appreciated!
Sample code from Main Installer script --
InstallDir "C:\MyFolder"
Name "${PRODUCT_NAME_VERSION}"
OutFile "${OUT_FILE}"
Section "Test"
SetOutPath $INSTDIR
LogSet on
ExecWait '"$EXEDIR\Packages\installer1.exe" /S /INST=$INSTDIR' $0
SectionEnd
Sample code from sub-installer script ---
InstallDir "C:\MyFolder"
Section "-Demo"
SetOutPath $INSTDIR
LogSet on
LogText "Print something"
SetOutPath $INSTDIR\ExternalFolder\Demo
File /nonfatal /a /r $INSTDIR\ExternalFolder\Demo\Test
ExecWait '"$INSTDIR\ExternalFolder\Demo\Test\TestSetup.exe" /silent '
SectionEnd
The sub-installer (installer1.exe) is pre-compiled and kept the exe in $EXEDIR\Packages\installer1.exe The patch is valid.
_?= is special syntax that is only supported by NSIS uninstallers, installers use /D=.
ExecWait '"$InstDir\installer.exe" /S /D=$InstDir'
Logging of course has to be enabled in this sub-installer as well.
/D= overrides the InstallDir attributes, forcing $InstDir to the specified path before .onInit is executed.
InstallDir $INSTDIR does not make sense, use something like InstallDir "$ProgramFiles\MyApp"
Here are examples from the #emit directive documentation:
[Files]
#emit 'Source: "file1.ext"; DestDir: {' + MyDestDir + '}'
Source: "file2.ext"; DestDir: {#MyDestDir}
#emit GenerateVisualCppFilesEntries ; user defined function
In the first line I don't understand the DestDir part. Looks like the # symbol is missing there.
I understand the second line. But why do we need to use the #emit directive like in line 1 anyway?
Inno Setup preprocessor directives can be invoked using two syntaxes.
A basic syntax:
#directive params
And an inline syntax:
{#directive params}
On top of that, the #emit directive is the default inline directive, assumed, when no explicit directive name is specified.
So these three are equivalent:
#emit MyDestDir
{#emit MyDestDir}
{#MyDestDir}
Though the first does not make sense with a path variable, as it would result in invalid script syntax – but it can be used with a variable that contains a valid script syntax:
#define FileSectionEntry 'Source: ' + MySource + '; DestDir: ' + MyDestDir
#emit FileSectionEntry
While the other two inline examples can make sense, but only with other code on the same line, like in the code from your question:
Source: "file2.ext"; DestDir: {#MyDestDir}
Additionally an #emit with a (string) constant is basically pointless, as you can achieve the same without preprocessor.
These three are equivalent:
Source: "file2.ext"; DestDir: "{app}"
#emit 'Source: "file2.ext"; DestDir: "{app}"'
{#'Source: "file2.ext"; DestDir: "{app}"'}
So getting back to the code in your script, these are (almost) equivalent:
#emit 'Source: "file1.ext"; DestDir: {' + MyDestDir + '}'
Source: "file1.ext"; DestDir: {#MyDestDir}
The only problem is that I believe the curly brackets in the first line should not be there. The line should be:
#emit 'Source: "file1.ext"; DestDir: ' + MyDestDir
I have submitted a fix for this. It's basically another copy of the typo from your previous question: Why is there an additional pair of curly braces on the Inno Setup Preprocessor:#emit page?
I want to pass a path (via command line arg /D to the script compiler) to my executable to let my script determine the application version number using GetFileVersion, but my syntax isn't correct. How do I pass an argument to GetFileVersion?
The error is: Illegal character in input file: '#' (0x23)
#define srcpath SOURCEPATH
#define ApplicationVersion GetFileVersion(#srcpath)//error here!!!!!!
[Setup]
AppVersion={#ApplicationVersion}
[Files]
Source: "MyDllTesting.dll"; Flags: dontcopy
Source: "{srcpath}MyApplication1.exe"; DestDir: "{app}\MyApplication1"
First, SOURCEPATH is a Inno Setup preprocessor predefined variable, so you need to use another name for your command-line "variable". I'll be using SOURCE_PATH.
Second, the correct syntax is:
#define ApplicationVersion GetFileVersion(SOURCE_PATH)
(i.e. no hash)
Why no hash, is covered in my answer to
Why preprocessor behaves differently in #include directive then in [Files] section Inno Setup script
Though the reason is basically the same, why you use no hash before SOURCEPATH here:
#define srcpath SOURCEPATH
On the contrary you are missing the hash in the [Files] section entry. The correct syntax is:
[Files]
Source: "{#srcpath}MyApplication1.exe"; DestDir: "{app}\MyApplication1"
And there's no need to define srcpath variable. SOURCE_PATH is variable too. So you can use it directly in any expression:
#define ApplicationVersion GetFileVersion(SOURCE_PATH)
[Files]
Source: "{#SOURCE_PATH}MyApplication1.exe"; DestDir: "{app}\MyApplication1"
From the docs on "Inno Setup Preprocessor: Command Line Compiler Execution" I could define a command line parameter called "MyCustomParam" by using /D option like this:
.\ISCC.exe /DMyCustomParam=MyParamValue "MySetupScript.iss"
and then I wrote my setup script like the following, which gets the value which was defined for the parameter on the command line:
[Setup]
AppName={#MyCustomParam}
How can I set relative path to ini file in ReadIni?
This works:
#define MyAppVersion ReadIni("C:\Users\Popov\Documents\Release\Install.ini", "Release", "VersionNumber")
But I want this:
#define MyAppVersion ReadIni("Install.ini", "Release", "VersionNumber")
Where Install.ini is in the inno script folder.
Use the SourcePath predefined variable, like this:
SourcePath str. Points to the directory where the current script is located, or the My Documents directory if the script has not yet been saved.
#define MyAppVersion ReadIni(SourcePath + "\Install.ini", "Release", "VersionNumber")
[Setup]
AppName=My Program
AppVersion={#MyAppVersion}