views:

265

answers:

2

My program requires some configuration details to be kept in a .ini file. This program also installs extensions to IE and firefox and i want to read these .ini file from these extensions also. If I kept .ini in "...AppData/Roaming..." the IE extension in protected mode won't be able to read/write. As far as I know only AppData/LocalLow can only be able to read in protected mode. If I am moving all my configuration details to this "...AppData/LocalLoe..." will it work all times? Is this the std way? everything i written is in Vista context, will it work with XP? Win7?

A: 
Kirill V. Lyadvinsky
A: 

See my answer to this question: http://stackoverflow.com/questions/882490/how-to-decide-where-to-store-per-user-state-registry-appdata-isolated-storage

to quote from there:

Files in the User's "Roaming" folder in Vista or "Application Data" in XP move around with the user - so any settings and data should be stored there.

Files under "Local" and "LocalLow" in vista and "Local Settings" in XP do not, so it's a good place for temp files, things that are tied to the specific computer or data that can be recalculated.

In Vista, as part of the new security features we all know and love, you can have programs running in "low integrity mode" (for example IE in protected mode), those programs are running with reduced privileges and can't access files in the user's profile - except for files under the "LocalLow" folder.

So, in conclusion, files stored in "LocalLow" are inherently insecure and files in "Local"/"Local Settings" are likely to be unavailable in some large companies - so unless you have good reason and know exactly what you are doing go with "Roaming"/"Application Data".

UPDATE:

  1. When profile roaming is used (big cooperate environments) the content of Local and LocalLow can (and will) disappear without notice.
  2. Those are all per-user settings, if your server runs under a diffrent account than the user (for example, system or network) they will get diffrent copies of those folders.
Nir
Thanks for your reply. My main application is a tiny web server and we have extension to IE as well as Firefox. So we need to keep the port on which the webserver is running in .ini and extension should be able to read it so that we can frame the correct URL. If I kept in Roaming IE protected mode won't be able to read it, and if I am keeping this in LocalLow I am not able find an XPCom interface(scriptable) to find LocalLow folder path.
Manoj
I don't know anything about XPCom so I can't help you with that, as jia3ep said, the Win32 API to get the path is is SHGetKnownFoldedPath.
Nir
See my update for some things to consider
Nir