Can Inno Setup detect Windows11 on ARM64 hardware which can emulate x64? - inno-setup

Windows 11 supports emulating x64 hardware whilst actually running on an ARM64 platform. An example of this would be running Windows inside a virtual machine on a Mac.
Previously my Inno installer was just using the following to ensure that the PC was capable of running our software:
ArchitecturesAllowed=x64
However on an ARM-based system like the example given this causes the setup to terminate because it (rightly) sees arm64 as the architecture.
I can't just add arm64 to that line because that won't distinguish between older ARM-based systems which have no x64 emulation capability and those that do.
Hopefully, in the Inno Setup Google Group this topic was discussed as follows:
Jordan Russell Oct 4, 2021, 5:45:40 PM
...
If they were to switch to "ArchitecturesInstall64BitMode=x64 arm64",
then you should get the x64 files. Unfortunately, however, the x64
files would also be installed on older ARM64 builds that don't support
x64 emulation, resulting in a non-functioning app.
...
I do still plan, though, to add official support for detecting x64
emulation in the near future. A new architecture identifier
"x64compatible" will match both x64 Windows and ARM64 Windows with x64
emulation support, and an IsX64Compatible function will also be added.
To encourage adoption of "x64compatible" so that more x64 apps can be
installed on ARM64, the existing "x64" will be deprecated and renamed
to "x64strict", and later on the compiler will print a warning when
"x64" is used.
However the relevant Inno documentation sections don't seem to have any mention of this. (https://jrsoftware.org/ishelp/index.php?topic=setup_architecturesallowed,
https://jrsoftware.org/ishelp/index.php?topic=isxfunc_isarm64)
Is there any built-in way to do it?
If not I may have to try some direct system calls such as those mentioned in How to detect if Windows supports running x64 processes?.

As the question you have linked shows, you can call GetMachineTypeAttributes WinAPI function on Windows 11 to determine x64 support. On older versions of Windows, use ProcessorArchitecture Inno Setup support function
Something like this should do (but I do not have ARM64 machine to test this on).
[Code]
const
IMAGE_FILE_MACHINE_AMD64 = $8664;
function GetMachineTypeAttributes(
Machine: Word; var MachineTypeAttributes: Integer): HRESULT;
external 'GetMachineTypeAttributes#Kernel32.dll stdcall delayload';
<event('InitializeSetup')>
function InitializeSetupCheckArchitecture(): Boolean;
var
MachineTypeAttributes: Integer;
Arch: TSetupProcessorArchitecture;
begin
if IsWindows11OrNewer then
begin
OleCheck(
GetMachineTypeAttributes(IMAGE_FILE_MACHINE_AMD64, MachineTypeAttributes));
if MachineTypeAttributes <> 0 then
begin
Log('Windows 11 or newer, with x64 support');
Result := True;
end
else
begin
Log('Windows 11 or newer, without x64 support');
Result := False;
end;
end
else
begin
Arch := ProcessorArchitecture;
if Arch = paX64 then
begin
Log('Windows 10 or older, on x64 architecture');
Result := True;
end
else
begin
Log('Windows 10 or older, not on x64 architecture');
Result := False;
end;
end;
if not Result then
begin
MsgBox('This product can be installed on system with x64 support only.',
mbError, MB_OK);
end;
end;
The code completely replaces the ArchitecturesAllowed directive (it assumes it is not set, though setting it to x64 arm64 should do no harm).
The IsWindows11OrNewer comes from Determine Windows version in Inno Setup.

Related

NWJS compiling binary for different OS and different arch

I need help in compiling binary files from MacOS to Windows32 & Windows64 bit. In documentation it is written that we need to compile binary according to platform but actual options/parameters are not provided in documentation for it
Got the parameters from nwjc --help section, tried with following but nothing works:
nwjc --target-os win32 --target-arch ia32 nwapp/main.js nwapp/main.bin
nwjc --target-os win32 --target-arch x86_64 nwapp/main.js nwapp/main.bin
nwjc --target-os win32 --target-arch x64 nwapp/main.js nwapp/main.bin
By default, the binary compiled on MacOS is running on 64 bit windows without any target parameters.
Can you give me the parameters and possible values for compiling for Windows32 & Windows 64 from MacOS?
I have got the answer from nwjs gitter group. The answer is:
If you want to compile JS files to v8 binary files for a target
platform, let's suppose Windows 32 bit, then you need to compile them
on the target platform only. You cannot compile binaries for Windows
32 from a different OS (in my case I was trying with MacOS)

os.platform() returns darwin instead of OSX

os.platform();
The above JS instruction returns the name of OS .
When it is runned on Ubuntu , it returns
'linux'
When it is runned on Macbook, it returns
'darwin'
I am wondered why does not return osx ,unix or bsd.. ?
Does darwinis a fork of osx ?
How to get the type of OS under MAC using Node.js ?
Darwin is not OSX, OSX is Darwin.
Darwin is the core of OSX, in the same way, Linux is the core of Debian, Ubuntu, and every other Linux distributions.
So while you can be 100% sure that any Apple product (macOS, OSX, iOS, watchOS, tvOS) will return Darwin, it is technically not correct to assume that darwin will only ever be thoses OSs, since some low profile open source projects exists, like PureDarwin, and thoses would also return darwin.
However, I do not know of any (officials) port of node.js for any other Darwin-based OSs than OSX, so in practice, yes, if you get darwin, you can be confident it is OSX.
Darwin is the underlying platform for OS X.
To get the OS X version instead, you can do this via the command line (or child process) with: defaults read loginwindow SystemVersionStampAsString or sw_vers -productVersion
To get the version via C/C++ (which you could write a binding for to access from node):
// compile with: g++ osx_ver.cc -I/Developer/Headers/FlatCarbon -framework CoreServices
#include <Gestalt.h>
#include <stdio.h>
int main() {
SInt32 majorVersion, minorVersion, bugFixVersion;
Gestalt(gestaltSystemVersionMajor, &majorVersion);
Gestalt(gestaltSystemVersionMinor, &minorVersion);
Gestalt(gestaltSystemVersionBugFix, &bugFixVersion);
printf("%d.%d.%d", majorVersion, minorVersion, bugFixVersion);
return 0;
}
Note: The Gestalt() usage shown above is deprecated since OS X 10.8, but its replacement seemingly isn't available until OS X 10.10, so you may need to use Objective-C instead ([processInfo operatingSystemVersion]) and branch on API availability like what is done here in Chromium.
Darwin was the original name given to OS X by apple. It was named as such because it was the NeXT step in the evolution of operating systems.

Custom setup on operating system and architecture

I have been asked to have a setup procedure running in the following operating systems:
Windows Vista (only x86) and higher (both x86 and x64)
In order to restrict whole setup from running in older operating systems I added into [Setup] section the Minversion=0,6.0.6000 that corresponds to Windows Vista.
I wonder if in Pascal scripting it is possible to apply a conditional installation like the following:
[Run]
Filename: "{tmp}\mysetup.exe"; Components: Install; MinVersion: 0,6.0.6000; Check: not Iswin64;
Filename: "{tmp}\mysetup.exe"; Components: Install; MinVersion: 0,6.1.7600;
This way mysetup.exe should run only on Vista x86 and on all higher operating systems.
Use GetWindowsVersion and IsWin64 support functions:
if ((GetWindowsVersion >= $06000000) {Vista} and (not IsWin64)) or
(GetWindowsVersion >= $06010000) {7} then
begin
// Install
end;
I believe what you are looking for is MinVersion
It's one of the optional parameters that are supported on all sections that support parameters.
Documentation can be found here: http://www.jrsoftware.org/ishelp/index.php?topic=commonparams&anchor=MinVersion

How to force select a newer version of androideabi?

When I build my code, I see that $(NDK)\toolchains\arm-linux-androideabi-4.6 is being used although I have $(NDK)\toolchains\arm-linux-androideabi-4.8 available on my machine.
My understanding is that one should always use the latest androideabi so that the latest gcc compiler can be used. I am wondering why ndk-build is picking up an older version.
Here is my Application.mk for your reference:
APP_ABI := armeabi-v7a
APP_PLATFORM := android-16
APP_OPTIM := release
APP_STL := gnustl_static
APP_CPPFLAGS := -std=gnu++11
The value forAPP_PLATFORMneeds to be android-16 so that we can support Android OS version 4.1 and above. I wonder if androideabi is tied toAPP_PLATFORMvalue.
The issue is not the ABI, but rather the toolchain version.
You can control this in your Android.mk
From the documentation thereof:
NDK_TOOLCHAIN_VERSION
Define this variable to either 4.6, 4.7 or 4.8 to select version of the GCC compiler. 4.6 is the default

ndk-gdb on windows

i m trying to debug my jni section of application by running ngk-gdb on windows machine with android-ndk-r8b.
i am using cygwin and c/c++ plugin for eclipse.my device is galaxy s, android 2.3.7
what i did is followed the instructions on Using Eclipse for Android C/C++ Debugging,
but i am stuck on running ndk-gdb, getting this error:
Device CPU ABIs: armeabi-v7a armeabi
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports:
thx for your help
I encountered the problem recently and in my case it was a cygwin issue. make was not installed in cygwin and this created problems further along in the ndk-gdb script. After installing make using the cygwin setup.exe (select make under Devel - on another recommendation, I also installed tcsh under Shells), the "ABIS targetted by application:" line shows the app's targeted ABI.
Without make:
/cygdrive/c/work/android/android-ndk-r8b-windows/android-ndk-r8b/ndk-gdb: line 105: make: command not found
ABIs targetted by application:
Device API Level: 15
Device CPU ABIs: armeabi-v7a armeabi
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports:
With make properly installed:
ABIs targetted by application: armeabi-v7a
Device API Level: 15
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi-v7a
Application.mk, located in the jni folder, can be used to specify the app's targeted ABI - an example:
APP_ABI := armeabi-v7a
APP_OPTIM := debug
Good luck!
For all others like me with Nexus (devices) updated with Android 4.3 there are bugs that hinder Native code debugging. (I tried everything found on SO :)
Either root your device and try
Or Update nexus 4.3 factory image here (and this is reported working by google android dev)
Or wait for Android 4.4 update to come to your device (as bug is identified and fix in the source tree by Google by not yet packaged
released)

Resources