1


I am making an applications that works for multiple users and use data from registry that is written by another user.
currently I am writing to HKCU. and it is not working because HKCU is local. and after it failed i tried to write on Local Machine but it has some permision issues.

So what is the suitable location to write the registry in this scenario.
I am using following code to create to key.
RegistryKey regKey = Registry.CurrentUser;
RegistryKey subKey = regKey.CreateSubKey(subKeyName);

USER_NAME
  • 1,029
  • 1
  • 14
  • 33
  • Can you tell us more about which users need to access which other users' data? Your application's installer could give non-admin users access to the appropriate registry key, but it seems likelier that the registry isn't the best place to store this kind of shared, writeable information. – anton.burger May 23 '12 at 11:28

1 Answers1

1

I read a lot about window registry and came to know that HKEY_CURRENT_CONFIG will be
suitable in my case because It is common location to all user.

Only problem with this Registry location is that u need Administrator rights to modify the key.

RegistryKey regKey = Registry.CurrentConfig;
RegistryKey subKey = regKey.CreateSubKey(subKeyName);

USER_NAME
  • 1,029
  • 1
  • 14
  • 33
  • 1
    `HKEY_CURRENT_CONFIG` is just a pointer to `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\CurrentControlSet\Hardware Profile` so you have the same problem - http://technet.microsoft.com/en-us/library/cc776168%28v=ws.10%29.aspx – shf301 Jun 07 '12 at 05:55