Windows “known folders”: is there any one of them which is reliably read/write for all users on all versions?

StackOverflow https://stackoverflow.com/questions/2695414

문제

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?

도움이 되었습니까?

해결책

You are correct; there is no such folder.

You will need to create one yourself.

다른 팁

%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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top