ajcaruana
ajcaruana

Reputation: 505

How to modify the embedded manifest of an Inno Setup Installer?

I have an Inno Setup installer that worked fine on my machine (Win 7 32-bit), but did not work at all on a test machine (also Win 7 32-bit). After some investigation, I found that the reason is that there is something going wrong when the UAC is set to anything which is not Never notify me. However, if I right click on the installer, and select Run as Administrator, the installer works fine.

I then tried to modify the embedded manifest of the installer (methods described below), so that it will always run as admin, but this is not working as I wished. I have obtained the original manifest using the command

mt.exe -inputresource:installer.exe -out:installer.exe.manifest

I, then, opened the extracted manifest using a text editor and changed the line

<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>

to

<requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>

I then, tried to apply the resulting manifest, by running the command

mt.exe -manifest installer.exe.manifest -updateresource:installer.exe;#1

but the manifest tool gave me the error

mt.exe : manifest authoring error c1010001: Values of attribute "level" not equal in different manifest snippets.

I also tried changing the command to

mt.exe -manifest installer.exe.manifest -outputresource:installer.exe;#1

but this caused the entire installer to be overwritten by nothing more than the resources (i.e. the actual installer was lost).

I also tried opening the installer executable using Visual Studio (Resource Editor), modified the manifest and saved the file, but this gave the same result as the second mt.exe command I used.

Does anybody know what I am doing wrong, or if I am missing out on something ?

Upvotes: 4

Views: 5616

Answers (1)

Deanna
Deanna

Reputation: 24273

You shouldn't modify the manifest of the resulting Inno setup as Inno does any elevation it needs for the PrivilegesRequired directive.

If you do modify the manifest, or manually do "Run as Administrator" then it will break all the ...AsOriginalUser functionality, most importantly, the postinstall flag.

mt.exe and similar resource editors are also very likely to strip the setup data from the setup file as it's appended to the end of the binary.

Upvotes: 5

Related Questions