Browse Source

Merge branch 'arm64' into is-6

Martijn Laan 6 years ago
parent
commit
271ecdf9ca
8 changed files with 118 additions and 38 deletions
  1. 52 0
      Examples/64BitThreeArch.iss
  2. BIN
      Examples/MyProg-ARM64.exe
  3. 2 0
      Examples/MyProg/Myprog.c
  4. 6 6
      ISHelp/isetup.xml
  5. 1 4
      Projects/Compile.pas
  6. 53 28
      Projects/Main.pas
  7. 2 0
      setup.iss
  8. 2 0
      whatsnew.htm

+ 52 - 0
Examples/64BitThreeArch.iss

@@ -0,0 +1,52 @@
+; -- 64BitThreeArch.iss --
+; Demonstrates how to install a program built for three different
+; architectures (x86, x64, ARM64) using a single installer.
+
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
+
+[Setup]
+AppName=My Program
+AppVersion=1.5
+DefaultDirName={autopf}\My Program
+DefaultGroupName=My Program
+UninstallDisplayIcon={app}\MyProg.exe
+Compression=lzma2
+SolidCompression=yes
+OutputDir=userdocs:Inno Setup Examples Output
+; "ArchitecturesInstallIn64BitMode=x64 arm64" requests that the install
+; be done in "64-bit mode" on x64 & ARM64, meaning it should use the
+; native 64-bit Program Files directory and the 64-bit view of the
+; registry. On all other architectures it will install in "32-bit mode".
+ArchitecturesInstallIn64BitMode=x64 arm64
+
+[Files]
+; Install MyProg-x64.exe if running on x64, MyProg-ARM64.exe if
+; running on ARM64, MyProg.exe otherwise.
+; Place all x64 files here
+Source: "MyProg-x64.exe"; DestDir: "{app}"; DestName: "MyProg.exe"; Check: InstallX64
+; Place all ARM64 files here, first one should be marked 'solidbreak'
+Source: "MyProg-ARM64.exe"; DestDir: "{app}"; DestName: "MyProg.exe"; Check: InstallARM64; Flags: solidbreak
+; Place all x86 files here, first one should be marked 'solidbreak'
+Source: "MyProg.exe"; DestDir: "{app}"; Check: InstallOtherArch; Flags: solidbreak
+; Place all common files here, first one should be marked 'solidbreak'
+Source: "MyProg.chm"; DestDir: "{app}"; Flags: solidbreak
+Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
+
+[Icons]
+Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
+
+[Code]
+function InstallX64: Boolean;
+begin
+  Result := Is64BitInstallMode and (ProcessorArchitecture = paX64);
+end;
+
+function InstallARM64: Boolean;
+begin
+  Result := Is64BitInstallMode and (ProcessorArchitecture = paARM64);
+end;
+
+function InstallOtherArch: Boolean;
+begin
+  Result := not InstallX64 and not InstallARM64;
+end;

BIN
Examples/MyProg-ARM64.exe


+ 2 - 0
Examples/MyProg/Myprog.c

@@ -5,6 +5,8 @@
 	#define ARCHNOTE TEXT("")
 #elif defined(_AMD64_)
 	#define ARCHNOTE TEXT("\n\n(This EXE was compiled for the x64 architecture.)")
+#elif defined(_M_ARM64)
+	#define ARCHNOTE TEXT("\n\n(This EXE was compiled for the ARM64 architecture.)")
 #elif defined(_IA64_)
 	#define ARCHNOTE TEXT("\n\n(This EXE was compiled for the Itanium architecture.)")
 #else

+ 6 - 6
ISHelp/isetup.xml

@@ -102,7 +102,7 @@ Inno Setup is a <i>free</i> installer for Windows programs by Jordan Russell and
 
 <li>Support for every Windows release since 2000, including: Windows 10, Windows 8.1, Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XP, Windows Server 2003, and Windows 2000. (No service packs are required.)</li>
 
-<li>Extensive support for installation of <link topic="32vs64bitinstalls">64-bit</link> applications on the 64-bit editions of Windows. Both the x64 and Itanium architectures are supported. (On the Itanium architecture, Service Pack 1 or later is required on Windows Server 2003 to install in 64-bit mode.)</li>
+<li>Extensive support for installation of <link topic="32vs64bitinstalls">64-bit</link> applications on the 64-bit editions of Windows. The x64, ARM64 and Itanium architectures are supported. (On the Itanium architecture, Service Pack 1 or later is required on Windows Server 2003 to install in 64-bit mode.)</li>
 
 <li>Extensive support for both administrative and <link topic="admininstallmode">non administrative installations</link> installations.</li>
 
@@ -5013,13 +5013,13 @@ DiskSliceSize=1457664
 <keyword value="IA-64" />
 <keyword value="Itanium" />
 <keyword value="ARM64" />
-<setupvalid>One or more of the following, separated by spaces: <br/><tt>x86</tt> <br/><tt>x64</tt> <br/><tt>ia64</tt> <br/><tt>arm64</tt></setupvalid>
+<setupvalid>One or more of the following, separated by spaces: <br/><tt>x86</tt> <br/><tt>x64</tt> <br/><tt>arm64</tt> <br/><tt>ia64</tt></setupvalid>
 <setupdefault><i>(blank)</i></setupdefault>
 <body>
 <p>Specifies which processor architecture(s) Setup is allowed to run on. If this directive is not specified or is blank, Setup will be allowed to run on all processor architectures capable of executing its 32-bit code (including ones it doesn't recognize). Otherwise, if a user's processor architecture is not one of those specified in this directive, Setup will display an error message and exit.</p>
-<p>If your application's binaries are all 32-bit and run in user mode, you should not change this directive from its default value (specifically, don't set it to <tt>x86</tt>), because normally such binaries will run without issue on the x64 and Itanium editions of Windows via the WOW64 emulator.</p>
+<p>If your application's binaries are all 32-bit and run in user mode, you should not change this directive from its default value (specifically, don't set it to <tt>x86</tt>), because normally such binaries will run without issue on the 64-bit Windows via the WOW64 emulator.</p>
 <p>If you install any 32-bit device drivers, you should set this directive to <tt>x86</tt>, as 32-bit device drivers cannot function on 64-bit Windows.</p>
-<p>If your application's binaries are built for the x64 or Itanium architectures, you should set this directive to either <tt>x64</tt> or <tt>ia64</tt> respectively.</p>
+<p>If your application's binaries are built for the x64, ARM64 or Itanium architectures, you should set this directive to either <tt>x64</tt>, <tt>arm64</tt> or <tt>ia64</tt> respectively.</p>
 <p><b>See also:</b><br/>
 <link topic="setup_architecturesinstallin64bitmode">ArchitecturesInstallIn64BitMode</link></p>
 </body>
@@ -5032,7 +5032,8 @@ DiskSliceSize=1457664
 <keyword value="x64" />
 <keyword value="IA-64" />
 <keyword value="Itanium" />
-<setupvalid>One or more of the following, separated by spaces: <br/><tt>x64</tt> <br/><tt>ia64</tt></setupvalid>
+<keyword value="ARM64" />
+<setupvalid>One or more of the following, separated by spaces: <br/><tt>x64</tt> <br/><tt>arm64</tt> <br/><tt>ia64</tt></setupvalid>
 <setupdefault><i>(blank)</i></setupdefault>
 <body>
 <p>Specifies the 64-bit processor architecture(s) on which Setup should install in <link topic="32vs64bitinstalls">64-bit install mode</link>. If this directive is not specified or is blank, Setup will always install in <link topic="32vs64bitinstalls">32-bit install mode</link>.</p>
@@ -5040,7 +5041,6 @@ DiskSliceSize=1457664
 <p>Be sure you have read the <link topic="64bitlimitations">64-bit Installation Limitations</link> topic before setting this directive.</p>
 <p>If your application runs only on 64-bit processor architectures, you should set <link topic="setup_architecturesallowed">ArchitecturesAllowed</link> to the same value as this directive to prevent Setup from running on 32-bit Windows.</p>
 <p>Setup can only run in 64-bit install mode on versions of Windows that provide the API support Inno Setup requires (e.g. RegDeleteKeyEx). All x64 editions provide the necessary APIs, however Itanium editions prior to Windows Server 2003 SP1 do not. If the user is running an older Itanium version of Windows, Setup will display a message (<tt>MissingWOW64APIs</tt>) recommending that the user install a service pack, and exit.</p>
-<p><i>Note:</i> Windows 10 on ARM64 only supports 32-bit (x86) binaries. Therefore Setup will never install in <link topic="32vs64bitinstalls">64-bit install mode</link> on Windows 10 on ARM64.</p>
 <p><b>See also:</b><br/>
 <link topic="setup_architecturesallowed">ArchitecturesAllowed</link></p>
 </body>

+ 1 - 4
Projects/Compile.pas

@@ -3696,10 +3696,7 @@ var
              Include(Result, paX86);
         1: Include(Result, paX64);
         2: Include(Result, paIA64);
-        3: if Only64Bit then
-             Invalid //ARM64 can actually only run x86 binaries
-           else
-             Include(Result, paARM64);
+        3: Include(Result, paARM64);
       end;
   end;
 

+ 53 - 28
Projects/Main.pas

@@ -4361,50 +4361,75 @@ const
   PROCESSOR_ARCHITECTURE_IA64 = 6;
   PROCESSOR_ARCHITECTURE_AMD64 = 9;
   PROCESSOR_ARCHITECTURE_ARM64 = 12;
+  IMAGE_FILE_MACHINE_I386 = $014c;
+  IMAGE_FILE_MACHINE_IA64 = $0200;
+  IMAGE_FILE_MACHINE_AMD64 = $8664;
+  IMAGE_FILE_MACHINE_ARM64 = $AA64;
 var
   KernelModule: HMODULE;
   GetNativeSystemInfoFunc: procedure(var lpSystemInfo: TSystemInfo); stdcall;
   IsWow64ProcessFunc: function(hProcess: THandle; var Wow64Process: BOOL): BOOL; stdcall;
+  IsWow64Process2Func: function(hProcess: THandle; var pProcessMachine, pNativeMachine: USHORT): BOOL; stdcall;
+  ProcessMachine, NativeMachine: USHORT;
   Wow64Process: BOOL;
   SysInfo: TSystemInfo;
 begin
   { The system is considered a "Win64" system if all of the following
     conditions are true:
-    1. GetNativeSystemInfo is available.
-    2. IsWow64Process is available, and returns True for the current process.
-    3. Wow64DisableWow64FsRedirection is available.
-    4. Wow64RevertWow64FsRedirection is available.
-    5. GetSystemWow64DirectoryA is available.
-    6. RegDeleteKeyExA is available.
+    1. One of the following two is true:
+       a. IsWow64Process2 is available, and returns True for the current process.
+       b. GetNativeSystemInfo is available +
+          IsWow64Process is available, and returns True for the current process.
+    2. Wow64DisableWow64FsRedirection is available.
+    3. Wow64RevertWow64FsRedirection is available.
+    4. GetSystemWow64DirectoryA is available.
+    5. RegDeleteKeyExA is available.
     The system does not have to be one of the known 64-bit architectures
-    (AMD64, IA64) to be considered a "Win64" system. }
+    (AMD64, IA64, ARM64) to be considered a "Win64" system. }
 
   IsWin64 := False;
   KernelModule := GetModuleHandle(kernel32);
-  GetNativeSystemInfoFunc := GetProcAddress(KernelModule, 'GetNativeSystemInfo');
-  if Assigned(GetNativeSystemInfoFunc) then begin
-    GetNativeSystemInfoFunc(SysInfo);
-    IsWow64ProcessFunc := GetProcAddress(KernelModule, 'IsWow64Process');
-    if Assigned(IsWow64ProcessFunc) and
-       IsWow64ProcessFunc(GetCurrentProcess, Wow64Process) and
-      Wow64Process then begin
-      if AreFsRedirectionFunctionsAvailable and
-         (GetProcAddress(KernelModule, 'GetSystemWow64DirectoryA') <> nil) and
-        (GetProcAddress(GetModuleHandle(advapi32), 'RegDeleteKeyExA') <> nil) then
-        IsWin64 := True;
+
+  IsWow64Process2Func := GetProcAddress(KernelModule, 'IsWow64Process2');
+  if Assigned(IsWow64Process2Func) and
+     IsWow64Process2Func(GetCurrentProcess, ProcessMachine, NativeMachine) and
+     (ProcessMachine <> IMAGE_FILE_MACHINE_UNKNOWN) then begin
+    IsWin64 := True;
+    case NativeMachine of
+      IMAGE_FILE_MACHINE_I386: ProcessorArchitecture := paX86;
+      IMAGE_FILE_MACHINE_IA64: ProcessorArchitecture := paIA64;
+      IMAGE_FILE_MACHINE_AMD64: ProcessorArchitecture := paX64;
+      IMAGE_FILE_MACHINE_ARM64: ProcessorArchitecture := paARM64;
+    else
+      ProcessorArchitecture := paUnknown;
     end;
-  end
-  else
-    GetSystemInfo(SysInfo);
+  end else begin
+    GetNativeSystemInfoFunc := GetProcAddress(KernelModule, 'GetNativeSystemInfo');
+    if Assigned(GetNativeSystemInfoFunc) then begin
+      GetNativeSystemInfoFunc(SysInfo);
+      IsWow64ProcessFunc := GetProcAddress(KernelModule, 'IsWow64Process');
+      if Assigned(IsWow64ProcessFunc) and
+         IsWow64ProcessFunc(GetCurrentProcess, Wow64Process) and
+         Wow64Process then
+        IsWin64 := True;
+    end else
+      GetSystemInfo(SysInfo);
 
-  case SysInfo.wProcessorArchitecture of
-    PROCESSOR_ARCHITECTURE_INTEL: ProcessorArchitecture := paX86;
-    PROCESSOR_ARCHITECTURE_IA64: ProcessorArchitecture := paIA64;
-    PROCESSOR_ARCHITECTURE_AMD64: ProcessorArchitecture := paX64;
-    PROCESSOR_ARCHITECTURE_ARM64: ProcessorArchitecture := paARM64;
-  else
-    ProcessorArchitecture := paUnknown;
+    case SysInfo.wProcessorArchitecture of
+      PROCESSOR_ARCHITECTURE_INTEL: ProcessorArchitecture := paX86;
+      PROCESSOR_ARCHITECTURE_IA64: ProcessorArchitecture := paIA64;
+      PROCESSOR_ARCHITECTURE_AMD64: ProcessorArchitecture := paX64;
+      PROCESSOR_ARCHITECTURE_ARM64: ProcessorArchitecture := paARM64;
+    else
+      ProcessorArchitecture := paUnknown;
+    end;
   end;
+
+  if IsWin64 and
+     not (AreFsRedirectionFunctionsAvailable and
+          (GetProcAddress(KernelModule, 'GetSystemWow64DirectoryA') <> nil) and
+          (GetProcAddress(GetModuleHandle(advapi32), 'RegDeleteKeyExA') <> nil)) then
+    IsWin64 := False;
 end;
 
 procedure InitWindowsVersion;

+ 2 - 0
setup.iss

@@ -147,10 +147,12 @@ Source: "Examples\Example2.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion
 Source: "Examples\Example3.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\64Bit.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\64BitTwoArch.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
+Source: "Examples\64BitThreeArch.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\Components.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\Languages.iss"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\MyProg.exe"; DestDir: "{app}\Examples"; Flags: ignoreversion signonce touch
 Source: "Examples\MyProg-x64.exe"; DestDir: "{app}\Examples"; Flags: ignoreversion signonce touch
+Source: "Examples\MyProg-ARM64.exe"; DestDir: "{app}\Examples"; Flags: ignoreversion signonce touch
 Source: "Examples\MyProg.chm"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\Readme.txt"; DestDir: "{app}\Examples"; Flags: ignoreversion touch
 Source: "Examples\Readme-Dutch.txt"; DestDir: "{app}\Examples"; Flags: ignoreversion touch

+ 2 - 0
whatsnew.htm

@@ -79,6 +79,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
   <li><b>Change in default behavior:</b> Starting with Inno Setup 6 there's only one version available: Unicode Inno Setup. Unicode Inno Setup has been available for 9 years but in case you have not yet updated to it: please see the <a href="http://www.jrsoftware.org/is6help/index.php?topic=unicode">Unicode Inno Setup</a> topic in the help file for more information. Basically, unless you're using [Code] to make DLL calls with string parameters you shouldn't have to make any changes to your script.</li>
 </ul>
 <ul>
+  <li>Added support for 64-bit mode on Windows 10 on ARM64 which can be used to install ARM64 binaries. See the <i>64BitThreeArch.iss</i> example script for an example which demonstrates how to install a program built for three different architectures (x86, x64, ARM64) using a single installer.</li>
   <li>Added new [Setup] section directive: <tt>VersionInfoOriginalFileName</tt>, which sets the original filename version value.</li>
   <li>The <tt>Permissions</tt> parameter supported by [Files], [Dirs] and [Registry] entries now also allows you to grant permission to the Guests group, the Local Service account, the Network Service account, and to the Creator Owner.</li>
   <li>Added new special-purpose <i>HelpTextNote</i> message that can be used to specify one or more lines of text that are added to the list of parameters in the summary shown when passing /HELP on the command line. This message defaults to an empty string so make sure to provide a non-empty default for all languages from your main script if you want to use it.</li>
@@ -102,6 +103,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
     <li>Added new <tt>SameStr</tt> and <tt>SameText</tt> support functions.</li>
     <li>Renamed the <tt>IsAdminLoggedOn</tt> support function to <tt>IsAdmin</tt>. The old name is still supported, but it is recommended to update your scripts to the new name and the compiler will issue a warning if you don't.</li>
     <li>Removed the <tt>TAlphaBitmap</tt> support class. Its functionality is now provided directly by <tt>TBitmap</tt>.</li>
+    <li>Fix: On Windows 10 on ARM64, the <tt>IsWin64</tt> support function now correctly returns <tt>True</tt>, and the <tt>ProcessorArchitecture</tt> support function now correctly returns <tt>paARM64</tt>.</li>
   </ul>
   </li>
   <li>Inno Setup Preprocessor (ISPP) changes: