I am using PrivilegesRequired=lowest
in my Inno Setup script. If setup is running elevated, i.e. IsAdminLoggedOn or IsPowerUserLoggedOn
reports TRUE, how can I determine if the elevated user account is the same account from which setup was launched?
My script can do different things accordingly.
You can use
WTSQuerySessionInformation
to retrieve an account username for the current Windows logon session.(The code is for Unicode version of Inno Setup).
You can then compare the result against
GetUserNameString
.You may need to add a domain name into the comparison.