Correct way to design around Windows UAC limitations?

大憨熊 提交于 2019-11-30 09:26:21

Per-user application specific data should be written in the AppData folder.

You should use SHGetKnownFolderPath with FOLDERID_LocalAppData.

In managed code, you should use System.Environment.GetFolderPath with System.Environment.SpecialFolder.LocalApplicationData.

Yes, there are specific locations. Consider this msdn article as a first reference. It mentions the locations:

  • CSIDL_APPDATA
  • CSIDL_LOCAL_APPDATA
  • CSIDL_COMMON_APPDATA

In native code, the method SHGetKnownFolderPath should prove useful.

In managed code you can use Environment.GetFolderPath(). If you're in a specific application framework, such as windows forms, you can get even easier access via direct properties, such as Application.LocalUserAppDataPath (which is my personal favorite technique). The framework path will include app-specific qualifiers on the path it returns to distinguish between (e.g.) different versions of your app.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!