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

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