Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

appdata - Does Microsoft have a best practices document regarding the storage of App Data vs User Data on different Windows Platforms?

When creating an application that will be targeted to many versions of Windows what is the best practice to determine where application specific data should be stored. Specifically:

  • Application Specific Data (e.g. app config data)
  • User Specific Data/Settings

I know on Windows Vista for instance there are environment variables, like %APPDATA%, that could be used, but what about Windows 7, Windows XP, Windows 98.

My main question is, does Microsoft have a best practices doc for this, outlining the file system locations for the different types of data (app vs. user) and the security implications that need to be kept in mind when reading/writing to these locations?

I'm also interested in how this pertains to not only .NET applications (where ApplicationSettingsBase can be utilized) but also in unmanaged C/C++ applications.

Thanks to Pax and Remus for both of the great answers. I've found this item as well (specific to XP):

How to write a Windows XP Application that stores user and application data in the correct location by using Visual C++

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There's a good description here of the various CSIDL values and the folders they refer to (including a description which should hopefully tell you what you need to know).

It also contains links to the functions you should use to retrieve these special folder paths.

Note that, as of Vista, the method has changed a little. It now uses KNOWNFOLDERID instead of CSIDL and the functions have changed as well. See here.

You can still use the older functions (at the moment) since I believe they're now just wrappers around the new ones. At some point in the future, that may change.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...