分步式UAC指南 [英] Step-by-step UAC Guide

查看:76
本文介绍了分步式UAC指南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以一步一步告诉我如何将UAC高程添加到以下应用中Vista?我正在寻找提升提示,以使应用程序有时执行一些特定于Admin的任务.从未真正详细介绍如何将其添加到应用程序中.一切都很混乱.

谢谢

推荐答案

您应用中需要管理员特权的部分进入单独的exe.添加"asInvoker"清单显示给主要的非管理员exe和"requireAdministrator"向管理员exe清单.使用ShellExecute而不是CreateProcess来启动admin exe(从非admin到admin的CreateProcess只会失败),系统将自动使用户通过海拔提示,然后再运行admin exe.但是,请确保将有效的HWND传递给ShellExecute,否则海拔提示将最小化.对于威胁程度较小的提示,请至少使用(真实的,而不是``测试''的)Authenticode证书对管理员exe进行签名.为了锦上添花,请将UAC盾牌图标添加到启动管理exe的按钮和菜单项等上,以便用户期望出现海拔提示.
The basic idea is to separate out the parts of your app that require admin privileges into separate exe(s). Add an "asInvoker" manifest to the main, non-admin exe(s), and a "requireAdministrator" manifest to the admin exe(s). Use ShellExecute, NOT CreateProcess, to launch the admin exe(s) (CreateProcess from non-admin to admin will simply fail) and the system will automatically make the user go through an elevation prompt before running the admin exe. Make sure to pass a valid HWND to ShellExecute, though, or the elevation prompt will come up minimized. For a less threatening elevation prompt, sign at least the admin exe(s) with a (real, as opposed to "test") Authenticode certificate. For icing on the cake, add the UAC shield icon to the buttons and menu items and so on that launch the admin exe(s), so that the user will expect the elevation prompt.


这篇关于分步式UAC指南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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