cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
idblew
Level 4

Windows Registry (A&G)

Hi,

This one's "slightly" off-topic, but I'm hoping people will share their opinions/thoughts.

We have an application that stores user-specific settings under HKEY_CURRENT_USER but we also want to be able to store default settings for all users.

The developers of the application say we should use HKEY_USERS\.Default but I believe that we should use HKEY_LOCAL_MACHINE as HKEY_USERS\.Default is used only as a "template" when a new user logs into a PC.

Who's correct? Why? :confused:
Labels (1)
0 Kudos
(3) Replies
RobertDickau
Flexera Alumni

My recollection is the same as your description, that HKEY_USERS\.Default is used as a template for future new accounts (back in the Windows 9x days, I think it was used for the current user settings).

I imagine a simple test (try adding the data and seeing if the settings propagate to an existing account) would settle the bet...

P.S. Oops, maybe neither is correct: http://blogs.msdn.com/oldnewthing/archive/2007/03/02/1786493.aspx.
0 Kudos
Colbey
Level 4

I think Roberts blog link explains why HKEY_USERS\.Default should not be used.

I tend to use HKCU for data specific to a user and HKLM for data that is the default for the application and applies to all users. Sometimes its useful to allow keys created under HKCU at run time, for example, to override the HKLM default settings.

If you use advertised shortcuts HKCU keys within your msi will get created when your applications is launched. I try to minimise what the install puts under HKCU (and other current user areas), but there is a mechanism in msi to propagate stuff to other users HKCU hives automatically. Unfortunately unless you write your own cleanup routine (not advisable) when the user uninstalls these keys will get left behind for all users except the one running the uninstall.

I’ve briefly goggled it and found this article which does suggest doing something similar.
0 Kudos
idblew
Level 4

Thanks for your replies (and links to articles)!

Robert, as predicted HKEY_USERS\.Default is NOT used as a template for future new accounts, the simple test did absolutely nothing. Apparently the default template is stored in a file rather then the registry (typical Microsoft!). Thanks for the pointers though.

Colbey, your link rocks and total backs up what I've been telling our developers all along - I've passed it on for them to digest and discuss 😄
0 Kudos