gvasko
Posts: 33
Joined: Mon Jun 07, 2010 7:11 pm

LocalSystem account and HKCU in custom actions

Hi,

During installation and uninstallation we modify the registry via a .NET installer custom action for the current user, who launched the installer. It's a kind of registration that needs some logic to define the necessary registry keys.

Since the security fix in KB 3072630 the HKEY_CURRENT_USER is not the user who launched the installer, but the local admin whose registry hive is HKEY_USERS\.DEFAULT
https://support.microsoft.com/en-us/kb/3072630

Do you have any idea what to change to get access to the user's hive who launched the installer?
Or is that impossible since the security update?

Thank you,
Gabor Vasko
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: LocalSystem account and HKCU in custom actions

Hello Gabor,

Make sure you schedule your custom action to run as immediate and that you don't check the "Run under the LocalSystem account with full privileges (no impersonation)" execution option enabled for your custom action.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gvasko
Posts: 33
Joined: Mon Jun 07, 2010 7:11 pm

Re: LocalSystem account and HKCU in custom actions

Hi Daniel,

If I choose Immediate, I cannot change "Run under the LocalSystem account with full privileges (no impersonation)", it is grey and unchecked.

In this case the dll that contains the Installer class has not been copied to the Program Files when the custom action runs.
It says: Error 1001. ... Could not load file or assembly ....<my dll>

I also don't understand what the Immediate means, while the custom action is under the Add Resources stage in the Install Execution Stage.
Is that sequential? In that case it should have copied the files before the custom action. No?

Thank you,
Gabor
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: LocalSystem account and HKCU in custom actions

Hello Gabor,

Please move your custom action to be executed after "Install Execution Stage -> Finish Execution action group" as immediate and see if this helps.

Please take a look on our "Custom Actions" article for more references about the custom action options.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gvasko
Posts: 33
Joined: Mon Jun 07, 2010 7:11 pm

Re: LocalSystem account and HKCU in custom actions

Hi Daniel,

That worked for an admin user, but when I installed with standard user entering the password for the admin user for elevation, it modified the admin's registry.

So, I decided to try to switch to an exe that is launched at the end of the installation.

Thank you,
Gabor
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: LocalSystem account and HKCU in custom actions

Hello Gabor,

If there is anything else we can assist you with just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”