vs2005和vs2010 UAC提权



UAC是什么意思,看官方解释:

User Account Control (UAC) is a new security component in Windows Vista and newer operating systems. With UAC fully enabled, interactive administrators normally run with least user privileges. This article and the attached code samples demonstrate these frequently asked coding scenarios related to UAC.


简单来说就是给当前应用程序提供权限,进而可以对系统做一些需要特殊权限才能完成的操作,比如联网,写文件等。


在VS2010下UAC提权非常简单,只需要在编译器内工程属性设置即可,如下图:


但vs2005就没有这么简单了,但也是比较方便的,方法如下:

首先新建一个xml文件,输入以下下内容:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator"/> </requestedPrivileges> </security> </trustInfo> </assembly>

然后将这个文件拖拽到vs2005的工程目录下,通过菜单添加因为有file filter,似乎添加不了。

然后重命名下文件为 uac.manifest,重新编译即可



更多内容,请参考 www.seanyxie.com

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章