Windows 安装程序清单嵌入问题
我有自己的安装程序应用程序。为了将权限提升到管理员,我有以下RC文件:Windows 安装程序清单嵌入问题,windows,winapi,installation,manifest,Windows,Winapi,Installation,Manifest,我有自己的安装程序应用程序。为了将权限提升到管理员,我有以下RC文件: 2 ICON "icon.ico" 1 RT_MANIFEST "setup.exe.manifest" 及下列舱单: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <com
2 ICON "icon.ico"
1 RT_MANIFEST "setup.exe.manifest"
及下列舱单:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--This Id value indicates the application supports Windows Vista functionality -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--This Id value indicates the application supports Windows 7 functionality-->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--This Id value indicates the application supports Windows 8 functionality-->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--This Id value indicates the application supports Windows 8.1 functionality-->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<asmv3:trustInfo xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:security>
<asmv3:requestedPrivileges>
<asmv3:requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</asmv3:requestedPrivileges>
</asmv3:security>
</asmv3:trustInfo>
</assembly>
mt.exe -inputresource:blablabla.exe;#1 -out:extracted.manifest
安装程序是使用MSVC 2017编译的,然后我将要安装的实际数据附加到setup.exe文件中。我假设EXE文件的开头包含关于其原始长度的信息,所以系统可以读取它需要的任何内容,而不会实际接触附加的数据。图标显示正确,因此我认为一切正常
但我有两个问题:
Edit2:安装程序也已签名,Windows已正确读取签名。显然,像这样将其作为资源嵌入是行不通的。可以使用此命令验证清单:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--This Id value indicates the application supports Windows Vista functionality -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--This Id value indicates the application supports Windows 7 functionality-->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--This Id value indicates the application supports Windows 8 functionality-->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--This Id value indicates the application supports Windows 8.1 functionality-->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<asmv3:trustInfo xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:security>
<asmv3:requestedPrivileges>
<asmv3:requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</asmv3:requestedPrivileges>
</asmv3:security>
</asmv3:trustInfo>
</assembly>
mt.exe -inputresource:blablabla.exe;#1 -out:extracted.manifest
但当直接从MSVC内部的链接器/清单文件页面使用时,它可以工作,而没有实际的清单文件,它自身也会产生一些问题。它无法提升哪些操作系统版本以及这些系统上的UAC设置是什么?我实际上不知道-但从客户提供的一些简要信息来看,它似乎与一些具有默认UAC设置的最新Windows 10相关。而且“似乎没有提升”意味着他们根本没有UAC提升对话框?您正在使用MSVS2017构建此对话框-项目构建设置已包含将写入自动生成和包含的清单的参数。您确定清单已嵌入到可执行文件中吗?可能您的安装程序被提升,因为它的名称包含“安装”短语(或“安装”、“安装”等)。看起来,在Windows101709中,这种启发式方法停止了工作。“显然,像这样将其作为资源嵌入是行不通的。”-是的,是的。我一直在使用其他非VC编译器,它工作得很好。嗯,也许我做错了什么,很难说,这就是为什么我在问题中描述了我所做的。好吧,它不起作用:)。我猜您的项目设置是让编译器/链接器创建自己的清单,最终覆盖您的自定义清单资源。要进行验证,请使用资源查看器/编辑器查看最终编译的EXE中的实际清单。如果要使用自定义清单,应关闭编译器/链接器生成的清单。或者,根本不使用单独的自定义清单文件。将自定义清单元素放在项目设置中,让编译器/链接器将它们与自己的清单元素合并,以生成最终清单资源。这一点很好!exe实际上似乎根本不包含清单。不管怎样,这很好,我所需要的只是管理权限。谢谢你的洞察力!