Search code examples
installationelevated-privileges

Launching a program in different creds or HKCU and installers


I have an installer that needs to a person to be an admin ( well at least drop stuff in the c:\program files\app dir ) I also need to create a bunch of entries in HKCU the thing is if if the installer is running as admin where will the HKCU go , presumably the admin.
But I want the HKCU of the logged in user, so I would like to launch an application which will do a bunch of stuff including the registry entries.
If I launch this application from the installer then will it run as admin or logged in user. How can I launch the application as the logged in user from a process that is running as admin

Am I looking at this all wrong. My real requirement is
I want to deploy an application that makes entries to HKCU
my installer will typically need admin creds ( vista UAC scenarios included )
once elevated which HKCU will be targeted?
the admin or the user who elevated
how can i make sure it is the user's HKCU hive that the entries end up in and not the admin.
Thanks


Solution

  • Easy. Just redesign your application ever-so-slightly...

    • Write entries to HKLM during installation
    • At first run of the app check for HKCU entries, if they don't exist then copy from HKLM to HKCU

    If per-user configuration needs to be in place before your app will even launch and updating the app as suggested above isn't suitable then look into using ActiveSetup and schedule a reboot post-install.