Privileges/owner issue when writing in C:\ProgramData\
I'd like to add onto this as I was having issues writing to C:\ProgramData
as well. My issue ended up being that my directory/files within C:\ProgramData
were written by an administrator. When my app ran under a normal user it was unable to write there so Windows automatically used C:\Users\fooface\AppData\Local\VirtualStore\ProgramData
instead. I found the path it was writing to by using process monitor on my application. After seeing this I deleted the files out of C:\ProgramData
and ran my app again and it wrote there as expected.
Hope this helps someone.
No, C:\ProgramData
, aka FOLDERID_ProgramData
, has restricted security settings. Standard users can create files there. But these files are, by default, secured so that only the user that created the file can subsequently modify the file.
The recommended solution is for your installer to create a sub directory of C:\ProgramData
for your shared storage. And that sub directory must be given a permissive ACL by the installation program. That is what grants the desired access to all standard users.
I do wonder whether you really need shared writeable data. Normally I'd expect to see shared configuration be something that is specified at install time and modified infrequently by administrators. Most configuration data tends to be per user.