简体   繁体   中英

Expand an x86 .exe to 'C:\Windows\System32' under both Windows x86 and x64?

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

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

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...

UPDATE

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

    Valid values: One or more of the following, separated by spaces:

    • x64
    • ia64

Default value: (blank)

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.

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

  1. Source (Required)

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.

Example:

Source: "My_x86_application.EXE"

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}

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 (Required)

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

  1. For the Flags and further doubt clarification visit this page.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM