Skip to content

Commit

Permalink
Setup: Block ARM64 devices from running the x64 setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrsatrio committed Jul 14, 2024
1 parent 2b9c747 commit 5d0d218
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
26 changes: 26 additions & 0 deletions ep_setup/ep_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,32 @@ int WINAPI wWinMain(
return !bOk;
}

#if defined(_M_X64)
typedef BOOL (WINAPI *IsWow64Process2_t)(HANDLE hProcess, USHORT* pProcessMachine, USHORT* pNativeMachine);
IsWow64Process2_t pfnIsWow64Process2 = (IsWow64Process2_t)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "IsWow64Process2");
if (pfnIsWow64Process2)
{
USHORT processMachine, nativeMachine;
if (pfnIsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine))
{
if (nativeMachine == IMAGE_FILE_MACHINE_ARM64)
{
WCHAR szFormat[256];
szFormat[0] = 0;
int written = LoadStringW(hInstance, IDS_SETUP_UNSUPPORTED_ARCH, szFormat, ARRAYSIZE(szFormat));
if (written > 0 && written < ARRAYSIZE(szFormat))
{
WCHAR szMessage[256];
szMessage[0] = 0;
_swprintf_p(szMessage, ARRAYSIZE(szMessage), szFormat, L"ARM64", L"x64");
MessageBoxW(NULL, szMessage, _T(PRODUCT_NAME), MB_OK | MB_ICONERROR);
}
exit(0);
}
}
}
#endif

WCHAR wszOwnPath[MAX_PATH];
ZeroMemory(wszOwnPath, ARRAYSIZE(wszOwnPath));
if (!GetModuleFileNameW(NULL, wszOwnPath, ARRAYSIZE(wszOwnPath)))
Expand Down
6 changes: 3 additions & 3 deletions ep_setup/resources/ep_setup.rc
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "CompanyName", "ExplorerPatcher Developers"
VALUE "FileDescription", "ExplorerPatcher Setup Program"
VER_FILE_STRING
VALUE "InternalName", "ep_setup.exe"
VALUE "LegalCopyright", "Copyright (C) 2006-2024 VALINET Solutions SRL. All rights reserved."
VALUE "LegalCopyright", "(C) 2021-2024 ExplorerPatcher Developers. All rights reserved."
VALUE "OriginalFilename", "ep_setup.exe"
VALUE "ProductName", "ExplorerPatcher"
VER_PRODUCT_STRING
Expand Down Expand Up @@ -126,7 +126,7 @@ IDR_EP_TASKBAR_5 RCDATA "..\\build\\Release\\x64\\ep_taskbar.

#elif defined(PLATFORM_ARM64)

IDR_EP_ARM64 RCDATA "..\\build\\Release\\ARM64\\ExplorerPatcher.arm64.dll"
IDR_EP_AMD64 RCDATA "..\\build\\Release\\ARM64\\ExplorerPatcher.arm64.dll"

IDR_EP_DWM RCDATA "..\\build\\Release\\ARM64\\ep_dwm.exe"

Expand Down
1 change: 1 addition & 0 deletions ep_setup/resources/lang/ep_setup.en-US.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

STRINGTABLE
BEGIN
IDS_SETUP_UNSUPPORTED_ARCH "Please run the %1$s version of the setup file on %1$s devices. This setup file is only for %2$s devices."
IDS_SETUP_UNINSTALL_PROMPT "Are you sure you want to remove ExplorerPatcher from your PC?"
IDS_SETUP_INSTALL_LOGOFF "In order to install, you will be automatically signed out of Windows. ExplorerPatcher will be ready for use when you sign back in.\n\nDo you want to continue?"
IDS_SETUP_UNINSTALL_LOGOFF "To complete the uninstallation, you will be automatically signed out of Windows.\n\nDo you want to continue?"
Expand Down
13 changes: 7 additions & 6 deletions ep_setup/resources/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
#define IDR_EP_TASKBAR_4 112
#define IDR_EP_TASKBAR_5 113

#define IDS_SETUP_UNINSTALL_PROMPT 301
#define IDS_SETUP_INSTALL_LOGOFF 302
#define IDS_SETUP_UNINSTALL_LOGOFF 303
#define IDS_SETUP_UNINSTALL_RESTART 304
#define IDS_SETUP_UNINSTALL_FINISH 305
#define IDS_SETUP_FAILED 306
#define IDS_SETUP_UNSUPPORTED_ARCH 301
#define IDS_SETUP_UNINSTALL_PROMPT 302
#define IDS_SETUP_INSTALL_LOGOFF 303
#define IDS_SETUP_UNINSTALL_LOGOFF 304
#define IDS_SETUP_UNINSTALL_RESTART 305
#define IDS_SETUP_UNINSTALL_FINISH 306
#define IDS_SETUP_FAILED 307


// Next default values for new objects
Expand Down

0 comments on commit 5d0d218

Please sign in to comment.