My setup is set to run with lowest privileges
PrivilegesRequired=lowest
But I'm executing setup as Admin (right click-> run as admin, enter Admin credential in UAC), and want to check Logged In User's registry in InitializeSetup()
function InitializeSetup(): boolean;
begin
if RegQueryStringValue(HKCU,'SOFTWARE\{some path}','Version', {some value}) then
begin
{ do something here }
end
end
But this checks the registry value for the Admin Account, not for Logged In User Account
Is there a way to check the logged in users registry at this point?
First, you should not try to access a user environment from an installer running with Administrator privileges. That's just wrong.
For a general discussion on this topic, see:
Installing application for currently logged in user from Inno Setup installer running as Administrator.
Anyway, you can use a function below.
The code combines these solutions: