如何防止标准 Windows 10 用户提升卸载程序? [英] How to prevent uninstaller elevating for Standard Windows 10 user?

查看:29
本文介绍了如何防止标准 Windows 10 用户提升卸载程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 x86 Win32 桌面应用程序.当安装程序由标准(非管理员)用户运行时,我们避免提升和/或显示 UAC 提示并安装在 C:\Users\username\AppData\Roaming\... 下常见的 Program Files 目录.

We have an x86 Win32 desktop application. When the installer is run by a Standard (non-Admin) user, we avoid elevating and/or showing a UAC prompt and install under C:\Users\username\AppData\Roaming\... instead of the common Program Files directory.

在 Windows 10 上,当我们的卸载程序从 控制面板启动时 ->程序 ->程序和功能,不显示 UAC 提示,卸载程序运行而不提升.这是所需的行为.当从 Start -> 启动相同的卸载程序时;设置 ->系统 ->应用程序features,显示 UAC 提示.

On Windows 10, when our uninstaller is launched from Control Panel -> Programs -> Programs and Features, no UAC prompt is shown and the uninstaller runs without elevating. This is the desired behaviour. When the same uninstaller is launched from Start -> Settings -> System -> Apps & features, a UAC prompt is shown.

(在 Opera 浏览器安装程序/卸载程序中可以看到相同的行为.我测试了 v35.0.2066.37.)

(The same behaviour can be seen in the Opera browser installer/uninstaller. I tested v35.0.2066.37.)

为什么同一个卸载程序在从 Apps & 启动时表现不同功能 vs 程序和功能?

Why does the same uninstaller behave differently when launched from Apps & features versus Programs and Features?

从Apps &启动卸载程序时如何避免UAC提示功能?

How can the UAC prompt be avoided when the uninstaller is launched from Apps & features?

我们的卸载程序的清单包括:

The manifest of our uninstaller includes this:

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
   <security>
      <requestedPrivileges>
         <requestedExecutionLevel level="asInvoker" />
      </requestedPrivileges>
   </security>
</trustInfo>

我尝试更改 requestedExecutionLevel,并尝试完全删除 trustInfo,但无论哪种方式都没有改变行为.

I tried changing the requestedExecutionLevel, and also tried removing trustInfo completely, but there was no change in behaviour either way.

在 Windows 10 版本 1511 内部版本 10586.104 上测试.

Tested on Windows 10 version 1511 build 10586.104.

澄清一下,我要处理的情况是用户拥有标准帐户但不知道管理员帐户的密码.如果他们在尝试卸载时看到 UAC 提示,他们别无选择,只能取消它,我们的卸载程序也不会运行.

Just to clarify, the case I'm trying to handle is where the user has a Standard account and does not know the password of an Admin account. If they see a UAC prompt when they try to uninstall, they have no choice but to cancel it, and our uninstaller does not get run.

推荐答案

据我所知,这是应用程序和功能"中的一个错误.WiX 人员已关闭此问题作为 Windows 错误,我认为他们已通知正确的人@微软.尽管 Insider build 15042 中的行为仍然相同,但它可能不会在 Creators Update 中及时得到修复.

This is a bug in "Apps & features" as far as I know. The WiX people have closed this issue as a Windows bug and I assume they have notified the correct people @ Microsoft. The behavior is still the same in Insider build 15042 though so it is probably not going to get fixed in time for the Creators Update.

如果标准用户无法提升,则没有您可以使用的解决方法.

There is no workaround you can use if the standard user cannot elevate.

如果他们可以提升那么你可以使用 re-spawn workaround 发布在评论中或手动加载用户配置文件并调用 RegOverridePredefKey 但它们都是丑陋的黑客(恕我直言).

If they can elevate then you can use the re-spawn workaround posted in the comments or manually load the user profile and call RegOverridePredefKey but they are both ugly hacks (IMHO).

这篇关于如何防止标准 Windows 10 用户提升卸载程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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