有没有办法避免程序文件中自动运行应用程序的UAC?

发布于 2024-12-06 05:54:02 字数 422 浏览 1 评论 0原文

首先,我想强调,我并不想做任何“令人讨厌的”或“黑客行为”的事情,也不想在这里向用户隐藏任何东西。

在安装(使用 InstallShield LE)我的应用程序时,Windows UAC 会提示用户允许其在管理员模式下运行;如果用户接受它 - 安装继续(标准行为),并且用户再次可以检查将该程序添加到自动运行列表的选项(通过将注册表项添加到 HKLM/../Run)。一切都很好,很正常。但每次 Windows 重新启动后,当此应用程序启动时,UAC 就会启动并请求用户许可。问题是,如何避免它,因为它有点烦人(但我的应用程序需要管理员权限才能运行)?

我的意思是用户已经在安装时授予了此类权限,所以我看不出为什么每次启动时都需要提示?此外,我相信大多数防病毒软件等也需要提升权限才能运行,但 UAC 不会在 Windows 启动时提示。

感谢您提供任何建议、信息、评论或解决方案。

Firstly I want to emphasize that I'm not trying to do anything "nasty" or "hackerish", nor am I trying to hide anything from user here.

During installations (using InstallShield LE) of my application user is prompted by Windows UAC to allow it to run in Administrator mode; If user accepts it - installation continues (standard behavior) and user again can check the option to add this program to autorun list (by adding a registry key to HKLM/../Run). All is fine and normal. But after every Windows restart, when this application starts, UAC kicks in and asks for user permission. Question is, how to avoid it, since it's a bit annoying (yet my app needs Administrator privileges to run)?

I mean user already granted such permissions on installation, so I cannot see a reason why it needs to be prompted on every startup? Moreover, I believe most antivirus software and such, also require elevated permissions to operate, but UAC doesn't prompt for it at Windows Startup.

Thank you for any advises, information, comments or solutions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

甜尕妞 2024-12-13 05:54:03

没有完成,但我发现这篇文章 有选择地为您信任的 Vista 应用程序禁用 UAC,其中显示“使用”应用程序兼容性工具包'。

兼容性管理器允许您创建一个数据库
兼容性修复将允许您运行某些应用程序
没有附带的 UAC。

  • 以管理员身份运行兼容性管理器
  • 选择新的数据库模板
  • 单击工具栏上的修复 按钮。当您看到创建新应用程序修复向导时...输入有关您的应用程序的详细信息
  • 选择兼容性级别
  • 选择RunAsInvoker作为修复

似乎是最后一个

选择 RunAsInvoker 选项将允许应用程序启动
不需要UAC提示。

应该做你想做的事情,前提是调用者是管理员,我认为你可以在启动时使用调度程序执行此操作: 在 Windows 7 或 Vista 中创建没有 UAC 提示的管理员模式快捷方式

如您所见,它在您可能接受也可能不接受的兼容模式。

Not done it but I found this article Selectively disable UAC for your trusted Vista applications that says use 'Application Compatibility Toolkit' from microsoft.

The Compatibility Administrator allows you to create a database of
compatibility fixes that will allow you to run certain applications
without an accompanying UAC.

  • Run the Compatibility Administrator as admin
  • select a new database template
  • Click the Fix button on the toolbar. When you see the Create New Application Fix wizard ... enter details about your app
  • Select a Compatibility Level
  • Select RunAsInvoker as the fix

It seems that the last one

Selecting the RunAsInvoker option will allow the application to launch
without requiring the UAC prompt.

Should do what you want provided that the invoker is admin and I think you can do this at start up using the scheduler : Create Administrator Mode Shortcuts Without UAC Prompts in Windows 7 or Vista

As you can see it runs your app in the compatibility mode which may or may not be acceptable for you.

半寸时光 2024-12-13 05:54:02
  1. 您的应用程序真的需要启动提升吗?或者当用户使用它执行操作时是否需要提升访问权限?如果可以的话,将后面的管理任务放入一个单独的 exe 中,允许主 exe 在没有提升的情况下启动 - 当您稍后 shell 执行工作进程时,它将按需 UAC。

  2. 正如您所指出的,在安装时,您已经提升了安装程序。如果您想在后续运行中自动运行提升的代码,则需要安装服务 - 这就是您提到的所有其他应用程序所做的事情。

  1. Does your application really need to start elevated? Or will it need to elevated access later when the user uses it to perform an action? If you can, drop the later admin task into a separate exe, allowing the main exe to start with no elevation - when you shellexecute the worker process later it will UAC on demand.

  2. At install time, as you have noted, you have elevated the installer. If you want to run elevated code on subsequent runs, automatically, this is the point to install a service - which is what all those other apps you mentioned do.

(り薆情海 2024-12-13 05:54:02

对于在交互式会话中启动的进程,您无法绕过 UAC。您可以使用以特权用户身份运行的服务,但最好找到一种无需管理员权限即可执行任何操作的方法。

You can't get around UAC for a process started in an interactive session. You could use a service running as a privileged user but you would be far better off finding a way to do whatever you do without requiring admin rights.

我的奇迹 2024-12-13 05:54:02

程序不可能在没有提示的情况下以提升的权限运行。您想要做的是将应用程序中需要提升到作为系统运行的 Windows 服务的那些部分。然后,您的自动启动应用程序可以对服务进行远程调用,以委派那些用户在不提升权限的情况下无法执行的活动。

It's not possible for a program to run elevated without prompting. What you want to do is factor those portions of your application that need elevation into a windows service that runs as system. Then your autostarting application can make remoting calls to the service to delgate those activities that the user can't do without elevating.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文