Skip to content

Commit 58b9090

Browse files
Mattiwattige0rdi
andauthored
Add ARM64 support (#641)
* Add ARM64 build configurations to projects * StartMenu: add ARM64 support * Add support for IAT hooking on ARM64 * Add ARM64 support to Classic IE * Add ARM64 support to installer NB: WiX 3.14.0.3910 or higher is required to create the MSI * Revert whitespace change * Separate x86/x64 and ARM64 installers * Change suffix of ARM64 binaries * Put also ARM64 MSI to final installer * Fix sln * Build some DLLs as ARM64X These are meant to be loaded to both x64 and ARM64 processes. We will compile them as ARM64X (when building for ARM64). That way they will contain both x64 and ARM64 code paths. https://learn.microsoft.com/en-us/windows/arm/arm64x-pe * Make sure x64 installer cannot be installed on ARM64 In case if somebody manually tries to install x64 MSI on ARM64. This is not supported/working scenario. --------- Co-authored-by: ge0rdi <[email protected]>
1 parent 146c27e commit 58b9090

25 files changed

+636
-48
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
# Build results
2121
[Dd]ebug/
2222
[Dd]ebug64/
23+
[Dd]ebugARM64/
2324
[Dd]ebugPublic/
2425
[Rr]elease/
2526
[Rr]elease64/
27+
[Rr]eleaseARM64/
2628
[Rr]eleases/
2729
x64/
2830
x86/
31+
ARM64/
2932
bld/
3033
[Bb]in/
3134
[Oo]bj/

Src/ClassicExplorer/ClassicExplorer.vcxproj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|ARM64EC">
9+
<Configuration>Debug</Configuration>
10+
<Platform>ARM64EC</Platform>
11+
</ProjectConfiguration>
412
<ProjectConfiguration Include="Debug|Win32">
513
<Configuration>Debug</Configuration>
614
<Platform>Win32</Platform>
@@ -9,6 +17,14 @@
917
<Configuration>Debug</Configuration>
1018
<Platform>x64</Platform>
1119
</ProjectConfiguration>
20+
<ProjectConfiguration Include="Release|ARM64">
21+
<Configuration>Release</Configuration>
22+
<Platform>ARM64</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="Release|ARM64EC">
25+
<Configuration>Release</Configuration>
26+
<Platform>ARM64EC</Platform>
27+
</ProjectConfiguration>
1228
<ProjectConfiguration Include="Release|Win32">
1329
<Configuration>Release</Configuration>
1430
<Platform>Win32</Platform>
@@ -17,6 +33,14 @@
1733
<Configuration>Release</Configuration>
1834
<Platform>x64</Platform>
1935
</ProjectConfiguration>
36+
<ProjectConfiguration Include="Setup|ARM64">
37+
<Configuration>Setup</Configuration>
38+
<Platform>ARM64</Platform>
39+
</ProjectConfiguration>
40+
<ProjectConfiguration Include="Setup|ARM64EC">
41+
<Configuration>Setup</Configuration>
42+
<Platform>ARM64EC</Platform>
43+
</ProjectConfiguration>
2044
<ProjectConfiguration Include="Setup|Win32">
2145
<Configuration>Setup</Configuration>
2246
<Platform>Win32</Platform>
@@ -53,6 +77,13 @@
5377
<PropertyGroup Condition="'$(Platform)'=='x64'">
5478
<TargetName>$(ProjectName)64</TargetName>
5579
</PropertyGroup>
80+
<PropertyGroup Condition="'$(Platform)'=='ARM64EC'">
81+
<TargetName>$(ProjectName)64</TargetName>
82+
</PropertyGroup>
83+
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
84+
<TargetName>$(ProjectName)64</TargetName>
85+
<BuildAsX>true</BuildAsX>
86+
</PropertyGroup>
5687
<PropertyGroup>
5788
<IgnoreImportLibrary>true</IgnoreImportLibrary>
5889
</PropertyGroup>

Src/ClassicExplorer/ClassicExplorer.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,4 @@
146146
<Filter>Resource Files</Filter>
147147
</Image>
148148
</ItemGroup>
149-
</Project>
149+
</Project>

Src/ClassicIE/ClassicIE.vcxproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
48
<ProjectConfiguration Include="Debug|Win32">
59
<Configuration>Debug</Configuration>
610
<Platform>Win32</Platform>
@@ -9,6 +13,10 @@
913
<Configuration>Debug</Configuration>
1014
<Platform>x64</Platform>
1115
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|ARM64">
17+
<Configuration>Release</Configuration>
18+
<Platform>ARM64</Platform>
19+
</ProjectConfiguration>
1220
<ProjectConfiguration Include="Release|Win32">
1321
<Configuration>Release</Configuration>
1422
<Platform>Win32</Platform>
@@ -17,6 +25,10 @@
1725
<Configuration>Release</Configuration>
1826
<Platform>x64</Platform>
1927
</ProjectConfiguration>
28+
<ProjectConfiguration Include="Setup|ARM64">
29+
<Configuration>Setup</Configuration>
30+
<Platform>ARM64</Platform>
31+
</ProjectConfiguration>
2032
<ProjectConfiguration Include="Setup|Win32">
2133
<Configuration>Setup</Configuration>
2234
<Platform>Win32</Platform>
@@ -53,6 +65,9 @@
5365
<PropertyGroup Condition="'$(Platform)'=='x64'">
5466
<TargetName>$(ProjectName)_64</TargetName>
5567
</PropertyGroup>
68+
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
69+
<TargetName>$(ProjectName)_64</TargetName>
70+
</PropertyGroup>
5671
<ItemDefinitionGroup>
5772
<ClCompile>
5873
<PrecompiledHeader>NotUsing</PrecompiledHeader>

Src/ClassicIE/ClassicIEDLL/ClassicIEDLL.vcxproj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|ARM64EC">
9+
<Configuration>Debug</Configuration>
10+
<Platform>ARM64EC</Platform>
11+
</ProjectConfiguration>
412
<ProjectConfiguration Include="Debug|Win32">
513
<Configuration>Debug</Configuration>
614
<Platform>Win32</Platform>
@@ -9,6 +17,14 @@
917
<Configuration>Debug</Configuration>
1018
<Platform>x64</Platform>
1119
</ProjectConfiguration>
20+
<ProjectConfiguration Include="Release|ARM64">
21+
<Configuration>Release</Configuration>
22+
<Platform>ARM64</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="Release|ARM64EC">
25+
<Configuration>Release</Configuration>
26+
<Platform>ARM64EC</Platform>
27+
</ProjectConfiguration>
1228
<ProjectConfiguration Include="Release|Win32">
1329
<Configuration>Release</Configuration>
1430
<Platform>Win32</Platform>
@@ -17,6 +33,14 @@
1733
<Configuration>Release</Configuration>
1834
<Platform>x64</Platform>
1935
</ProjectConfiguration>
36+
<ProjectConfiguration Include="Setup|ARM64">
37+
<Configuration>Setup</Configuration>
38+
<Platform>ARM64</Platform>
39+
</ProjectConfiguration>
40+
<ProjectConfiguration Include="Setup|ARM64EC">
41+
<Configuration>Setup</Configuration>
42+
<Platform>ARM64EC</Platform>
43+
</ProjectConfiguration>
2044
<ProjectConfiguration Include="Setup|Win32">
2145
<Configuration>Setup</Configuration>
2246
<Platform>Win32</Platform>
@@ -53,6 +77,13 @@
5377
<PropertyGroup Condition="'$(Platform)'=='x64'">
5478
<TargetName>$(ProjectName)_64</TargetName>
5579
</PropertyGroup>
80+
<PropertyGroup Condition="'$(Platform)'=='ARM64EC'">
81+
<TargetName>$(ProjectName)_64</TargetName>
82+
</PropertyGroup>
83+
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
84+
<TargetName>$(ProjectName)_64</TargetName>
85+
<BuildAsX>true</BuildAsX>
86+
</PropertyGroup>
5687
<ItemDefinitionGroup>
5788
<ClCompile>
5889
<PreprocessorDefinitions>_USRDLL;CLASSICIEDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

Src/ClassicIE/ClassicIEDLL/ClassicIEDLL.vcxproj.filters

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@
9898
<Filter>Resource Files</Filter>
9999
</Image>
100100
</ItemGroup>
101-
</Project>
101+
</Project>

Src/Common.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
<OutDir>$(MSBuildThisFileDirectory)..\build\bin\$(Configuration)64\</OutDir>
1717
<IntDir>$(MSBuildThisFileDirectory)..\build\obj\$(ProjectName)\$(Configuration)64\</IntDir>
1818
</PropertyGroup>
19+
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
20+
<OutDir>$(MSBuildThisFileDirectory)..\build\bin\$(Configuration)ARM64\</OutDir>
21+
<IntDir>$(MSBuildThisFileDirectory)..\build\obj\$(ProjectName)\$(Configuration)ARM64\</IntDir>
22+
</PropertyGroup>
23+
<PropertyGroup Condition="'$(Platform)'=='ARM64EC'">
24+
<OutDir>$(MSBuildThisFileDirectory)..\build\bin\$(Configuration)ARM64EC\</OutDir>
25+
<IntDir>$(MSBuildThisFileDirectory)..\build\obj\$(ProjectName)\$(Configuration)ARM64EC\</IntDir>
26+
</PropertyGroup>
1927

2028
<!-- Common settings for all configurations -->
2129
<ItemDefinitionGroup>

Src/Lib/IatHookHelper.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,17 @@ IatHookData *SetIatHook( IMAGE_DOS_HEADER *dosHeader, DWORD iatOffset, DWORD int
7070
{
7171
IatHookData *hook=g_IatHooks+g_IatHookCount;
7272
g_IatHookCount++;
73+
#if defined(_M_AMD64) || defined(_M_IX86)
7374
hook->jump[0]=hook->jump[1]=0x90; // NOP
7475
hook->jump[2]=0xFF; hook->jump[3]=0x25; // JUMP
75-
#ifdef _WIN64
76+
#if defined(_M_AMD64)
7677
hook->jumpOffs=0;
7778
#else
7879
hook->jumpOffs=(DWORD)(hook)+8;
80+
#endif
81+
#elif defined(_M_ARM64)
82+
hook->jump[0]=0x48; hook->jump[1]=0x00; hook->jump[2]=0x00; hook->jump[3]=0x58; // LDR X8, newProc
83+
hook->jump[4]=0x00; hook->jump[5]=0x01; hook->jump[6]=0x1F; hook->jump[7]=0xD6; // BR X8
7984
#endif
8085
hook->newProc=newProc;
8186
hook->oldProc=(void*)thunk->u1.Function;

Src/Lib/IatHookHelper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
struct IatHookData
88
{
9+
#if defined(_M_AMD64) || defined(_M_IX86)
910
unsigned char jump[4]; // jump instruction 0x90, 0x90, 0xFF, 0x25
1011
DWORD jumpOffs; // jump instruction offset
12+
#elif defined(_M_ARM64)
13+
unsigned char jump[8]; // LDR <address>, BR
14+
#endif
1115
void *newProc; // the address of the new proc
1216
void *oldProc; // the address of the old proc
1317
IMAGE_THUNK_DATA *thunk; // the IAT thunk

Src/Lib/Lib.vcxproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|ARM64EC">
9+
<Configuration>Debug</Configuration>
10+
<Platform>ARM64EC</Platform>
11+
</ProjectConfiguration>
412
<ProjectConfiguration Include="Debug|Win32">
513
<Configuration>Debug</Configuration>
614
<Platform>Win32</Platform>
@@ -9,6 +17,14 @@
917
<Configuration>Debug</Configuration>
1018
<Platform>x64</Platform>
1119
</ProjectConfiguration>
20+
<ProjectConfiguration Include="Release|ARM64">
21+
<Configuration>Release</Configuration>
22+
<Platform>ARM64</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="Release|ARM64EC">
25+
<Configuration>Release</Configuration>
26+
<Platform>ARM64EC</Platform>
27+
</ProjectConfiguration>
1228
<ProjectConfiguration Include="Release|Win32">
1329
<Configuration>Release</Configuration>
1430
<Platform>Win32</Platform>
@@ -42,6 +58,9 @@
4258
<PropertyGroup>
4359
<OutDir>$(IntDir)</OutDir>
4460
</PropertyGroup>
61+
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
62+
<BuildAsX>true</BuildAsX>
63+
</PropertyGroup>
4564
<ItemDefinitionGroup>
4665
<ClCompile>
4766
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>

Src/Localization/English/OpenShellText-en-US.wxl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<WixLocalization Culture="en-US" Codepage="1252" xmlns="http://schemas.microsoft.com/wix/2006/localization">
33
<String Id="Error32bit" Overridable="yes">This installer is only for 32-bit version of Windows. For 64-bit Windows you need to run Setup64.</String>
4+
<String Id="Error64bit" Overridable="yes">This installer is only for 64-bit version of Windows. For ARM64 Windows you need to run SetupARM64.</String>
45
<String Id="ErrorWin7" Overridable="yes">Open-Shell requires Windows 7 or above.</String>
56
<String Id="ErrorNewVersion" Overridable="yes">A newer version of [ProductName] is already installed. The setup will now exit.</String>
67
<String Id="ExplorerTitle" Overridable="yes">Classic Explorer</String>

0 commit comments

Comments
 (0)