InnoSetup and Windows shortcuts

127 views
Skip to first unread message

Alx

unread,
Jun 24, 2024, 12:29:02 AM (12 days ago) Jun 24
to innosetup
I am trying to create installer with shortcut, which require elevation on start. Innosetup does not provide this option. I use piece of code from StackOverflow. It change one bit in shortcut file after shortcut creation. Here is minimal example https://github.com/KrazyKator/InstallerTest.  This example works without any problems if it is built with Innosetup 6.2.2 and earlier. But if it is built with Innosetup 6.3.1 (I think 6.3.0 too) it has problems. SetElevationBit function can not open shortcut file even for reading because innosetup does not close  shortcut file after creation.
I think this is bug of Innosetup.

Martijn Laan

unread,
Jun 24, 2024, 12:52:36 AM (12 days ago) Jun 24
to innosetup
Your Buffer variable is of the wrong type. Should be (and always should have been) AnsiString.

Greetings,
Martijn Laan

Op maandag 24 juni 2024 om 06:29:02 UTC+2 schreef Alx:

Alx

unread,
Jun 24, 2024, 10:16:37 AM (11 days ago) Jun 24
to innosetup
I changed variable type, but nothing changed.  

Martijn Laan

unread,
Jun 28, 2024, 5:38:23 AM (8 days ago) Jun 28
to innosetup

You should also still change your Buffer variable to type AnsiString.

Greetings,
Martijn Laan

Op maandag 24 juni 2024 om 16:16:37 UTC+2 schreef Alx:

Bill Stewart

unread,
Jun 28, 2024, 4:29:49 PM (7 days ago) Jun 28
to innosetup
On Sunday, June 23, 2024 at 10:29:02 PM UTC-6 Alx wrote:

I am trying to create installer with shortcut, which require elevation on start.

Why? If the executable requires elevation, the best way to do this is to add a manifest.

Bill

Alx

unread,
Jun 29, 2024, 12:40:48 AM (7 days ago) Jun 29
to innosetup
This is not executable, this is windows script.  There are no ways to require elevation for windows script. Only restart with powershell, jscript/vbscript or additional executable.

Martijn Laan, thank you. It is working now.

Bill Stewart

unread,
Jun 29, 2024, 8:33:30 AM (7 days ago) Jun 29
to innosetup
On Friday, June 28, 2024 at 10:40:48 PM UTC-6 Alx wrote:

This is not executable, this is windows script. 

Windows scripts run using executables.
 
Why does your Windows script require elevation?

Bill
Reply all
Reply to author
Forward
0 new messages