I have some program settings that are currently stored in HKEY_LOCAL_MACHINE. Due to Vista and locked down users, some users don't have permission to HKEY_LOCAL_MACHINE, and those values don't really belong to HKEY_LOCAL_USER either (it has to be the same for all users), what's the best alternative location for storing these?
Majority of settings are stored in the DB already, but there are some that the program needs to know about before connecting to the DB. Ideally I'll like a way to implement this without needing to check what operating system is running.
This is for a desktop app written in Delphi.
Best Answer
You should put:
HKEY_CURRENT_USER
in the registry or in theCSIDL_APPDATA
orCSIDL_LOCAL_APPDATA
folder;HKEY_LOCAL_MACHINE
in the registry or in the application's folder. Set them at install time, when administrator privileges are available;CSIDL_COMMON_APPDATA
folder.Use SHGetFolderPath to find the location of the
CSIDL_*
folders.Depending on your needs you might like to implement all three options given at once. There would be nothing wrong with it.