Add write permission to Custom folder files created with windows installer

血红的双手。 提交于 2019-11-28 11:09:31

问题


I am creating a folder inside programdata folder using windows installer. Running the project i am getting an error while trying to write to the file

C:\ProgramData\MyAppFolder\settings_file.sqlite

This is the error message

attempt to write a read-only database.

How can i grant the write permission to the db file and some other files while building the msi file using windows installer

I can see the folder permissions as like this

any way to make this read and write enables while building this via windows installer


回答1:


ACL Permissioning: Adding write permissions for regular users is usually considered an anti-pattern, but sometimes you need to share a file among all users of the PC for pragmatic purposes.

Write Access: For the record: Here is a list of approaches to deal with permission denied issues. Most of the options listed are not good at all - and that is why the list was made - we need to remember why they are bad and what alternatives exist.

Deployment Tool: Application of custom ACL permissioning - to open a file in a protected disk location for writing by all users - is different depending on what tool you use to make your MSI. Since you don't specify WiX, Installshield, Advanced Installer or something else I am not sure how to answer. Let me use links instead:

WiX:

  • Different WiX permission elements - there are two different PermissionEx elements (!)
    • PermissionEx (Util Extension - WiX's own stuff)
      • Util Version: Wix: How to set permissions for folder and all sub folders
    • PermissionEx (MSI5 only - uses the built in MsiLockPermissionsEx Table)
      • MSI5 Version: How to deny folder permission to Users with wix installer
  • There are two more (do not use):
    • Permission (legacy MSI LockPermission table)
    • FileSharePermission (for share permissioning - use when you need share permissioning)

Installshield:

  • Configuring Permissions for Files and Folders
  • Setting Permissions in Windows Installer: MSILockPermissionsEX and ISLockPermissions
  • Installshield Folder Permissions not working

Advanced Installer:

  • Apply permissions by right clicking a folder and going to properties: Permission Dialog.
  • It seems this uses the old, legacy LockPermission table.

There are some other tools as described here: Short List. Secondary (more links).


Other Links:

  • Different Ways of Giving Permissions in Your Windows Installer
  • Per Machine App Registration
  • Create a .config folder in the user folder
  • Desktop applicaton not opening after installation in client system
  • http://wixtoolset.org/documentation/manual/v3/xsd/wix/permissionex.html


来源:https://stackoverflow.com/questions/55114539/add-write-permission-to-custom-folder-files-created-with-windows-installer

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