[英]Allow File to be Read by Non-Admin User Process
My installer runs with elevated privileges and writes a file (A) to $APPDATA
(C:/ProgramData) aswell as writting files to $PROGRAMFILES
. 我的安装程序以提升的特权运行,并将文件(A)写入$APPDATA
(C:/ ProgramData)并将文件写入$PROGRAMFILES
。 File A
is a .addin
file read by an application called Revit. 文件A
是一个名为Revit的应用程序读取的.addin
文件。
My Problem: Because the file A
is created by an admin process, this file is unable to be read by Revit when the user is a Non-Admin windows user. 我的问题:由于文件A
是由管理员进程创建的,因此当该用户是非管理员Windows用户时,Revit将无法读取该文件。
I would like to edit the file A
so that it can be read by the a Non-Admin windows user but I dont know how. 我想编辑文件A
以便非管理员Windows用户可以读取它,但我不知道如何。 Can you suggest how I can achieve this? 您能建议我如何实现这一目标吗?
I have tried using the NSIS function SetFileAttributes "myFilePath.addin" NORMAL
but this doesn't work. 我试过使用NSIS函数SetFileAttributes "myFilePath.addin" NORMAL
但这不起作用。
Note: I am aware I could run my installer without elevated privileges and then Revit could read the file but as I mentioned above my installer also writes to $PROGRAMFILES
so I need elevated privileges. 注意:我知道我可以在没有提升特权的情况下运行我的安装程序,然后Revit可以读取该文件,但是如上所述,我的安装程序还会写入$PROGRAMFILES
因此我需要提升特权。
Use the AccessControl plugin to change the DACL: 使用AccessControl插件来更改DACL:
; This gives read access to the everyone group, use (BU) or (S-1-5-32-545) for BUILTIN\Users
AccessControl::GrantOnFile "$INSTDIR\myfile" "(S-1-1-0)" "GenericRead"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.