views:

645

answers:

4

My app is installed via NSIS.

I want the installer to install the program for all users.

I can do this, by installing to the 'program files' directory.

There is a database file (firebird), that all user accounts on the system should share.

If I store this database file in the 'program files' directory it will be read only.

If I store it in the users APPDATA directory they will each have a different copy, when one user adds data the others wont see it.

Option 1 - In my app directory under 'program files' create a 'Data' directory, in my installer make this dir read-writeable by all, that way the user 'program files' virtualisation won't kick in and all users can update the file and see each others changes.

Any other options ?

+3  A: 

Somewhere under the All Users profile would be the obvious location. I think there are some rules about who gets read/write by default, but the MS documentation recommends if you need something different to create a subdirectory and set the ACLs right in the installer.

Damien_The_Unbeliever
+3  A: 

Data for all users should be stored in %ALLUSERSPROFILE%, or call SHGetFolderPath() with the parameter CSIDL_COMMON_APPDATA to get the all users storage area.

See http://www.deez.info/sengelha/2006/02/28/windows-vista-changes/ for more details.

David Arno
In fact the correct solution is to use $APPDATA in NSIS *after* you set `SetShellVarContext all`.
Sorin Sbarnea
In addition to this you have to modify the `ACL` when you create the directory because by default this will be only readable by the `Users` group.
Sorin Sbarnea
A: 

This is a security hole, see: http://blogs.msdn.com/oldnewthing/archive/2004/11/22/267890.aspx

Nir
A: 

Specifically I would use:

SetShellVarContext all
SetOutPath $APPDATA
File "MyInsecurelySharedFile.txt"

See the NSIS Scripting Reference for more info.

Kyle Gagnet