Skip to content

Commit

Permalink
[svrplus] svrplus.c: Register for arm64 and arm64ec on Win11 build 21…
Browse files Browse the repository at this point in the history
…262 or later; for earlier versions, only arm64.

ARM64EC was added at the same time as general amd64 emulation in
Windows 11 build 21277 (actually 21262, a leaked build).

On Windows 10, don't register for either amd64 or arm64ec.

See #398: Installing on ARM64 shows an error that the AMD64 version
of the DLL couldn't be registered
Reported by @kristibektashi.
  • Loading branch information
GerbilSoft committed Dec 3, 2023
1 parent 67b360b commit d95cafb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@
* Windows: The "xattr" tab now respects the LC_ALL and/or LC_MESSAGES
environment variable to allow for easier multi-language testing.
* Windows: On ARM64 Windows 11, register for i386, arm64, and arm64ec.
* On ARM64 Windows 10, only register amd64 if using build 21277 or later.
* Fixes Fixes #398: Installing on ARM64 shows an error that the AMD64 version of the DLL couldn't be registered
* Only if using build 21262 or later. (RTM is 22000)
* On earlier versions, only arm64 will be registered, since ARM64EC
was added at the same time as amd64 emulation.
* Fixes #398: Installing on ARM64 shows an error that the AMD64 version of the DLL couldn't be registered
* Reported by @kristibektashi.

## v2.2.1 (released 2023/07/30)
Expand Down
7 changes: 4 additions & 3 deletions src/libwin32common/rp_versionhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ VERSIONHELPERAPI IsWindowsVersionOrGreater_BuildNumberCheck(WORD major, WORD min
VER_BUILDNUMBER, VER_GREATER_EQUAL));
}

VERSIONHELPERAPI IsWindows10Build21277OrGreater(void) {
// Windows 10 Build 21277 on ARM added amd64 emulation.
VERSIONHELPERAPI IsWindows11Build21262OrGreater(void) {
// Windows 11 pre-release Build 21262 on ARM added amd64 emulation.
// NOTE: Officially it was 21277, but 21262 was leaked and supports it too.
// https://blogs.windows.com/windows-insider/2020/12/10/introducing-x64-emulation-in-preview-for-windows-10-on-arm-pcs-to-the-windows-insider-program/
IsWindowsVersionOrGreater_BuildNumberCheck(HIBYTE(0x0A00), LOBYTE(0x0A00), 21277);
IsWindowsVersionOrGreater_BuildNumberCheck(HIBYTE(0x0A00), LOBYTE(0x0A00), 21262);
}

VERSIONHELPERAPI IsWindows11OrGreater(void) {
Expand Down
15 changes: 5 additions & 10 deletions src/svrplus/svrplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,20 +1141,15 @@ static int check_system_architectures(void)
g_archs[g_arch_count++] = CPU_arm;
break;
case CPU_arm64:
// Windows 10 on ARM RTM only supports i386 emulation.
// - Build 21277: Added amd64 emulation.
// - Build 22000 (Win11): Added arm64ec.
// Windows 10 on ARM only supports i386 emulation.
// Windows 11 added amd64 emulation and arm64ec.
// https://blogs.windows.com/windows-insider/2020/12/10/introducing-x64-emulation-in-preview-for-windows-10-on-arm-pcs-to-the-windows-insider-program/
if (IsWindows11OrGreater()) {
// Add arm64 and arm64ec.
if (IsWindows11Build21262OrGreater()) {
// Windows 11 with amd64 emulation: Add arm64 and arm64ec.
g_archs[g_arch_count++] = CPU_arm64;
g_archs[g_arch_count++] = CPU_arm64ec;
} else if (IsWindows10Build21277OrGreater()) {
// Add amd64 and arm64.
g_archs[g_arch_count++] = CPU_amd64;
g_archs[g_arch_count++] = CPU_arm64;
} else {
// Just add arm64.
// Windows 10 with i386 emulation only: Just add arm64.
g_archs[g_arch_count++] = CPU_arm64;
}
break;
Expand Down

0 comments on commit d95cafb

Please sign in to comment.