UAC: Manifest file is ignored

有些话、适合烂在心里 提交于 2019-12-10 10:58:01

问题


One of my Executables writes some configuration into a XML file to C:\Program Files\MyApp\config.xml. It needs to run as Administrator on Vista / Server 2008, otherwise the OS won't let it write to that location.

I included a manifest file named config.exe.manifest, to automatically request administration rights at launch.

Here's my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<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>

I tried this on Windows Server 2008, but the manifest file seems to be ignored and the executable is launched without sufficient rights.


回答1:


http://blogs.msdn.com/junfeng/archive/2009/05/11/internal-manifest-vs-external-manifest.aspx

quoted from above link: In Windows XP, Sxs searches external manifest before internal manifest. If an external manifest is found, the internal manifest is ignored.

In Windows Server 2003 and later, the order is reversed. Internal manifest is preferred over external manifest.

If you use external manifest, and your scenario works in Windows XP, but not Windows Server 2003 and later, please double check the executable does not have an internal manifest




回答2:


This will drive you batty - got to the bottom of it and posted an article and some utilities to help with your manifest being ignored: Find Out Why Your External Manifest Is Being Ignored.




回答3:


Ok it works when I embed the manifest file using MT.EXE. Still don't why it doesn't work when I provide the manifest as a separate file, but I guess embeding is a good enough solution.



来源:https://stackoverflow.com/questions/1444300/uac-manifest-file-is-ignored

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!