PDA

View Full Version : HKEY_CURRENT_USER and System Context



johnv1
11-29-2006, 01:32 PM
Hello all, I have a MSI. It currently works when I run it directly when logged in as a user with admin rights. The problem is; it will be sent out via SMS which will run it under system context. Running directly, it writes a couple of keys to the HKEY_CURRENT_USER, however, when run under system context it writes these keys to HKEY_USER\.DEFAULT rather than HKEY_CURRENT_USER. Is there any way around this? I want to force that into the HKEY_CURRENT_USER of the currently logged in user which I believe is actually HKEY_USERS\<SID>. Would I somehow get the currently logged in user and somehow write to the HKEY_USERS\<SID>? Any help would be appreciated.

HennoKeers
11-30-2006, 02:16 AM
Hello all, I have a MSI. It currently works when I run it directly when logged in as a user with admin rights. The problem is; it will be sent out via SMS which will run it under system context. Running directly, it writes a couple of keys to the HKEY_CURRENT_USER, however, when run under system context it writes these keys to HKEY_USER\.DEFAULT rather than HKEY_CURRENT_USER. Is there any way around this? I want to force that into the HKEY_CURRENT_USER of the currently logged in user which I believe is actually HKEY_USERS\<SID>. Would I somehow get the currently logged in user and somehow write to the HKEY_USERS\<SID>? Any help would be appreciated.

When your users start the app then the settings will be repaired into their profile.

Reg, Henno

adrian500
11-30-2006, 09:14 AM
John,
I had a similar situation with an application I was packaging up. I added a couple of reg keys in the HKCU to fill in a config wizard for that app. It was putting in paths to file locations on a server. Everything seemed to work when I installed the MSI but when it was deployed, the users weren't getting these settings. What you need to do is set one of the reg keys as a key path, I set it on the reg folder containing these settings. What happens is when windows installer looks at the msi it checks for the existance of the key paths and if they aren't there then it repairs them, as Henno suggests. So when your users fire up the app, windows installer installs the reg keys into the HKCU bit.
It worked ok for me and you can set it in the InstallSheild editor.

Hope this of some use?

Adrian