From 59493b998ea1506f9356d68cf4711642e87ddaca Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Sat, 14 Mar 2020 23:57:41 +0100 Subject: [PATCH] Enable Windows 10 ARM64 support Signed-off-by: Simon Rozman --- MSI/MSIBuild | 2 +- MSI/MSICA | 2 +- MSI/ZRCola/Main/Makefile | Bin 293064 -> 293540 bytes Makefile | 38 +++++++++++------- MakefileLang.mak | Bin 6664 -> 6810 bytes Updater | 2 +- ZRColaInstall/ZRColaInstall.props | 12 ------ ZRColaInstall/main.cpp | 62 ++++++++++++++++++------------ ZRColaInstall/pch.h | 1 + include/MSIBuildCfg.mak | Bin 9548 -> 9842 bytes 10 files changed, 65 insertions(+), 54 deletions(-) diff --git a/MSI/MSIBuild b/MSI/MSIBuild index e1a0146..538cea0 160000 --- a/MSI/MSIBuild +++ b/MSI/MSIBuild @@ -1 +1 @@ -Subproject commit e1a01465701da2f554e27a9eaccf7a2a5da0f23b +Subproject commit 538cea09453a2ee52f918036f7b2e7b51347d7cc diff --git a/MSI/MSICA b/MSI/MSICA index 1e48c20..757ad14 160000 --- a/MSI/MSICA +++ b/MSI/MSICA @@ -1 +1 @@ -Subproject commit 1e48c204063258c12615033e5bc66fc39c0d081a +Subproject commit 757ad1497554500e2369348455225aa454e2c4e9 diff --git a/MSI/ZRCola/Main/Makefile b/MSI/ZRCola/Main/Makefile index bc278ea3280f0de917c6563dc8ad0552e7fd253f..acf839db00ed46c73bea6b55e3295acdcddc1ad8 100644 GIT binary patch delta 143 zcmX@{QEFEi4ZdSrr&+7;2`+tFg$lIx++?_-?c9x>9%StjtDKq7^;JSs(oOpx3jCW H91H{ieJ&vQ delta 28 kcmZ4TRq(_|!G;#b7N!>FEi4Zdw+kq-xUg>1WLXjj0IOgMP5=M^ diff --git a/Makefile b/Makefile index 8a0e97c..b4ace5e 100644 --- a/Makefile +++ b/Makefile @@ -240,19 +240,25 @@ UnregisterShortcuts :: copy /y $** $@ > NUL "$(OUTPUT_DIR)\catalog.xml" : \ - "$(OUTPUT_DIR)\ZRColaEn32.msi" \ - "$(OUTPUT_DIR)\ZRColaEn64.msi" \ - "$(OUTPUT_DIR)\ZRColaRu32.msi" \ - "$(OUTPUT_DIR)\ZRColaRu64.msi" \ - "$(OUTPUT_DIR)\ZRColaSl32.msi" \ - "$(OUTPUT_DIR)\ZRColaSl64.msi" + "$(OUTPUT_DIR)\ZRColaEn-x86.msi" \ + "$(OUTPUT_DIR)\ZRColaEn-amd64.msi" \ + "$(OUTPUT_DIR)\ZRColaEn-arm64.msi" \ + "$(OUTPUT_DIR)\ZRColaRu-x86.msi" \ + "$(OUTPUT_DIR)\ZRColaRu-amd64.msi" \ + "$(OUTPUT_DIR)\ZRColaRu-arm64.msi" \ + "$(OUTPUT_DIR)\ZRColaSl-x86.msi" \ + "$(OUTPUT_DIR)\ZRColaSl-amd64.msi" \ + "$(OUTPUT_DIR)\ZRColaSl-arm64.msi" copy /y "$(PUBLISH_DIR)\catalog-0001.xml" "$(@:"=).tmp" > NUL - "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-x86 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn32.msi" -f "$(OUTPUT_DIR)\ZRColaEn32.msi" - "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn64.msi" -f "$(OUTPUT_DIR)\ZRColaEn64.msi" - "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-x86 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu32.msi" -f "$(OUTPUT_DIR)\ZRColaRu32.msi" - "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu64.msi" -f "$(OUTPUT_DIR)\ZRColaRu64.msi" - "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-x86 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl32.msi" -f "$(OUTPUT_DIR)\ZRColaSl32.msi" - "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl64.msi" -f "$(OUTPUT_DIR)\ZRColaSl64.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-x86 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn-x86.msi" -f "$(OUTPUT_DIR)\ZRColaEn-x86.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn-amd64.msi" -f "$(OUTPUT_DIR)\ZRColaEn-amd64.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-arm64 en_US "$(PUBLISH_PACKAGE_URL)/ZRColaEn-arm64.msi" -f "$(OUTPUT_DIR)\ZRColaEn-arm64.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-x86 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu-x86.msi" -f "$(OUTPUT_DIR)\ZRColaRu-x86.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu-amd64.msi" -f "$(OUTPUT_DIR)\ZRColaRu-amd64.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-arm64 ru_RU "$(PUBLISH_PACKAGE_URL)/ZRColaRu-arm64.msi" -f "$(OUTPUT_DIR)\ZRColaRu-arm64.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-x86 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl-x86.msi" -f "$(OUTPUT_DIR)\ZRColaSl-x86.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-amd64 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl-amd64.msi" -f "$(OUTPUT_DIR)\ZRColaSl-amd64.msi" + "$(OUTPUT_DIR)\$(PLAT).Release\UpdPublish.exe" "$(@:"=).tmp" "$(@:"=).tmp" win-arm64 sl_SI "$(PUBLISH_PACKAGE_URL)/ZRColaSl-arm64.msi" -f "$(OUTPUT_DIR)\ZRColaSl-arm64.msi" "$(OUTPUT_DIR)\$(PLAT).Release\UpdSignXML.exe" "$(@:"=).tmp" $@ -if exist "$(@:"=).tmp" del /f /q "$(@:"=).tmp" @@ -263,11 +269,15 @@ UnregisterShortcuts :: ###################################################################### PLAT=Win32 -PLAT_SUFFIX=32 +PLAT_SUFFIX=-x86 !INCLUDE "MakefilePlat.mak" PLAT=x64 -PLAT_SUFFIX=64 +PLAT_SUFFIX=-amd64 +!INCLUDE "MakefilePlat.mak" + +PLAT=ARM64 +PLAT_SUFFIX=-arm64 !INCLUDE "MakefilePlat.mak" diff --git a/MakefileLang.mak b/MakefileLang.mak index 029daad224c192a1ee9e853079f3bc8b4a9d96d4..a804f4d817326ceb6599deaf216e0a1696c22997 100644 GIT binary patch delta 61 zcmeA$nPs}cMUq{Yp@PAJ!EEwDN%zTpk_JG2B10}i%H+M0-atMdt0O}YgYV?Il8RuN JB8FU$3;+zz5UKzG delta 23 fcmbPb+F`Q6MUvT=!D#YX$ ..\output\$(Platform).$(Configuration)\ - false - - - false - false - Default - false - - - true - - MultiThreadedDebug diff --git a/ZRColaInstall/main.cpp b/ZRColaInstall/main.cpp index 8213bf9..9fb9234 100644 --- a/ZRColaInstall/main.cpp +++ b/ZRColaInstall/main.cpp @@ -23,35 +23,47 @@ /// /// Main function /// -extern "C" void WinMainCRTStartup() +int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) { - // Load "KERNEL32.DLL". - HMODULE hKernel32 = LoadLibrary(TEXT("KERNEL32.DLL")); - if (!hKernel32) - ExitProcess(1); + UNREFERENCED_PARAMETER(hInstance); + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + UNREFERENCED_PARAMETER(nCmdShow); - // Get IsWow64Process() address. - BOOL (WINAPI *_IsWow64Process)(__in HANDLE hProcess, __out PBOOL Wow64Process) = (BOOL(WINAPI*)(__in HANDLE, __out PBOOL))::GetProcAddress(hKernel32, "IsWow64Process"); + TCHAR szArchProc[MAX_PATH]; + if (!GetEnvironmentVariable(TEXT("PROCESSOR_ARCHITECTURE"), szArchProc, _countof(szArchProc))) + szArchProc[0] = 0; + szArchProc[_countof(szArchProc) - 1] = 0; - BOOL bIs64Bit; -#ifndef _WIN64 - // Determine if this is a 32-bit process under Windows-over-Windows64. - if (_IsWow64Process) { - // See what IsWow64Process() says. - if (!_IsWow64Process(::GetCurrentProcess(), &bIs64Bit)) { - // IsWow64Process() returned an error. Assume not 64-bit Windows. - bIs64Bit = FALSE; - } - } else { - // This platform does not have IsWow64Process(). Therefore, this is definitely not 64-bit Windows. - bIs64Bit = FALSE; + TCHAR szArchWin[MAX_PATH]; + if (!GetEnvironmentVariable(TEXT("PROCESSOR_ARCHITEW6432"), szArchWin, _countof(szArchWin))) + szArchWin[0] = 0; + szArchWin[_countof(szArchWin) - 1] = 0; + + // If PROCESSOR_ARCHITEW6432 is defined, this is a Windows-on-Windows + // guest of some kind. szArchWin is the host's architecture and szArchProc + // is the current process' architecture. + + // If PROCESSOR_ARCHITEW6432 is not defined, then PROCESSOR_ARCHITECTURE + // is both the process and OS architecture. + if (szArchWin[0] == 0) + memcpy_s(szArchWin, sizeof(szArchWin), szArchProc, sizeof(szArchProc)); + + // If PROCESSOR_ARCHITECTURE is not defined, then either we're running on + // Windows 9x or something is messing with the environment. Make the + // Windows 9x assumption. + if (szArchProc[0] == 0) { + memcpy_s(szArchProc, sizeof(szArchProc), TEXT("x86"), sizeof(TEXT("x86"))); + memcpy_s(szArchWin , sizeof(szArchWin ), TEXT("x86"), sizeof(TEXT("x86"))); } -#else - // This is a running 64-bit process. The Windows must be 64 bit then. - bIs64Bit = TRUE; -#endif - FreeLibrary(hKernel32); + LPCTSTR pszPlatSuffix; + if (_tcsicmp(szArchWin, TEXT("amd64")) == 0) + pszPlatSuffix = TEXT("-amd64"); + else if (_tcsicmp(szArchWin, TEXT("arm64")) == 0) + pszPlatSuffix = TEXT("-arm64"); + else + pszPlatSuffix = TEXT("-x86"); // Get temporary folder path. static const LPTSTR pszTempFolderDefault = TEXT(""); @@ -74,7 +86,7 @@ extern "C" void WinMainCRTStartup() LPTSTR pszParams; DWORD_PTR aArgs[] = { (DWORD_PTR)TEXT(ZRCOLA_INSTALL_LANG), - (DWORD_PTR)(bIs64Bit ? TEXT("64") : TEXT("32")), + (DWORD_PTR)pszPlatSuffix, (DWORD_PTR)pszTempFolder, }; FormatMessage( diff --git a/ZRColaInstall/pch.h b/ZRColaInstall/pch.h index 4a43b0c..7fc33cb 100644 --- a/ZRColaInstall/pch.h +++ b/ZRColaInstall/pch.h @@ -20,3 +20,4 @@ #pragma once #include +#include diff --git a/include/MSIBuildCfg.mak b/include/MSIBuildCfg.mak index 7a601fbecb08e9220dce8b55872122e59b3b3af4..cdf8febf1fa7d2b2c8d90ee39c1714fe2dd1bcc3 100644 GIT binary patch delta 106 zcmX@(^~q-gAJ1eTPM*ozxW!l<8G;ymC!gguWHj3RpL;L+