Windows “known folders”: is there any one of them which is reliably read/write for all users on all versions?
-
01-10-2019 - |
Question
SHGetKnownFolderPath() and its cohorts accept one of the constants defined here, returning the path to a directory.
I'm looking for one of these folders which is reliably writable by all users (including LocalSystem) on XP, Vista, and Windows 7... but I think I'm striking out. It appears that, in fact, there is no single location on the hard drive anymore where you can put a file and be assured that all users can write to it on all these OS versions, without fiddling the permissions first.
Is this true?
Solution
You are correct; there is no such folder.
You will need to create one yourself.
OTHER TIPS
%ALLUSERSPROFILE%
This will not be writable by low-integrity processes or limited users, however.
One option seems to be FOLDERID_PublicDocuments
, another could be FOLDERID_ProgramData
. If there's a similar function you can use though to get a Documents type folder (for the user) that could work as well.
Edit: this blog post may help you.