Registry Access

T

Tim Gee

Hi,

I have a application which writes data to the HKLM key. This is system wide
app data, used by all users of the program (regardless of login name etc) in
fact some of it is shared between programs. What am I supposed to do under
Vista - where should I write this data to?, does it stay in the registry or
become a txt file? I've had a look around MSDN and can't find any guidelines
apart from "store it in %ALLUSERSPROFILE%", however this is a directory. Can
someone point me in the right direction.

Thanks

Tim
 
C

Chris

Based on some research I did to try and answer this question (probably
through the same sites you have already been to) I would say the answer is
to write your settings out to a file.

Assuming that you have source access to all of the applications that share
these settings. I would be tempted to write a single assembly to provide
access to your settings that your applications would then reference - then
put the settings into IsolatedStorage. I'm not sure if that is a reasonable
solution for your situation or not.

Hope that helps.
 
G

Gerry Hickman

Chris said:
Based on some research I did to try and answer this question (probably
through the same sites you have already been to) I would say the answer
is to write your settings out to a file.

Back to the Windows 3.1 era with INI files!
 
J

Jimmy Brush

Hello,

System-wide configuration data is stored in HKLM. However, the user has to
be an administrator in order to save system-wide state data, because user
accounts are limited to only affecting their own user account, and not other
user accounts.

If you need access to HKLM, you should seperate out the chunks of your
program that need to modify HKLM into a secondary program or COM component,
set this program to require admin permission, and then run this secondary
program from your main program when needing to modify HKLM. This secondary
program will then prompt the user for admin permission (or allow an admin to
log in to approve the action) and then save the settings.

The best solution is to not save system-wide state.
 
G

Gerry Hickman

Hi Jimmy,

I think that's a bit of an over complicated view of how it's supposed to
work. It's very simple; you have machine settings in HKLM and user
settings in HKCU. The machine settings are set at install time BUT the
user can read machine settings, they just can't write to them.

It has worked perfectly since Win NT 3.51
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top