加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

VB.NET写支持UAC功能的程序

发布时间:2020-12-17 07:55:00 所属栏目:百科 来源:网络整理
导读:打开程序属性,查看app.manifest文件,其内容一般如下: ? xml version = " 1.0 " encoding = " utf-8 " ? asmv1:assembly manifestVersion = " 1.0 " xmlns = " urn:schemas-microsoft-com:asm.v1 " xmlns:asmv1 = " urn:schemas-microsoft-com:asm.v1 " xm

打开程序属性,查看app.manifest文件,其内容一般如下:

<?xmlversion="1.0"encoding="utf-8"?>

<asmv1:assemblymanifestVersion="1.0"xmlns="urn:schemas-microsoft-com:asm.v1"xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<assemblyIdentityversion="1.0.0.0"name="MyApplication.app"/>

<trustInfoxmlns="urn:schemas-microsoft-com:asm.v2">

<security>

<requestedPrivilegesxmlns="urn:schemas-microsoft-com:asm.v3">

<!-- UAC清单选项

如果希望更改 Windows用户帐户控制级别,请用以下节点之一替换

requestedExecutionLevel节点。

<requestedExecutionLevel level="asInvoker" uiAccess="false" />

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

如果您希望利用文件和注册表虚拟化提供

向后兼容性,请删除 requestedExecutionLevel节点。

-->

<requestedExecutionLevellevel="requireAdministrator"uiAccess="false" />

</requestedPrivileges>

</security>

</trustInfo>

</asmv1:assembly>

Manifest文件中最重要的部分是:

<requestedExecutionLevellevel="requireAdministrator" uiAccess="false" />

这个部分定义了当前应用程序的运行级别,其中共有三中基本如下:

asInvoker:应用程序将使用与启动它的进程相同的权限运行。可通过选择“以管理员身份运行”将应用程序提升为更高权限。

highestAvailable:应用程序将使用可能的最高权限级别运行。如果启动该应用程序的用户为管理员组的一个成员,则此选项与 requireAdministrator 相同。如果可用的最高权限级别高于打开进程的级别,则系统将提示提供凭据。

requireAdministrator:应用程序将使用管理员权限运行。启动该应用程序的用户必须是管理员组的一个成员。如果打开进程未使用管理权限运行,则系统将提示提供凭据。

uiAccess的作用是如果您希望应用程序绕过用户界面保护级别并将输入引导到桌面上的更高权限窗口(如屏幕键盘),则为 true;否则为 false。默认为 false。仅针对用户界面辅助功能应用程序设置为 true。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读