Archive: SetRegistryVarContext ???


SetRegistryVarContext ???
I know that such function doesn't exist (yet) in NSIS.

But I am looking for this kind of functionality, similar to SetShellVarContext.

That is, be able to modify (with admin privileges of course) either admin's current HKCU, or all existing users' HKCUs.

I know that HKLM should fit most of such needs.

However, I have a special need for being able to modify all users HKCUs (in addition to HKLM).

Is there an existing plugin that does that? or must I enumerate all users' HKCUs in order to accomplish this goal?

BTW, in my search prior to this posting, I found the following thread, which describes exactly what I was looking for:

http://forums.winamp.com/showthread.php?postid=2360266

But while the OP seemed to be satisfied with the HKLM solution, I would still like to pursue this SetRegistryVarContext idea.

Any tips or thoughts you can share?

Thanks!

Edit: I just discovered the following thread - it seems to provide an idea as to how to go about this:

http://forums.winamp.com/showthread.php?threadid=72024


First off, with domains, this will not work, so it's not a good idea to go down this path. You really should rewrite your app to just check HKLM first. If you still want to to id, try http://nsis.sourceforge.net/EnumUsersReg


You can use the UserMgr Plugin for this as well
http://nsis.sourceforge.net/UserMgr_plug-in

UserMgr::RegLoadUserHive will load the HKCU registry hive in HKEY_USERS/{username}.


Thank you, Anders and jpderuiter.

Originally posted by Anders
First off, with domains, this will not work
Can you explain why it will not work with domains?

Originally posted by Anders
You really should rewrite your app to just check HKLM first.
I agree. However, I have one special case in which I have no control over the application (already installed, not by my installer) which requires writing to both HKLM and HKCU to activate a certain feature. That feature needs to be activated for all existing user accounts. :eek:

Originally posted by Anders
If you still want to to id, try http://nsis.sourceforge.net/EnumUsersReg
Thank you!

It will not work with a machine on a domain (probably could happen on a normal workgroup machine also) because you need to load the profile to get access to their HKCU, and the list of users/profiles used by EnumUsersReg is not complete


Can you explain why it will not work with domains?
The solutions mentioned so far read the registry to determine a list of users.

On a stand-alone computer that's fine because the local machine is where the user accounts are defined.

But, in a domain environment, user accounts are setup on a server and don't have to exist on the local computer.

Its not even complete on a local machine, my registry is missing ASPNET,HelpAssistant,SUPPORT_xxxxx etc

The ProfileList key is also undocumented AFAIK

There are proper API's one could use, but they are a big pain