在Windows x86和x64下都将x86 .exe扩展到"C:\ Windows \ System32"? [英] Expand an x86 .exe to 'C:\Windows\System32' under both Windows x86 and x64?

查看:138
本文介绍了在Windows x86和x64下都将x86 .exe扩展到"C:\ Windows \ System32"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使我的安装程序在 x86 / x64 窗口下都兼容,这意味着可移植.

I would like to make my installer compatible under both x86/x64 windows, this means portable.

我做了innosetup安装程序只是为了扩展 x86 CLI 可执行文件,我需要将其扩展到 C:\ windows \ system32 目录,即使安装程序在Windows x64 下运行,因为否则,如果我将其扩展到 C:\ Windows \ Syswow64 目录,则在Windows x64下无法识别该exe CMD .

I did the innosetup installer only to expand an x86 CLI executable file, and I need to expand it to C:\windows\system32 directory even if the installer is running under a Windows x64 because otherwise if I expand it to C:\Windows\Syswow64 directory then the exe is not recognized under a Windows x64 CMD.

那么我应该如何设置此属性以使其在上面指定的条件下可移植?

So how I should set this property to make it portable with the specified condition above?:

ArchitecturesInstallIn64BitMode= ???

在此处扩展文件时应该使用哪些标志?

And what flags I should use when expanding the file here?:

Source: {sys}\My_x86_application.exe; DestDir: {sys}; Flags: ??? 

我用32Bit64BitIs64BitInstallMode等标志玩了一点,但是我无法获得预期的结果,因为如果我知道{syswow64}的限制常量会引发安装Windows x86下出现错误...

I've played a little bit with some flags like 32Bit, 64Bit, and Is64BitInstallMode, but I can't get the expected result because if I know that restricted constants as {syswow64} throws an installation error under a Windows x86...

更新

这是我安装脚本的相关部分,但这是错误的,它应该与x86和x64 Windows(便携式)兼容,并且仅将Source: {sys}\*文件扩展到 C:\ Windows \ System32 "(当然,使用常量{sys}来检测目录路径).

This is the relevant part of my installation script, but it is wrong, it should be compatible with x86 and x64 windows (portable) and only expand the Source: {sys}\* files to C:\Windows\System32 under both windows (using the constant {sys} to detect the dir path, of course).

[Setup]
DefaultDirName={pf32}\{#AppName}
ArchitecturesAllowed=x86 x64
ArchitecturesInstallIn64BitMode=x64

[Files]
Source: {app}\*; DestDir: {app}; Flags: ignoreversion
Source: {sys}\*; DestDir: {sys}; Flags: ignoreversion 64bit

推荐答案

在类似您的问题的部分中进行了解答:

Answered in parts like your question:

  1. ArchitecturesInstallIn64BitMode

有效值:以下一个或多个,以空格分隔:

  • x64
  • ia64
  • x64
  • ia64

默认值:(空白)

描述:指定安装程序应以64位模式安装的64位处理器体系结构.如果未指定此指令或该指令为空,则安装程序将始终以32位模式安装. 通常,除非您的应用程序包含本机64位二进制文​​件,否则您不应将此指令的默认值更改.

Description: Specifies the 64-bit processor architecture(s) on which Setup should install in 64-bit mode. If this directive is not specified or is blank, Setup will always install in 32-bit mode. Normally, you should not change this directive from its default value unless your application contains native 64-bit binaries.

您有一个 x86 exe二进制文件,因此请保留空白字段.

You have a x86 exe binary so leave the field blank.

  1. Source (必需)

描述:源文件的名称. 如果您未指定标准路径名,则编译器将在安装源目录的路径之前.

Description: The name of the source file. The compiler will prepend the path of your installation's source directory if you do not specify a fully qualified pathname.

示例:

Source: "My_x86_application.EXE"

最好不带任何类似上面的条目的路径(对于小型项目,因为它会使安装脚本将要部署的文件弄乱了).另外,请注意, 常量只能在指定 external 标志时使用,因为编译器自身不会进行任何常量转换. 因此,请输入以下内容:

Leaving it without any path like the entry above might be optimal (for small projects, because it messes the files to be deployed with the setup script). Also, beware that Constants may only be used when the external flag is specified, because the compiler does not do any constant translating itself. So, the following entry:

Source: {sys}\My_x86_application.exe; DestDir: {sys}

实际上,

希望使用安装脚本将二进制文件存储在目录的{sys}子文件夹中.如果不是这样,编译将失败.

actually expects to have the binary stored in the {sys} subfolder of a directory with the setup script. If that would not be so, the compilation fails.

  1. DestDir (必需)

我认为您可以始终使用{win}\System32指定 System32 .由于Windows的 x86 x64 版本都包含 System32 目录.

I think you can specify System32 always using {win}\System32. Since both x86 and x64 version of Windows contain the System32 directory.

  1. 对于Flags和进一步的疑问澄清,请访问页面
  1. For the Flags and further doubt clarification visit this page.

将iss文件保存在x86 exe二进制文件所在的文件夹中.然后运行.

Save the iss file in the same folder where your x86 exe binary exists. Then Run it.

这篇关于在Windows x86和x64下都将x86 .exe扩展到"C:\ Windows \ System32"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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