views:

67

answers:

2

I am trying to fix an existing application that uses a Visual Studio 2005 setup project.

We are requiring it to work on limited user accounts for XP, our app is written in C# for .Net 2.0.

It writes keys into HKCU during the setup, but skips the UI step for choosing 'Install for Everyone' versus 'Just me'. So it defaults to installing for Everyone.

The problem is, you install on an admin account, and then switch to a limited account. This makes it do a repair install that fails. If I go to any other admin account, it works just fine.

My question is, where is it putting these keys for HKCU that the limited account is trying read/write to?

Is there a magical place in HKEY_USERS that applies to "Everyone"? I do not understand how it work going from admin user to another admin user. To test this theory, I manually entered the keys in HKCU on the limited user, and it still tried to repair.

If I knew where this "Everyone" key is, I could merely grant full access to all users with a custom action so the limited account would not force a repair install.

+1  A: 

Is

HKEY_USERS\.DEFAULT\

the branch you're looking for?

Steve
This is the system account, and I don't think my setup is running under system. Here is a link: http://blogs.msdn.com/oldnewthing/archive/2007/03/02/1786493.aspx
Jonathan.Peppers
+1  A: 

There's no such thing as an "Everyone" HKCU key. HKCU is per user. Windows Installer will always try to repair, and unless everyone has access to the original MSI file then it will probably fail.

Basically the rule of thumb I always follow is to never write to HKCU during install, instead I write to HKLM during installation, and the first time the application runs then I create the relevant HKCU keys.

See my answer on the SO question Launching a program in different creds or HKCU and installers and check out ActiveSetup as a viable alternative for writing the relevant HKCU configuration.

sascha
We came upon this solution ourselves. We are going to pull the settings from a file on first-run for each user and put them into HKCU. If it was a new application, we would avoid using the registry entirely and only use files in the vista-uac-safe application data folder.
Jonathan.Peppers