Do applications installed to Program Files have permissions to modify their folder?

大憨熊 提交于 2019-11-29 11:49:57

Apps don't run as users, users run as users. If you install an app into Program Files, and let's assume you needed elevated permissions to do so, when your standard user then runs that app, that is the user that needs permissions.

  1. App is installed with elevated permissions (user: Admin, for example)
  2. All permissions on the AppName folder might well be "Admin:Full, Users:Read"
  3. User runs app, so cannot change any files

At install-time, your installer will need to know which of it's own files need to be made writable to standard users, and set permissions accordingly. Of course, user-data should not be in Program Files anyway. That's what %appdata% and the user profile are for, usually.

If your app has a globalsettings.ini or whatever, that lives in "Program Files\YourApp", then while you have admin permissions (i.e. at install time) you need to grant write permission to all users to that globalsettings.ini file. Or Power Users. Or a group. Or whatever is correct for your app.

In summary, no, users do not have default write-access to ProgFiles, nor should they.

Yes, there are definitely situations where this won't work, such as when your app is running on Windows 7, or if your user account is a limited user.

We always put our log files in a temp directory or a special folder such as AppData.

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