Standard location of system-wide configuration files of an app?

495 Views Asked by At

Since Windows Vista, our friends from Redmond are putting an end to the habit of storing configuration files in C:\Program Files\<AppName>\config.ini. Ok, they introduced Registry Virtualisation, but it's always better to fix your stuff, right?

I'm planning to fix a pre-Vista app which runs as a service, and which needs to maintain a machine-wide configuration file.

Where do I store the config file? And what would be the most portable/future-proof way of obtaining the path to that location?

2

There are 2 best solutions below

0
doppelfish On BEST ANSWER

After improving my Google-fu starting from a related question, I think I've found the definitive answer in this microsoft blog post which actually describes much more than what I originally wanted to know.

0
Dragonthoughts On

You could store the values in the registry in something inheriting from \HKLM\ directly, which would give portability.

If there are a large number of values, or a complex structure to them, then you could store a file location in the registry, and store your configuration at that destination.