带有嵌入式清单的可分发.exe,用于管理权限. [英] Distributable .exe With An Embedded Manifest for Admin Priveledges.

查看:112
本文介绍了带有嵌入式清单的可分发.exe,用于管理权限.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我被困在使用VC6的项目上.请不要讨厌,如果我可以选择使用更现代的产品,那我将成为现实.

我的申请需要管理权限才能正常工作.在我的计算机上,我已通过mt.exe Microsoft SDK从与.exe相同目录中的外部记事本文件将此清单嵌入到版本.exe中.

 <?  xml    版本  ="    编码  ="  UTF-8" 独立  是"  > 
<  组件    ="   urn:schemas-microsoft-com:asm.v1"    manifestVersion   ="  1.0" <   trustInfo     ="   urn:schemas-microsoft-com:asm.v3" > 
    <  安全性 > 
      <  请求的权限 > 
        <   requestedExecutionLevel  
 
                     span>        ="   RequireAdministrator" 
 
                     span>        ="   false" / > 
        <  /requestedPrivileges  > 
       <  /security  > 
  <  /trustInfo  > 
<  /assembly  >  



通过命令行:

 mt.exe -nologo –清单"MyApp.exe.manifest" -outputresource:"MyApp.exe;#1" 



在我的计算机上(运行Windows 7 32bit),它可以正常工作,并强制系统管理员提示,使我的程序在我点击是"后即可运行.

但是,如果我尝试将新嵌入的发行版.exe和清单文件一起转移到我的另一台计算机(运行Windows 7 64bit)上,即使我尝试在新计算机上重新嵌入清单,也不会再出现管理提示.我的程序无法正常运行.

我有什么办法可以将此应用程序转移到另一台计算机上,同时保持提示管理员状态的能力?

感谢您听到我的声音!另外,我目前正在使用的所有内容对我来说还是很新的,所以如果我遗漏了明显的内容或做的是一些非常基本的错误,我向您道歉.

解决方案

乍一看,在我看来您做对了.可能在第二台计算机上禁用了UAC.

请参阅:
http://en.wikipedia.org/wiki/User_Account_Control [ http://www.howtogeek .com/howto/windows-vista/4-ways-to-make-uac-less-annoying-on-windows-vista/ [ http://4sysops.com/archives/vista-user -account-control-uac-traps-part-2-elevated-applications/ [ < 程序集 xmlns =" manifestversion > < ms_asmv2:trustinfo xmlns:ms_asmv2 =" > < ms_asmv2:安全性 > < ms_asmv2:要求的特权 > < ms_asmv2:要求的执行级别 级别 =" uiaccess false " < /ms_asmv2:requestedexecutionlevel > < /ms_asmv2:requestedprivileges > < /ms_asmv2:security > < /ms_asmv2:trustinfo > < /assembly > pre>


Hello Everyone,

I''m stuck working on a project using VC6. Please don''t hate, If I had the option to work with something more modern I would be.

My application requires Administration rights to work properly. On my computer, I''ve embedded this manifest into my release .exe via the mt.exe Microsoft SDK from an external notepad file in the same directory as my .exe:

<?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"

          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>



via the command line:

mt.exe -nologo –manifest "MyApp.exe.manifest" -outputresource:"MyApp.exe;#1"



On my computer(running windows 7 32bit), this works flawlessly and forces the system admin prompt, allowing my program to function after I hit yes.

However if I attempt to transfer my newly embedded release .exe, along with the manifest file to my different computer (running windows 7 64bit) the admin prompt no longer occurs, even if I attempt to re-embed the Manifest on the new computer causing my program to not properly function.

Is there any way for me to be able to transfer this application to a different computer while maintaining the ability to prompt admin status?

Thanks for hearing me out! Also, everything I''m currently working with is still very new to me so I apologize in advance if I''m missing something obvious or doing something very basic wrong.

From the first glance, it seems to me you were doing right thing. It could be possible that UAC is disabled on the second machine.

Please see:
http://en.wikipedia.org/wiki/User_Account_Control[^].

This is how it could be disabled, so you can see how to check it up:
http://www.howtogeek.com/howto/windows-vista/4-ways-to-make-uac-less-annoying-on-windows-vista/[^].

This is an interesting article, even though it''s obsolete:
http://4sysops.com/archives/vista-user-account-control-uac-traps-part-2-elevated-applications/[^].

—SA


This manifest file works for me in both 32 and 64 bit environment:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
  <ms_asmv2:trustinfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
    <ms_asmv2:security>
      <ms_asmv2:requestedprivileges>
        <ms_asmv2:requestedexecutionlevel level="requireAdministrator" uiaccess="false">
        </ms_asmv2:requestedexecutionlevel>
      </ms_asmv2:requestedprivileges>
    </ms_asmv2:security>
  </ms_asmv2:trustinfo>
</assembly>


这篇关于带有嵌入式清单的可分发.exe,用于管理权限.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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