Setup Project\" from Visual Studio 2008. Originally the sof" />
开发者

Providing Directory's Full Control for Non-admin Users under Windows 7

I'm working on a software written in C# and for .NET Framework 3.5. The installer for the software is created by a "Setup and Deployment > Setup Project" from Visual Studio 2008. Originally the software was written for Windows XP. Now I need to modify it so that it also works under Windows 7.

In Windows 7, admin privilege is required for a software to be installed. So the admin becomes the owner of the installation directory created during the installation. The software will be used by non-admin users, who only have read and execute access of the installation directory by default. But the software is designed in such a way that it can write to the installation directory. There is a startup.ini configuration file resides in the installation directory which the non-admins should be able to modify to alter the behavior of the software.

If the software is run from non-admin account, it can't write to th开发者_JS百科e installation directory. Also non-admins can't change the startup.ini file.

As a workaround, currently the admin installs it changes the permission of the installation directory so that non-admins can write and modify it.

I want it to be automatically done after installation. Somehow the installer should take care of the permission. How can I do that? Note that I can't change the software behavior so it no longer writes into the installation directory. The non-admins must be given necessary privilege so that they can have modify and write permission.

I'm using Windows XP SP3 for the development. All OSes involved (XP and 7) are 32 bit.

Thanks in advance.


you should change the application so that it stores its INI file at a location which normal users can write - see http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/77aaf6e1-8de5-4529-9b26-fa89b55fcc49

EDIT:
IF that is absolutley not possible then: create a "custom action" in the setup project and change the permissions... a good starting point is

http://www.redmondpie.com/applying-permissions-on-any-windows-folder-using-c/
and
http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemsecurity.addaccessrule.aspx


For the record, your program is broken on Windows XP as well. XP also requires admin rights to install this way or write to Program Files folders. The difference is that so many people have admin by default in XP.

If you can't modify the program, you will have to write a custom installer action to grant write access to the ini file in question. There is no need to grant this access to the entire folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜