64 位应用程序的应用程序清单

Application manifest for 64 bit applications

我已经创建了一个 64 位 Windows 应用程序,并且想要包含一个应用程序清单。

我比较了其他供应商的几个 DLL,例如shell32.dll ,并看到他们将值“x86”设置为 processorArchitecture;示例:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
  xmlns="urn:schemas-microsoft-com:asm.v1"
  manifestVersion="1.0">
<assemblyIdentity
    name="...."
    processorArchitecture="x86"
    version="...."
    type="win32"/>
<description>....</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="x86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly> 

我的问题:

  1. 64 位应用程序获得带有 processorArchitecture="x86" 的清单真的可以吗?

  2. 微软describes处理器架构如下:

Specifies the processor. The valid values are x86 for 32-bit Windows and ia64 for 64-bit Windows. Optional.

这让我很困惑。为什么没有列出 amd64 / x86-64?我有一个 64 位 Windows,但我没有 Intel Itanium 架构。

编辑 2021 年 7 月:Microsoft 更新了说明。新的描述是:“指定处理器。有效值包括 x86、amd64、arm 和 arm64。可选。”

  1. 根据清单,我的 64 位应用程序依赖于“Microsoft.Windows.Common-Controls”和 processorArchitecture="x86" 可以吗? 如果我的应用程序“使用”像 comctl32.dll 这样的 DLL 来显示控件,我认为它必须是相同的体系结构,因为 64 位不能在没有 thunk 的情况下绑定 32 位。

编辑:原来是我弄错了:我用工具“Resource Hacker”查看了DLL,它是一个32位的应用程序,所以我看到了32位的通过 SysWOW64 的 DLL,同时假设它是 64 位 DLL。真正的 64 位 DLL 包含 processorArchitecture="amd64",符合预期。

Windows10 未检查用于标识您的应用程序的 processorArchitecture 属性。您可以省略它。

dependentAssembly 元素下的属性必须具有正确的值。但是,为了简单起见,您可以使用 processorArchitecture="*"

如果您想明确地说,amd64 是 x86-64 架构的正确值。仅记录 ia64 显然是 Microsoft 文档中的遗漏。我已经提交了 pull request 来更正。

shell32.dll 在我的 Windows 10.

副本中指定 amd64