Question

I'm building a product that involves

  • a windows service caching data on the local machine,
  • user processes reading that data and writing their own data,
  • the service in turn writing back that data to a server.

Where should I put the data files for this, such that they'll be shared by all users and read/writable? The software will operate in a corporate environment where desktops are sometimes pretty locked-down, so for instance some users won't have write rights to C:\Program Files.

I don't think C:\Documents And Settings\All Users\Application Data\ is a good candidate - I think by default only Admins & Power Users have write access here.

I could use each user's Application Data folder, but this would be a bit of a pain as different people could use each machine ... so it'd be simpler if there was just one shared location.

I'm developing in C# .net 2005, but that's probably not too relevant.

Was it helpful?

Solution

Unfortunately you have no real choice. You must (you really must) call SHGetSpecialFolderLocation to get the path to c:\users\public\AppData (which is the name of the folder you linked above, but on Vista and possibly Windows 7) Then you MUST create your own app folder therein. And then, you MUST, use the security APIs to modify the ACL of the created folder.

There is NO folder on the system with a default ACL that allows multiple non administrator users to read AND write the same files.

c:\users\public\AppData is the closest. Modifying the ACL of a application folder here seems the best approach. Of course, once one has resorted to ACL modification, the folder really could be created anywhere at all. But that could surprise system administrators and result in weired security holes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top