需要提升权限,而UAC弹出窗口 [英] Need to elevate permissions without UAC pop ups

查看:289
本文介绍了需要提升权限,而UAC弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它是另一个应用程序(我的主要原因之一)一个发射器。发射进入到FTP服务器,下载并安装更新。但是,更新的可执行文件需要一些DLL和EXE文件复制到主应用程序的安装目录,这是程序文件。正因为如此,我目前需要提升的更新的权利。

I have an application which is a launcher for another application (my main one). The launcher goes to an FTP server, downloads updates and installs them. However, the update executable needs to copy some DLLs and EXEs to the installation directory of the main application, which is in Program Files. Because of that, I currently need to elevate the rights of the updater.

这是一个问题,因为我的应用程序启动开机,一般会简单地加载到系统托盘(应用程序相媲美信使/ SKYPE)。如果我开始在屏幕上弹出UAC警告,并试图以静默更新应用程序,它不是这样沉默了。

This is a problem because my application starts on boot, and in general will simply load to the system tray (the application is comparable to messenger/skype). If I start popping UAC warnings on the screen while trying to "silently" update the application, it's not so silent any more.

我现在看到的避免的唯一方法问题是让所有的用户权限,程序文件的安装目录,但我不愿意这样做。任何其他的想法?

The only way I see right now to avoid the problem is to give all users permissions to the program files installation directory, but I am reluctant to do that. Any other ideas?

我使用的是Windows 7和应用程序是在C#。

I'm using Windows 7, and the applications are in C#.

推荐答案

这样做会侵犯用户的访问控制的基本原则。

Doing so would violate the basic principle of User Access Control.

有没有办法提升权限,同时避免提示,由设计。如果有办法做到这一点,UAC会变得毫无用处。

There is no way to elevate permissions while avoiding the prompts, by design. If there was a way to do this, UAC would become useless.

话虽这么说,你可以尝试设计身边问题。而不是让你的程序启动/系统托盘的应用程序,你可能要考虑一个窗口服务,做了更新。这可以作为引导(而不是登录)管理员身份运行,它会已经与提升的权限运行。

That being said, you could try to design around the issue. Instead of making your program a startup/system tray application, you may want to consider making a windows service that does the update. This could run as an administrator on boot (instead of login), and it would already run with elevated permissions.

如果你需要一个系统托盘应用程序,它可能是一个单独的应用程序,会谈,该服务。

If you need a system tray application, it could be a separate app that "talks" to the service.

这篇关于需要提升权限,而UAC弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆