Hello,
I'm fighting with a strange issue related to the RunAsOriginalUser flag.
This is my situation: I need to run the Installer with Admin privileges ([Setup]: PrivilegesRequired=admin) as I need to add exclusions to Windows Firewall and things like that. At the same time I need to interact with the "OriginalUser", the user before elevation, as I need to write into proper HKCU registry section...this is the relevant line:
Filename: "{sys}\reg.exe"; Parameters: "ADD ""HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon"" /v Shell /d ""{app}\MyShell.EXE"" /f"; StatusMsg:"Setting
MyShell as shell for current user"; Flags:runhidden runasoriginaluser; Tasks: AutoStartUp\CURRENTUSER
I'm having this strange issue: the first time I run the setup package the above registry modification is applied to the "Elevated (administrator) User" instead of the "OriginalUser". If I run the setup package a second time then the execution is correct, and reg.exe write correctly to the OriginalUser HKCU registry section.
I tested this issue on multiple PCs, it seems to be repeatable.
Also taking a look at the SetupLog file I see that there is a note before execution of reg.exe that states that it is run as OriginalUser, for first and second install.
I use latest version of InnoSetup, v6.2.1, operating system where setup package is executed is Windows10 LTSB 2016.
I have no more ideas, anybody can help me?