Skip to content

Commit

Permalink
Separate x86/x64 and ARM64 installers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattiwatti committed Feb 20, 2021
1 parent b46883e commit b0472c3
Show file tree
Hide file tree
Showing 14 changed files with 322 additions and 173 deletions.
2 changes: 1 addition & 1 deletion Src/BUILDME.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Visual Studio 2019 (Community Edition is enough)
- Windows 10 SDK (10.0.19041.0) for Desktop C++
- Visual C++ ATL support
HTML Help Workshop
WiX 3.14
WiX 3.7 (3.14 for ARM64)
7-Zip
It is possible to convert the projects to newer versions of Visual Studio and newer SDKs.
Newer versions of WiX will probably work fine.
Expand Down
2 changes: 1 addition & 1 deletion Src/OpenShell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Global
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Release|Win32.Build.0 = Release|Win32
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Release|x64.ActiveCfg = Release|Win32
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Release|x64.Build.0 = Release|Win32
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Setup|ARM64.ActiveCfg = Release|Win32
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Setup|ARM64.ActiveCfg = Release|ARM64
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Setup|Win32.ActiveCfg = Release|Win32
{A4A4D3B1-24E7-401E-A37C-72141D7603DC}.Setup|x64.ActiveCfg = Release|Win32
{EA65FDDD-CB77-417F-8BB4-2F3ECB5B3E75}.Debug|ARM64.ActiveCfg = Resource|Win32
Expand Down
5 changes: 4 additions & 1 deletion Src/Setup/BuildArchives.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
REM ***** Collect PDBs

echo -- Creating symbols package
set CS_SYMBOLS_NAME=OpenShellPDB_%CS_VERSION_STR%.7z
set CS_SYMBOLS_NAME=OpenShellPDB_%CS_VERSION_STR%
if %ARCH%==ARM64 set CS_SYMBOLS_NAME=%CS_SYMBOLS_NAME%_ARM64
set CS_SYMBOLS_NAME=%CS_SYMBOLS_NAME%.7z

if exist Final\%CS_SYMBOLS_NAME% del Final\%CS_SYMBOLS_NAME% > nul
7z a -mx9 .\Final\%CS_SYMBOLS_NAME% .\Output\symbols\* > nul

if defined APPVEYOR (
Expand Down
120 changes: 65 additions & 55 deletions Src/Setup/BuildBinaries.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ echo -- Compiling

for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do set MSBuildDir=%%i\MSBuild\Current\Bin\

REM ********* Build ARM64 solution
echo --- ARM64
"%MSBuildDir%MSBuild.exe" ..\OpenShell.sln /m /t:Rebuild /p:Configuration="Setup" /p:Platform="ARM64" /verbosity:quiet /nologo
@if ERRORLEVEL 1 exit /b 1

REM ********* Build x64 solution
echo --- x64
"%MSBuildDir%MSBuild.exe" ..\OpenShell.sln /m /t:Rebuild /p:Configuration="Setup" /p:Platform="x64" /verbosity:quiet /nologo
@if ERRORLEVEL 1 exit /b 1
if %ARCH%==ARM64 (
REM ********* Build ARM64 solution
echo --- ARM64
"%MSBuildDir%MSBuild.exe" ..\OpenShell.sln /m /t:Rebuild /p:Configuration="Setup" /p:Platform="ARM64" /verbosity:quiet /nologo
if ERRORLEVEL 1 exit /b 1
) else (
REM ********* Build x64 solution
echo --- x64
"%MSBuildDir%MSBuild.exe" ..\OpenShell.sln /m /t:Rebuild /p:Configuration="Setup" /p:Platform="x64" /verbosity:quiet /nologo
if ERRORLEVEL 1 exit /b 1
)

REM ********* Build 32-bit solution (must be after 64-bit)
echo --- x86
Expand Down Expand Up @@ -48,19 +50,21 @@ copy /B ..\Update\DesktopToasts\Release\DesktopToasts.dll Output > nul
copy /B ..\StartMenu\StartMenuHelper\Setup\StartMenuHelper32.dll Output > nul
copy /B ..\Setup\SetupHelper\Release\SetupHelper.exe Output > nul

copy /B ..\ClassicExplorer\Setup64\ClassicExplorer64.dll Output\x64 > nul
copy /B ..\ClassicIE\Setup64\ClassicIEDLL_64.dll Output\x64 > nul
copy /B ..\ClassicIE\Setup64\ClassicIE_64.exe Output\x64 > nul
copy /B ..\StartMenu\Setup64\StartMenu.exe Output\x64 > nul
copy /B ..\StartMenu\Setup64\StartMenuDLL.dll Output\x64 > nul
copy /B ..\StartMenu\StartMenuHelper\Setup64\StartMenuHelper64.dll Output\x64 > nul

copy /B ..\ClassicExplorer\SetupARM64\ClassicExplorerARM64.dll Output\ARM64 > nul
copy /B ..\ClassicIE\SetupARM64\ClassicIEDLL_ARM64.dll Output\ARM64 > nul
copy /B ..\ClassicIE\SetupARM64\ClassicIE_ARM64.exe Output\ARM64 > nul
copy /B ..\StartMenu\SetupARM64\StartMenu.exe Output\ARM64 > nul
copy /B ..\StartMenu\SetupARM64\StartMenuDLL.dll Output\ARM64 > nul
copy /B ..\StartMenu\StartMenuHelper\SetupARM64\StartMenuHelperARM64.dll Output\ARM64 > nul
if %ARCH%==ARM64 (
copy /B ..\ClassicExplorer\SetupARM64\ClassicExplorerARM64.dll Output\ARM64 > nul
copy /B ..\ClassicIE\SetupARM64\ClassicIEDLL_ARM64.dll Output\ARM64 > nul
copy /B ..\ClassicIE\SetupARM64\ClassicIE_ARM64.exe Output\ARM64 > nul
copy /B ..\StartMenu\SetupARM64\StartMenu.exe Output\ARM64 > nul
copy /B ..\StartMenu\SetupARM64\StartMenuDLL.dll Output\ARM64 > nul
copy /B ..\StartMenu\StartMenuHelper\SetupARM64\StartMenuHelperARM64.dll Output\ARM64 > nul
) else (
copy /B ..\ClassicExplorer\Setup64\ClassicExplorer64.dll Output\x64 > nul
copy /B ..\ClassicIE\Setup64\ClassicIEDLL_64.dll Output\x64 > nul
copy /B ..\ClassicIE\Setup64\ClassicIE_64.exe Output\x64 > nul
copy /B ..\StartMenu\Setup64\StartMenu.exe Output\x64 > nul
copy /B ..\StartMenu\Setup64\StartMenuDLL.dll Output\x64 > nul
copy /B ..\StartMenu\StartMenuHelper\Setup64\StartMenuHelper64.dll Output\x64 > nul
)

copy /B "..\StartMenu\Skins\Classic Skin.skin" Output > nul
copy /B "..\StartMenu\Skins\Full Glass.skin" Output > nul
Expand Down Expand Up @@ -89,31 +93,35 @@ copy /B Output\ClassicExplorer32.dll Output\PDB32 > nul
copy /B ..\ClassicExplorer\Setup\ClassicExplorerSettings.pdb Output\PDB32 > nul
copy /B Output\ClassicExplorerSettings.exe Output\PDB32 > nul

REM Explorer x64
copy /B ..\ClassicExplorer\Setup64\ClassicExplorer64.pdb Output\PDBx64 > nul
copy /B Output\x64\ClassicExplorer64.dll Output\PDBx64 > nul

REM Explorer ARM64
copy /B ..\ClassicExplorer\SetupARM64\ClassicExplorerARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\ClassicExplorerARM64.dll Output\PDBARM64 > nul
if %ARCH%==ARM64 (
REM Explorer ARM64
copy /B ..\ClassicExplorer\SetupARM64\ClassicExplorerARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\ClassicExplorerARM64.dll Output\PDBARM64 > nul
) else (
REM Explorer x64
copy /B ..\ClassicExplorer\Setup64\ClassicExplorer64.pdb Output\PDBx64 > nul
copy /B Output\x64\ClassicExplorer64.dll Output\PDBx64 > nul
)

REM IE 32
copy /B ..\ClassicIE\Setup\ClassicIEDLL_32.pdb Output\PDB32 > nul
copy /B Output\ClassicIEDLL_32.dll Output\PDB32 > nul
copy /B ..\ClassicIE\Setup\ClassicIE_32.pdb Output\PDB32 > nul
copy /B Output\ClassicIE_32.exe Output\PDB32 > nul

REM IE x64
copy /B ..\ClassicIE\Setup64\ClassicIEDLL_64.pdb Output\PDBx64 > nul
copy /B Output\x64\ClassicIEDLL_64.dll Output\PDBx64 > nul
copy /B ..\ClassicIE\Setup64\ClassicIE_64.pdb Output\PDBx64 > nul
copy /B Output\x64\ClassicIE_64.exe Output\PDBx64 > nul

REM IE ARM64
copy /B ..\ClassicIE\SetupARM64\ClassicIEDLL_ARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\ClassicIEDLL_ARM64.dll Output\PDBARM64 > nul
copy /B ..\ClassicIE\SetupARM64\ClassicIE_ARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\ClassicIE_ARM64.exe Output\PDBARM64 > nul
if %ARCH%==ARM64 (
REM IE ARM64
copy /B ..\ClassicIE\SetupARM64\ClassicIEDLL_ARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\ClassicIEDLL_ARM64.dll Output\PDBARM64 > nul
copy /B ..\ClassicIE\SetupARM64\ClassicIE_ARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\ClassicIE_ARM64.exe Output\PDBARM64 > nul
) else (
REM IE x64
copy /B ..\ClassicIE\Setup64\ClassicIEDLL_64.pdb Output\PDBx64 > nul
copy /B Output\x64\ClassicIEDLL_64.dll Output\PDBx64 > nul
copy /B ..\ClassicIE\Setup64\ClassicIE_64.pdb Output\PDBx64 > nul
copy /B Output\x64\ClassicIE_64.exe Output\PDBx64 > nul
)

REM Menu 32
copy /B ..\StartMenu\Setup\StartMenu.pdb Output\PDB32 > nul
Expand All @@ -127,21 +135,23 @@ copy /B Output\Update.exe Output\PDB32 > nul
copy /B ..\Update\DesktopToasts\Release\DesktopToasts.pdb Output\PDB32 > nul
copy /B Output\DesktopToasts.dll Output\PDB32 > nul

REM Menu x64
copy /B ..\StartMenu\Setup64\StartMenu.pdb Output\PDBx64 > nul
copy /B Output\x64\StartMenu.exe Output\PDBx64 > nul
copy /B ..\StartMenu\Setup64\StartMenuDLL.pdb Output\PDBx64 > nul
copy /B Output\x64\StartMenuDLL.dll Output\PDBx64 > nul
copy /B ..\StartMenu\StartMenuHelper\Setup64\StartMenuHelper64.pdb Output\PDBx64 > nul
copy /B Output\x64\StartMenuHelper64.dll Output\PDBx64 > nul

REM Menu ARM64
copy /B ..\StartMenu\SetupARM64\StartMenu.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\StartMenu.exe Output\PDBARM64 > nul
copy /B ..\StartMenu\SetupARM64\StartMenuDLL.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\StartMenuDLL.dll Output\PDBARM64 > nul
copy /B ..\StartMenu\StartMenuHelper\SetupARM64\StartMenuHelperARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\StartMenuHelperARM64.dll Output\PDBARM64 > nul
if %ARCH%==ARM64 (
REM Menu ARM64
copy /B ..\StartMenu\SetupARM64\StartMenu.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\StartMenu.exe Output\PDBARM64 > nul
copy /B ..\StartMenu\SetupARM64\StartMenuDLL.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\StartMenuDLL.dll Output\PDBARM64 > nul
copy /B ..\StartMenu\StartMenuHelper\SetupARM64\StartMenuHelperARM64.pdb Output\PDBARM64 > nul
copy /B Output\ARM64\StartMenuHelperARM64.dll Output\PDBARM64 > nul
) else (
REM Menu x64
copy /B ..\StartMenu\Setup64\StartMenu.pdb Output\PDBx64 > nul
copy /B Output\x64\StartMenu.exe Output\PDBx64 > nul
copy /B ..\StartMenu\Setup64\StartMenuDLL.pdb Output\PDBx64 > nul
copy /B Output\x64\StartMenuDLL.dll Output\PDBx64 > nul
copy /B ..\StartMenu\StartMenuHelper\Setup64\StartMenuHelper64.pdb Output\PDBx64 > nul
copy /B Output\x64\StartMenuHelper64.dll Output\PDBx64 > nul
)

REM ********* Source Index PDBs

Expand Down
86 changes: 48 additions & 38 deletions Src/Setup/BuildInstaller.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ echo -- Building Installer (%CS_LANG_NAME_SHORT%)

SET CS_INSTALLER_NAME=OpenShellSetup_%CS_VERSION_STR%-%CS_LANG_NAME_SHORT%
if %CS_LANG_NAME_SHORT%==en SET CS_INSTALLER_NAME=OpenShellSetup_%CS_VERSION_STR%
if %ARCH%==ARM64 SET CS_INSTALLER_NAME=%CS_INSTALLER_NAME%_ARM64

SET CS_SETUP_ARCH=Win32
if %ARCH%==ARM64 SET CS_SETUP_ARCH=ARM64

SET CS_SETUP_DIR=Release
if %ARCH%==ARM64 SET CS_SETUP_DIR=%CS_SETUP_DIR%ARM64

if exist Temp rd /Q /S Temp
md Temp
Expand All @@ -36,58 +43,61 @@ md Temp
@set /a "CS_VERSION_NUM=%%A<<24|%%B<<16|%%C"
)

REM ********* Build x86 MSI
echo --- x86 MSI
candle Setup.wxs -nologo -out Temp\Setup32.wixobj -ext WixUIExtension -ext WixUtilExtension -dx64=0 -dARM64=0 -dCS_LANG_FOLDER=%CS_LANG_FOLDER% -dCS_LANG_NAME=%CS_LANG_NAME%
@if ERRORLEVEL 1 exit /b 1

@REM We need to suppress ICE38 and ICE43 because they apply only to per-user installation. We only support per-machine installs
@REM We need to suppress ICE09 because the helper DLLs need to go into the system directory (for safety reasons)
light Temp\Setup32.wixobj -nologo -out Temp\Setup32.msi -ext WixUIExtension -ext WixUtilExtension -loc ..\Localization\%CS_LANG_FOLDER%\OpenShellText-%CS_LANG_NAME%.wxl -loc ..\Localization\%CS_LANG_FOLDER%\WixUI_%CS_LANG_NAME%.wxl -sice:ICE38 -sice:ICE43 -sice:ICE09
@if ERRORLEVEL 1 exit /b 1


REM ********* Build x64 MSI
echo --- x64 MSI
candle Setup.wxs -nologo -out Temp\Setup64.wixobj -ext WixUIExtension -ext WixUtilExtension -dx64=1 -dARM64=0 -dCS_LANG_FOLDER=%CS_LANG_FOLDER% -dCS_LANG_NAME=%CS_LANG_NAME%
@if ERRORLEVEL 1 exit /b 1

@REM We need to suppress ICE38 and ICE43 because they apply only to per-user installation. We only support per-machine installs
@REM We need to suppress ICE09 because the helper DLLs need to go into the system directory (for safety reasons)
light Temp\Setup64.wixobj -nologo -out Temp\Setup64.msi -ext WixUIExtension -ext WixUtilExtension -loc ..\Localization\%CS_LANG_FOLDER%\OpenShellText-%CS_LANG_NAME%.wxl -loc ..\Localization\%CS_LANG_FOLDER%\WixUI_%CS_LANG_NAME%.wxl -sice:ICE38 -sice:ICE43 -sice:ICE09
@if ERRORLEVEL 1 exit /b 1


REM ********* Build ARM64 MSI
echo --- ARM64 MSI
candle Setup.wxs -nologo -out Temp\SetupARM64.wixobj -ext WixUIExtension -ext WixUtilExtension -dx64=0 -dARM64=1 -dCS_LANG_FOLDER=%CS_LANG_FOLDER% -dCS_LANG_NAME=%CS_LANG_NAME%
@if ERRORLEVEL 1 exit /b 1

@REM We need to suppress ICE38 and ICE43 because they apply only to per-user installation. We only support per-machine installs
@REM We need to suppress ICE09 because the helper DLLs need to go into the system directory (for safety reasons)
light Temp\SetupARM64.wixobj -nologo -out Temp\SetupARM64.msi -ext WixUIExtension -ext WixUtilExtension -loc ..\Localization\%CS_LANG_FOLDER%\OpenShellText-%CS_LANG_NAME%.wxl -loc ..\Localization\%CS_LANG_FOLDER%\WixUI_%CS_LANG_NAME%.wxl -sice:ICE38 -sice:ICE43 -sice:ICE09
@if ERRORLEVEL 1 exit /b 1

if %ARCH%==ARM64 (
REM ********* Build ARM64 MSI
echo --- ARM64 MSI
candle Setup.wxs -nologo -out Temp\SetupARM64.wixobj -ext WixUIExtension -ext WixUtilExtension -dx64=0 -dARM64=1 -dCS_LANG_FOLDER=%CS_LANG_FOLDER% -dCS_LANG_NAME=%CS_LANG_NAME%
if ERRORLEVEL 1 exit /b 1

REM We need to suppress ICE38 and ICE43 because they apply only to per-user installation. We only support per-machine installs
REM We need to suppress ICE09 because the helper DLLs need to go into the system directory (for safety reasons)
light Temp\SetupARM64.wixobj -nologo -out Temp\SetupARM64.msi -ext WixUIExtension -ext WixUtilExtension -loc ..\Localization\%CS_LANG_FOLDER%\OpenShellText-%CS_LANG_NAME%.wxl -loc ..\Localization\%CS_LANG_FOLDER%\WixUI_%CS_LANG_NAME%.wxl -sice:ICE38 -sice:ICE43 -sice:ICE09
if ERRORLEVEL 1 exit /b 1
) else (
REM ********* Build x86 MSI
echo --- x86 MSI
candle Setup.wxs -nologo -out Temp\Setup32.wixobj -ext WixUIExtension -ext WixUtilExtension -dx64=0 -dARM64=0 -dCS_LANG_FOLDER=%CS_LANG_FOLDER% -dCS_LANG_NAME=%CS_LANG_NAME%
if ERRORLEVEL 1 exit /b 1

REM We need to suppress ICE38 and ICE43 because they apply only to per-user installation. We only support per-machine installs
REM We need to suppress ICE09 because the helper DLLs need to go into the system directory (for safety reasons)
light Temp\Setup32.wixobj -nologo -out Temp\Setup32.msi -ext WixUIExtension -ext WixUtilExtension -loc ..\Localization\%CS_LANG_FOLDER%\OpenShellText-%CS_LANG_NAME%.wxl -loc ..\Localization\%CS_LANG_FOLDER%\WixUI_%CS_LANG_NAME%.wxl -sice:ICE38 -sice:ICE43 -sice:ICE09
if ERRORLEVEL 1 exit /b 1

REM ********* Build x64 MSI
echo --- x64 MSI
candle Setup.wxs -nologo -out Temp\Setup64.wixobj -ext WixUIExtension -ext WixUtilExtension -dx64=1 -dARM64=0 -dCS_LANG_FOLDER=%CS_LANG_FOLDER% -dCS_LANG_NAME=%CS_LANG_NAME%
if ERRORLEVEL 1 exit /b 1

REM We need to suppress ICE38 and ICE43 because they apply only to per-user installation. We only support per-machine installs
REM We need to suppress ICE09 because the helper DLLs need to go into the system directory (for safety reasons)
light Temp\Setup64.wixobj -nologo -out Temp\Setup64.msi -ext WixUIExtension -ext WixUtilExtension -loc ..\Localization\%CS_LANG_FOLDER%\OpenShellText-%CS_LANG_NAME%.wxl -loc ..\Localization\%CS_LANG_FOLDER%\WixUI_%CS_LANG_NAME%.wxl -sice:ICE38 -sice:ICE43 -sice:ICE09
if ERRORLEVEL 1 exit /b 1
)

REM ********* Build MSI Checksums
echo --- MSI Checksums
Utility\Release\Utility.exe crcmsi Temp
if %ARCH%==ARM64 (
Utility\Release\Utility.exe crcarm64msi Temp
) else (
Utility\Release\Utility.exe crcmsi Temp
)
@if ERRORLEVEL 1 exit /b 1

REM ********* Build bootstrapper
echo --- Bootstrapper
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do set MSBuildDir=%%i\MSBuild\Current\Bin\

"%MSBuildDir%MSBuild.exe" Setup.sln /m /t:Rebuild /p:Configuration="Release" /p:Platform="Win32" /verbosity:quiet /nologo
"%MSBuildDir%MSBuild.exe" Setup.sln /m /t:Rebuild /p:Configuration="Release" /p:Platform="%CS_SETUP_ARCH%" /verbosity:quiet /nologo
@if ERRORLEVEL 1 exit /b 1

if exist Final rd /Q /S Final
md Final
if exist Final\%CS_INSTALLER_NAME%.exe del Final\%CS_INSTALLER_NAME%.exe > nul
md Final 1> nul 2>&1

copy /B Release\Setup.exe Final\%CS_INSTALLER_NAME%.exe > nul
copy /B %CS_SETUP_DIR%\Setup.exe Final\%CS_INSTALLER_NAME%.exe > nul

if defined APPVEYOR (
appveyor PushArtifact Release\Setup.exe -FileName %CS_INSTALLER_NAME%.exe
appveyor PushArtifact %CS_SETUP_DIR%\Setup.exe -FileName %CS_INSTALLER_NAME%.exe
)

SET CS_LANG_FOLDER=
Expand Down
17 changes: 9 additions & 8 deletions Src/Setup/Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "StringUtils.h"
#include "FNVHash.h"

// Setup.exe is a bootstrap application that contains installers for x86, x64 and ARM64.
// Setup.exe is a bootstrap application that contains installers for x86 and x64 or ARM64.
// It unpacks the right installer into the temp directory and executes it.

typedef BOOL (WINAPI *FIsWow64Process)( HANDLE hProcess, PBOOL Wow64Process );
Expand Down Expand Up @@ -81,13 +81,13 @@ static int ExtractMsi( HINSTANCE hInstance, const wchar_t *msiName, ExtractType
}
return ERR_HASH_NOTFOUND;
}
unsigned int hash0=((unsigned int*)pRes)[extractType==ARM64?2:extractType==x64?1:0];
unsigned int hash0=((unsigned int*)pRes)[extractType==x64?1:0];
const Chunk *pChunks=NULL;
int chunkCount=0;
if (extractType==x64)
{
chunkCount=((unsigned int*)pRes)[3];
pChunks=(Chunk*)((unsigned int*)pRes+4);
chunkCount=((unsigned int*)pRes)[2];
pChunks=(Chunk*)((unsigned int*)pRes+3);
}

// extract the installer
Expand All @@ -98,7 +98,7 @@ static int ExtractMsi( HINSTANCE hInstance, const wchar_t *msiName, ExtractType
HGLOBAL hRes=LoadResource(hInstance,hResInfo);
pRes32=(unsigned char*)LockResource(hRes);
}
if (!pRes32)
if (!pRes32 && extractType!=ARM64)
{
if (!bQuiet)
{
Expand Down Expand Up @@ -340,9 +340,10 @@ int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCm

// Use IsWow64Process2 if it's available (Windows 10 1511+), otherwise fall back to IsWow64Process
FIsWow64Process2 isWow64Process2=(FIsWow64Process2)GetProcAddress(hKernel32,"IsWow64Process2");
USHORT processMachine = 0;
if (isWow64Process2)
{
USHORT processMachine = 0, nativeMachine = 0;
USHORT nativeMachine = 0;
isWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine);
extractType=nativeMachine==IMAGE_FILE_MACHINE_AMD64?x64:nativeMachine==IMAGE_FILE_MACHINE_ARM64?ARM64:x86;
}
Expand Down Expand Up @@ -373,15 +374,15 @@ int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCm

// On ARM64 we must launch msiexec.exe from system32 and not syswow64 as would otherwise happen
PVOID wow64FsRedirVal=NULL;
if (extractType == ARM64)
if (extractType == ARM64 && processMachine != IMAGE_FILE_MACHINE_ARM64)
Wow64DisableWow64FsRedirection(&wow64FsRedirVal);

// start the installer
STARTUPINFO startupInfo={sizeof(startupInfo)};
PROCESS_INFORMATION processInfo;
memset(&processInfo,0,sizeof(processInfo));
BOOL ret=CreateProcess(NULL,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&startupInfo,&processInfo);
if (extractType == ARM64)
if (extractType == ARM64 && processMachine != IMAGE_FILE_MACHINE_ARM64)
Wow64RevertWow64FsRedirection(wow64FsRedirVal);
if (!ret)
{
Expand Down
3 changes: 3 additions & 0 deletions Src/Setup/Setup.rc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ END
// MSI_FILE
//

#if defined(_M_AMD64) || defined(_M_IX86)
IDR_MSI_FILE32 MSI_FILE "Temp\\Setup32.msi_"
IDR_MSI_FILE64 MSI_FILE "Temp\\Setup64.msi_"
#elif defined(_M_ARM64)
IDR_MSI_FILEARM64 MSI_FILE "Temp\\SetupARM64.msi_"
#endif
IDR_MSI_CHECKSUM MSI_FILE "msichecksum.bin"


Expand Down

0 comments on commit b0472c3

Please sign in to comment.