Inno Update script, access is denied... code 5 - inno-setup

This isn't the same question I asked before... I'm asking why I am getting code 5 error when building to a {commonappdata} folder.
I have two inno scripts, the setup one installs an application for ALL users, and installs it as a startup application, so we require admin privileges. I set it to install to {commonappdata} (ProgramData) so that it will be the program for all users. This works fine.
Here is the INSTALL script: (Seemingly no issues)
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "xxxx"
#define MyAppVersion "xxxx"
#define MyAppPublisher "xxxxxxx"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "xxxxxx.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={{xxxxxxxxxxxxxxxxxx}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonappdata}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; The [Icons] "quicklaunchicon" entry uses {userappdata} but its [Tasks] entry has a proper IsAdminInstallMode Check.
UsedUserAreasWarning=no
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=admin
OutputBaseFilename=xxxxxx
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[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: 6.1; Check: not IsAdminInstallMode
[Files]
Source: "C:\xxx\xxxx\Desktop\xxxxxx\xxxxx.exe"; DestDir: "{app}";
Source: "C:\xxx\xxxx\Desktop\xxxxx\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppName}"; ValueData: """{app}\{#MyAppExeName}"""; Flags: uninsdeletevalue
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Then the Update script gets downloaded by C# later (if there is a newer version) and the whole idea of it, is that it updates the {commonappdata} (programdata) path, so it updates for every user on the machine, and it does NOT need admin privileges to do so. While still maintaining it as a startup application.
UPDATE SCRIPT:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "xxxx"
#define MyAppVersion "xxxx"
#define MyAppPublisher "xxxxxxxxxx"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "xxxxxxx.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={{xxxxxxxxxx}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonappdata}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; The [Icons] "quicklaunchicon" entry uses {userappdata} but its [Tasks] entry has a proper IsAdminInstallMode Check.
UsedUserAreasWarning=no
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
OutputBaseFilename=xxxxxx
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[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: 6.1; Check: not IsAdminInstallMode
[Files]
Source: "C:\xxxx\xxxxx\Desktop\xxxxxxx\xxxxxxxx.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\xxxxx\xxxx\Desktop\xxxxxxxx\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
My issue, is that when the update script runs, it gives me the error code: "An error occurred while tryin to replace the existing file: C:\ProgramData\APP NAME\FILE.EXE: DeleteFile failed; code 5. ACCESS IS DENIED.
Please help. I mean I know the problem is, is that I guess I cannot even access or change the ProgramData folder (when not installing) you need admin rights in that folder. But I dont know WHERE else to put it where I can accomplish an update (for every user) without needing admin privileges.

You need admin rights to write to the commonappdata folder. See here where it mentions:
You are making it hard for yourself. By design your installer is either elevated or not.
If you must use any common constant you need admin rights.
If you use any auto constant with elevation it is only installed for the user.

Related

Why is there a shortcut error on my Inno Setup Compiler installer?

I seem to have a problem with compiling my games.
I usually compile my games and put it in a backup drive but there seems to be a problem. When I install the game, it seems like it won't work:
Is there anything wrong with the code?
#define MyAppName "The Binding of Isaac: Rebirth -ZteamDL-"
#define MyAppVersion "2.0"
#define MyAppPublisher "ZteamDL"
#define MyAppURL "google.com"
#define MyAppExeName "isaac.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={{75BE97EF-4424-46EC-B0C5-6E2F696A6AF3}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=C:\Program Files (x86)\ZteamDL\The Binding of Isaac Rebirth -ZteamDL-
DisableProgramGroupPage=yes
LicenseFile=C:\Users\alero\Desktop\Randoms\zteam.txt
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir=C:\Users\alero\Desktop\bi
OutputBaseFilename=The Binding of Isaac Rebirth -ZteamDL-
SetupIconFile=C:\Program Files (x86)\ZteamDL\The Binding of Isaac Rebirth\issacicon.ico
Password=ZteamDL
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Program Files (x86)\ZteamDL\The Binding of Isaac Rebirth\isaac.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Program Files (x86)\ZteamDL\The Binding of Isaac Rebirth\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
The script is not correct:
Symbol {#MyAppName} is not defined.
When I define this symbol the script is working fine (ALL users mode, Create desktop shortcut is checked).

Can I create a Inno Updater that wont require admin privileges?

First inno installer, installs the app as a startup application, which obviously requires admin privileges. But when we update our already existing program, I don't want to have to require admin rights (this allows us to auto update)
Here is the first installer script that requires admin privileges.
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "xxxx"
#define MyAppVersion "xxxx"
#define MyAppPublisher "xxxxxxx"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "xxxxxx.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={{xxxxxxxxxxxxxxxxxx}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonappdata}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; The [Icons] "quicklaunchicon" entry uses {userappdata} but its [Tasks] entry has a proper IsAdminInstallMode Check.
UsedUserAreasWarning=no
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=admin
OutputBaseFilename=xxxxxx
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[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: 6.1; Check: not IsAdminInstallMode
[Files]
Source: "C:\xxx\xxxx\Desktop\xxxxxx\xxxxx.exe"; DestDir: "{app}";
Source: "C:\xxx\xxxx\Desktop\xxxxx\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppName}"; ValueData: """{app}\{#MyAppExeName}"""; Flags: uninsdeletevalue
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
UPDATE SCRIPT:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "xxxx"
#define MyAppVersion "xxxx"
#define MyAppPublisher "xxxxxxxxxx"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "xxxxxxx.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={{xxxxxxxxxx}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonappdata}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; The [Icons] "quicklaunchicon" entry uses {userappdata} but its [Tasks] entry has a proper IsAdminInstallMode Check.
UsedUserAreasWarning=no
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=none
OutputBaseFilename=xxxxxx
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[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: 6.1; Check: not IsAdminInstallMode
[Files]
Source: "C:\xxxx\xxxxx\Desktop\xxxxxxx\xxxxxxxx.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\xxxxx\xxxx\Desktop\xxxxxxxx\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Now I want to write a update installer that wont require admin rights and just update the files.. This is a startup application, that is the only reason it requires admin rights. And it has to be a startup application.
You install the software for one user only (C:\Users\...):
[Files]
Source: "C:\Users\*****\Desktop\****\******.exe"; DestDir: "{app}"; Flags: ignoreversion
Yet you set it up to be started for all users (HKLM):
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppName}"; ValueData: """{app}\{#MyAppExeName}"""; Flags: uninsdeletevalue
That's wrong. Windows will try to run the software for each user that logs in to the machine. Yet only that one user, will have access to the software. So the startup will fail for the others.
If you want to install the software for one users only, add the startup entry to the Run key to HKCU (current user) hive only, not HKLM (local machine).
Btw, for an answer to your literal question, see
Choose right Windows directory to install software and allow auto-updates
But your question is XY problem, so I believe that you actually do not want, what you ask for.
If you actually do not mind that any user can modify/hack/infect the application, you can create two installers.
One, that will do the initial installation:
Writes the files to a folder, where all users have a write access, like {commonappdata}.
Creates the [Run] entry in the HKLM – For what it needs PrivilegesRequired=admin.
Other, that will update the program only:
Updates the files in {commonappdata}
Does not modify the registry – So it can do with PrivilegesRequired=lowest.
Both installers should have the same AppId, so that they can share installation data. Though, I'm not sure, if it that will work nicely in Inno Setup 6, with its Side-by-side installation feature.
Well, in general you doing something that's not really correct.

Append my "AppName" with "DefaultDirName" in Inno Setup

I'm trying to append my AppName with DefaultDirName.
like
AppName=MyInstaller
DefaultDirName={localappdata}\{#AppName}
path look like : C:\Users\admin\AppData\Local\MyInstaller
code:
[Setup]
UsePreviousAppDir=no
AppName=MyInstaller
AppVersion=1.5
DefaultDirName={localappdata}\{#AppName}
DefaultGroupName=MyInstaller
UninstallDisplayIcon={app}\MyInstaller.exe
I'm unable to append app name with DefaultDirName.
Please someone help me, how to append it?
Here's the base installer file as created by the InnoSetup Wizard. It uses a constant for AppName and appends it to DefaultDirName. This was built using InnoSetup 5.5.9(u)
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.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={{FCC9E92F-AE28-4067-8E23-596A4AB90705}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=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
[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[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
I used SetupSetting preprocessor function for expanding [Setup] section directive values.
AppName=MyInstaller
DefaultDirName={localappdata}\{#SetupSetting("AppName")}

Inno setup - allowing database modification

my application includes a db and users will be able to add data to the db via a GUI. So I need to give authorization to the user to modify the db. I tried all options from this post but authorization is still not allowed.
Here, this is an illustration of what I try to achieve (get Permissions for Modify checked in the "Allow" column):
Here my current code:
#define MyAppName "aaa"
#define MyAppVersion "1.0"
#define MyAppExeName "aaa.exe"
[Setup]
AppId={{...-...-...-...-...}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputDir=C:\...\output
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Dirs]
Name: "{app}\Logs"; Permissions: everyone-modify
[Files]
Source: "C:\...\aaa.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\...\list_files\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-modify
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[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
How can I give database access to the user through the creation process of the setup? Thank you
[Files]
Source: "C:\...\aaa.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\...\folder_files\*"; DestDir: "{localappdata}\name_application\folder_files\"; Flags: ignoreversion recursesubdirs createallsubdirs

How to change executable file rights using Inno Setup?

I have created a very simple inno script through a wizard in InnoIDE. However the deployed executable file can be run by normal user. How can I enforce that the user has to run it as administrator through the script ?
[Setup]
AppId={{03E6645E-2C53-4E90-967B-D0833A8EBDAF}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: " {cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Program Files\Inno Setup 5\Examples\MyProg.exe"; DestDir: {app}; Flags: ignoreversion; Permissions: admins-readexec;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#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;
You can't use Inno to change the permissions or manifest of your application.
To make your application ask for admin permissions, you will need to add the appropriate manifest to it. This is different for each different programming language but many related questions have already been asked and answered.
easier way To make your application ask for admin permissions:
add this value in registry key for your executable file:
[Registry]
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\{#MyAppExeName}"; ValueData: "RUNASADMIN"; Flags: uninsdeletevalue
i prefer usually using above code.

Resources