From 57f63ad56f41deacca19f6e2adb40bc78783bb73 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Sat, 13 Jul 2024 20:50:37 +0700 Subject: [PATCH] Work on ARM64 shell extension support --- ExplorerPatcher/ExplorerPatcher.vcxproj | 128 ++++++------- ExplorerPatcher/dllmain.c | 177 +++++++++--------- ExplorerPatcher/utility.c | 32 +--- ExplorerPatcher/utility.h | 34 +++- ep_gui/GUI.c | 18 +- ep_gui/GUI.h | 4 +- ep_gui/ep_gui.vcxproj | 4 +- ep_setup/ep_setup.c | 22 ++- ep_setup/resources/ep_setup.rc | 10 +- ep_setup/resources/resource.h | 1 - ep_weather_host/ep_weather_host.c | 4 + ep_weather_host/ep_weather_host.h | 2 +- ep_weather_host/ep_weather_host.vcxproj | 77 +++++++- .../ep_weather_host.vcxproj.filters | 6 +- ep_weather_host/packages.config | 2 +- .../ep_weather_host_stub.vcxproj | 82 +++++++- libs/sws | 2 +- 17 files changed, 377 insertions(+), 228 deletions(-) diff --git a/ExplorerPatcher/ExplorerPatcher.vcxproj b/ExplorerPatcher/ExplorerPatcher.vcxproj index ccb3b63..f0a3c87 100644 --- a/ExplorerPatcher/ExplorerPatcher.vcxproj +++ b/ExplorerPatcher/ExplorerPatcher.vcxproj @@ -25,6 +25,14 @@ Release ARM64 + + Debug + ARM64EC + + + Release + ARM64EC + 16.0 @@ -32,41 +40,16 @@ CenterTitlebarTextLibrary 10.0 ExplorerPatcher + false - + DynamicLibrary true v143 Unicode - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - + DynamicLibrary false v143 @@ -111,21 +94,37 @@ true $(SolutionDir)\build\$(Configuration)\$(Platform)\ ExplorerPatcher.amd64 + true false $(SolutionDir)\build\$(Configuration)\$(Platform)\ ExplorerPatcher.amd64 + true true $(SolutionDir)\build\$(Configuration)\$(Platform)\ ExplorerPatcher.arm64 + true + $(WithArm64XBinaries) false $(SolutionDir)\build\$(Configuration)\$(Platform)\ ExplorerPatcher.arm64 + true + $(WithArm64XBinaries) + + + true + $(SolutionDir)\build\$(Configuration)\$(Platform)\ + ExplorerPatcher.arm64ec + + + false + $(SolutionDir)\build\$(Configuration)\$(Platform)\ + ExplorerPatcher.arm64ec @@ -170,6 +169,7 @@ + WITH_MAIN_PATCHER;%(PreprocessorDefinitions) Cdecl @@ -178,106 +178,90 @@ + WITH_MAIN_PATCHER;%(PreprocessorDefinitions) Cdecl $(SolutionDir)libs\funchook\build-arm64\Release\;$(SolutionDir)libs\funchook\build-arm64\_deps\capstone-build\Release\;%(AdditionalLibraryDirectories) + + + Cdecl + + - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true - true - true + true diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index f70d657..e929091 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -1,4 +1,4 @@ -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #include "hooking.h" #endif #include @@ -27,7 +27,7 @@ #include #include #include "lvt.h" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #include #endif #if defined(DEBUG) | defined(_DEBUG) @@ -36,7 +36,7 @@ #include #include #include "../ep_weather_host/ep_weather.h" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #include "../ep_weather_host/ep_weather_host_h.h" IEPWeather* epw = NULL; CRITICAL_SECTION lock_epw; @@ -46,7 +46,7 @@ HWND PeopleButton_LastHWND = NULL; #include "osutility.h" HANDLE hServiceWindowThread = NULL; //#pragma comment(lib, "Winmm.lib") -#ifndef _WIN64 +#if !WITH_MAIN_PATCHER RTL_OSVERSIONINFOW global_rovi; DWORD32 global_ubr; #endif @@ -207,7 +207,7 @@ BOOL g_bIsDesktopRaised = FALSE; #ifdef USE_PRIVATE_INTERFACES #include "ep_private.h" #endif -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #include "symbols.h" #include "dxgi_imp.h" #include "ArchiveMenu.h" @@ -225,7 +225,7 @@ DWORD dwUpdatePolicy = UPDATE_POLICY_DEFAULT; wchar_t* EP_TASKBAR_LENGTH_PROP_NAME = L"EPTBLEN"; HWND hWinXWnd; -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #define MAX_NUM_MONITORS 30 MonitorListEntry hMonitorList[MAX_NUM_MONITORS]; DWORD dwMonitorCount = 0; @@ -247,7 +247,7 @@ DEFINE_GUID(CLSID_EPStart10, 0x9717d01, 0x5d10, 0x4fb5, 0xbd, 0x5, 0x46, 0x38, 0xb, 0x51, 0x65, 0xaa); #pragma region "Updates" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DWORD CheckForUpdatesThread(LPVOID timeout) { HRESULT hr = S_OK; @@ -438,7 +438,7 @@ DWORD CheckForUpdatesThread(LPVOID timeout) #pragma region "Generics" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HWND GetMonitorInfoFromPointForTaskbarFlyoutActivation(POINT ptCursor, DWORD dwFlags, LPMONITORINFO lpMi) { HMONITOR hMonitor = MonitorFromPoint(ptCursor, dwFlags); @@ -788,7 +788,7 @@ void LaunchNetworkTargets(DWORD dwTarget) #pragma region "Service Window" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HWND hWndServiceWindow = NULL; void FixUpCenteredTaskbar() @@ -1029,7 +1029,7 @@ BOOL ToggleActionCenter() return PostMessageW(FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL), WM_HOTKEY, 500, MAKELPARAM(MOD_WIN, 0x41)); } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER void ToggleLauncherTipContextMenu() { if (hIsWinXShown) @@ -1126,7 +1126,7 @@ HRESULT WINAPI windowsudkshellcommon_SLGetWindowsInformationDWORDHook(PCWSTR pws #pragma region "twinui.pcshell.dll hooks" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #define LAUNCHERTIP_CLASS_NAME L"LauncherTipWnd" static INT64(*winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc)( void* _this, @@ -1602,7 +1602,7 @@ finalize: #pragma region "Windows 10 Taskbar Hooks" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER // credits: https://github.com/m417z/7-Taskbar-Tweaker DEFINE_GUID(IID_ITaskGroup, @@ -1806,7 +1806,7 @@ HRESULT explorer_QISearch(void* that, LPCQITAB pqit, REFIID riid, void** ppv) #pragma region "Show Start in correct location according to TaskbarAl" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoInitialize) { BOOL bShouldInitialize = LOWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize); @@ -1877,7 +1877,7 @@ void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoIni #pragma region "Fix Windows 11 taskbar not showing tray when auto hide is on" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #define FIXTASKBARAUTOHIDE_CLASS_NAME L"FixTaskbarAutohide_" _T(EP_CLSID) LRESULT CALLBACK FixTaskbarAutohide_WndProc( HWND hWnd, @@ -1964,7 +1964,7 @@ DWORD FixTaskbarAutohide(DWORD unused) #pragma region "Allow enabling XAML sounds" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER void ForceEnableXamlSounds(HMODULE hWindowsUIXaml) { MODULEINFO mi; @@ -2034,7 +2034,7 @@ BOOL IsXamlSoundsEnabled() #pragma region "EnsureXAML on OS builds 22621+" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DEFINE_GUID(uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics, 0xECC13292, 0x27EF, 0x547A, 0xAC, 0x8B, @@ -2206,7 +2206,7 @@ HMODULE __fastcall combase_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, D #pragma region "Shell_TrayWnd subclass" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER int HandleTaskbarCornerInteraction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { POINT pt; pt.x = 0; pt.y = 0; @@ -2855,7 +2855,7 @@ INT64 Shell_TrayWndSubclassProc( #pragma region "Allow legacy volume applet" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER LSTATUS sndvolsso_RegGetValueW( HKEY hkey, LPCWSTR lpSubKey, @@ -2887,7 +2887,7 @@ LSTATUS sndvolsso_RegGetValueW( #pragma region "Allow legacy date and time" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DEFINE_GUID(GUID_Win32Clock, 0x0A323554A, 0x0FE1, 0x4E49, 0xae, 0xe1, @@ -3056,7 +3056,7 @@ void RemoveOwnerDrawFromMenu(int level, HMENU hMenu) } BOOL CheckIfMenuContainsOwnPropertiesItem(HMENU hMenu) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (hMenu) { int k = GetMenuItemCount(hMenu); @@ -3076,7 +3076,7 @@ BOOL CheckIfMenuContainsOwnPropertiesItem(HMENU hMenu) return FALSE; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #define DEFINE_IMMERSIVE_MENU_HOOK(name) \ static ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t name##_ApplyOwnerDrawToMenuFunc = NULL; \ static HRESULT name##_ApplyOwnerDrawToMenuHook(HMENU hMenu, HWND hWnd, POINT* pPt, unsigned int options, void* data) \ @@ -3179,7 +3179,7 @@ BOOL TrackPopupMenuHookEx( if (IsImmersiveMenu) { IsImmersiveMenu = FALSE; -#ifndef _WIN64 +#if !WITH_MAIN_PATCHER if (bIsExplorerProcess) { #else @@ -3207,7 +3207,7 @@ BOOL TrackPopupMenuHookEx( hWnd, lptpm ); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bContainsOwn && (bRet >= 12000 && bRet <= 12200)) { LaunchPropertiesGUI(hModule); @@ -3226,7 +3226,7 @@ BOOL TrackPopupMenuHookEx( hWnd, lptpm ); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bContainsOwn && (b >= 12000 && b <= 12200)) { LaunchPropertiesGUI(hModule); @@ -3267,7 +3267,7 @@ BOOL TrackPopupMenuHook( { IsImmersiveMenu = FALSE; -#ifndef _WIN64 +#if !WITH_MAIN_PATCHER if (bIsExplorerProcess) { #else @@ -3296,7 +3296,7 @@ BOOL TrackPopupMenuHook( hWnd, prcRect ); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bContainsOwn && (bRet >= 12000 && bRet <= 12200)) { LaunchPropertiesGUI(hModule); @@ -3316,7 +3316,7 @@ BOOL TrackPopupMenuHook( hWnd, prcRect ); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bContainsOwn && (b >= 12000 && b <= 12200)) { LaunchPropertiesGUI(hModule); @@ -3325,7 +3325,7 @@ BOOL TrackPopupMenuHook( #endif return b; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #define TB_POS_NOWHERE 0 #define TB_POS_BOTTOM 1 #define TB_POS_TOP 2 @@ -4189,7 +4189,7 @@ HWND WINAPI explorerframe_SHCreateWorkerWindowHook( #pragma region "Fix battery flyout" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER LSTATUS stobject_RegGetValueW( HKEY hkey, LPCWSTR lpSubKey, @@ -4321,7 +4321,7 @@ HRESULT stobject_CoCreateInstanceHook( #pragma region "Show WiFi networks on network icon click" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HRESULT pnidui_CoCreateInstanceHook( REFCLSID rclsid, LPUNKNOWN pUnkOuter, @@ -4425,7 +4425,7 @@ HRESULT pnidui_CoCreateInstanceHook( #pragma region "Clock flyout helper" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER typedef struct _ClockButton_ToggleFlyoutCallback_Params { void* TrayUIInstance; @@ -4604,7 +4604,7 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo #pragma region "Open power user menu on Win+X" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER LRESULT explorer_SendMessageW(HWND hWndx, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == TB_GETTEXTROWS) @@ -4646,7 +4646,7 @@ LRESULT explorer_SendMessageW(HWND hWndx, UINT uMsg, WPARAM wParam, LPARAM lPara #pragma region "Set up taskbar button hooks, implement Weather widget" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DWORD ShouldShowWidgetsInsteadOfCortana() { @@ -5760,7 +5760,7 @@ BOOL explorer_SetChildWindowNoActivateHook(HWND hWnd) #pragma region "Hide Show desktop button" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER INT64 ShowDesktopSubclassProc( _In_ HWND hWnd, _In_ UINT uMsg, @@ -5802,7 +5802,7 @@ INT64 ShowDesktopSubclassProc( #pragma region "Notify shell ready" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DWORD SignalShellReady(DWORD wait) { printf("Started \"Signal shell ready\" thread.\n"); @@ -5852,7 +5852,7 @@ DWORD SignalShellReady(DWORD wait) #pragma region "Window Switcher" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DWORD sws_IsEnabled = FALSE; void sws_ReadSettings(sws_WindowSwitcher* sws) @@ -6223,7 +6223,7 @@ void WINAPI LoadSettings(LPARAM lParam) } if (hKey) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER dwSize = sizeof(DWORD); dwTemp = 0; RegQueryValueExW( @@ -6795,7 +6795,7 @@ void WINAPI LoadSettings(LPARAM lParam) ); if (!IsAppRunningAsAdminMode() && dwTemp) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER LaunchPropertiesGUI(hModule); #endif } @@ -6867,7 +6867,7 @@ void WINAPI LoadSettings(LPARAM lParam) if (dwTemp != bDisableSpotlightIcon) { bDisableSpotlightIcon = dwTemp; -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (IsSpotlightEnabled()) dwRefreshUIMask |= REFRESHUI_SPOTLIGHT; #endif } @@ -6893,7 +6893,7 @@ void WINAPI LoadSettings(LPARAM lParam) if (dwTemp != dwSpotlightUpdateSchedule) { dwSpotlightUpdateSchedule = dwTemp; -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (IsSpotlightEnabled() && hWndServiceWindow) { if (dwSpotlightUpdateSchedule) @@ -6955,7 +6955,7 @@ void WINAPI LoadSettings(LPARAM lParam) &dwSize ); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER EnterCriticalSection(&lock_epw); DWORD dwOldWeatherTemperatureUnit = dwWeatherTemperatureUnit; @@ -7451,7 +7451,7 @@ void WINAPI LoadSettings(LPARAM lParam) { //if (epw_dummytext[0] == 0) epw_dummytext = L"\u2009"; //else epw_dummytext = L""; -#ifdef _WIN64 +#if WITH_MAIN_PATCHER InvalidateRect(PeopleButton_LastHWND, NULL, TRUE); #endif } @@ -7475,7 +7475,7 @@ void WINAPI LoadSettings(LPARAM lParam) } if (dwRefreshUIMask & REFRESHUI_CENTER) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER //ToggleTaskbarAutohide(); //Sleep(1000); //ToggleTaskbarAutohide(); @@ -7700,7 +7700,7 @@ void WINAPI Explorer_RefreshUI(int src) Explorer_RefreshClock(0); if (dwRefreshMask & REFRESHUI_CENTER) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER FixUpCenteredTaskbar(); #endif } @@ -7816,7 +7816,7 @@ HWND CreateWindowExWHook( hInstance, lpParam ); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && (!wcscmp(lpClassName, L"TrayClockWClass") || !wcscmp(lpClassName, L"ClockButton"))) { SetWindowSubclass(hWnd, ClockButtonSubclassProc, ClockButtonSubclassProc, 0); @@ -7913,7 +7913,7 @@ LONG_PTR SetWindowLongPtrWHook( return SetWindowLongPtrWFunc(hWnd, nIndex, dwNewLong); } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HRESULT (*explorer_SetWindowThemeFunc)( HWND hwnd, LPCWSTR pszSubAppName, @@ -8391,7 +8391,7 @@ int ExplorerFrame_CompareStringOrdinal(const WCHAR* a1, int a2, const WCHAR* a3, return CSTR_GREATER_THAN; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DEFINE_GUID(IID_EnumExplorerCommand, 0xA88826F8, 0x186F, 0x4987, 0xAA, 0xDE, @@ -8591,7 +8591,7 @@ HINSTANCE explorer_ShellExecuteW( #pragma region "Classic Drive Grouping" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER const struct { DWORD dwDescriptionId; UINT uResourceId; } driveCategoryMap[] = { { SHDID_FS_DIRECTORY, 9338 }, //shell32 { SHDID_COMPUTER_SHAREDDOCS, 9338 }, //shell32 @@ -8873,7 +8873,7 @@ HRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, #pragma region "Change language UI style + Enable old taskbar" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER DEFINE_GUID(CLSID_TrayUIComponent, 0x88FC85D3, 0x7090, 0x4F53, 0x8F, 0x7A, @@ -9412,7 +9412,7 @@ BOOL twinui_RegisterHotkeyHook(HWND hWnd, int id, UINT fsModifiers, UINT vk) #pragma region "Fix taskbar thumbnails and acrylic in newer OS builds (22572+)" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HRESULT explorer_DwmUpdateThumbnailPropertiesHook(HTHUMBNAIL hThumbnailId, DWM_THUMBNAIL_PROPERTIES* ptnProperties) { if (ptnProperties->dwFlags == 0 || ptnProperties->dwFlags == DWM_TNP_RECTSOURCE) @@ -9455,7 +9455,7 @@ BOOL SHELL32_CanDisplayWin8CopyDialogHook() #pragma region "Windows Spotlight customization" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HKEY hKeySpotlight1 = NULL; HKEY hKeySpotlight2 = NULL; @@ -9522,7 +9522,7 @@ BOOL shell32_TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, int nReserve #pragma region "Fix Windows 10 taskbar high DPI button width bug" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER int patched_GetSystemMetrics(int nIndex) { if ((bOldTaskbar && nIndex == SM_CXMINIMIZED) || nIndex == SM_CXICONSPACING || nIndex == SM_CYICONSPACING) @@ -9991,7 +9991,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) { if (bInstall) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (DoesOSBuildSupportSpotlight()) { VnPatchIAT(hShell32, "user32.dll", "TrackPopupMenu", shell32_TrackPopupMenu); @@ -10000,7 +10000,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) { #endif VnPatchIAT(hShell32, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER } #endif if (bIsExplorerProcess) @@ -10065,7 +10065,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) } VnPatchIAT(hExplorerFrame, "API-MS-WIN-CORE-STRING-L1-1-0.DLL", "CompareStringOrdinal", ExplorerFrame_CompareStringOrdinal); VnPatchIAT(hExplorerFrame, "user32.dll", "GetSystemMetricsForDpi", explorerframe_GetSystemMetricsForDpi); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER MODULEINFO mi; GetModuleInformation(GetCurrentProcess(), hExplorerFrame, &mi, sizeof(MODULEINFO)); if (bShrinkExplorerAddressBar) @@ -10135,7 +10135,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) } } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER // As of writing, this function is never invoked with bInstall=TRUE, so we don't handle the case if it's false for now if (bIsExplorerProcess) { @@ -10201,7 +10201,7 @@ INT64 twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostHook(INT64 _this #pragma region "Fixes related to the removal of STTest feature flag (22621.2134+)" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HRESULT(*twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorFunc)(IInspectable* _this, HMONITOR hMonitor, float* outHeight); HRESULT twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorHook(IInspectable* _this, HMONITOR hMonitor, float* outHeight) { @@ -10733,7 +10733,7 @@ BOOL Moment2PatchHardwareConfirmator(LPMODULEINFO mi) #pragma region "Enable EP weather on Windows Server SKUs" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER BOOL PeopleBand_IsOS(DWORD dwOS) { if (dwOS == OS_ANYSERVER) return FALSE; @@ -10768,7 +10768,7 @@ BOOL explorer_IsOS(DWORD dwOS) #pragma region "Find offsets of needed functions when symbols are not available" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER inline BOOL FollowJnz(PBYTE pJnz, PBYTE* pTarget, DWORD* pJnzSize) { // Check big jnz @@ -11355,7 +11355,7 @@ cleanup: #pragma region "Fix Pin to Start from Explorer not working when using Windows 10 start menu" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER extern HRESULT AppResolver_StartTileData_RoGetActivationFactory(HSTRING activatableClassId, REFIID iid, void** factory); typedef struct CCacheShortcut CCacheShortcut; @@ -11452,7 +11452,7 @@ static void PatchStartTileData(BOOL bSMEH) #pragma region "Fix Windows 10 start menu animation on 22000.65+" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER static struct { int startExperienceManager_IStartExperienceManager; @@ -12118,7 +12118,7 @@ BOOL FixStartMenuAnimation(LPMODULEINFO mi) #pragma region "Crash counter system" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER typedef struct CrashCounterSettings { BOOL bDisabled; @@ -12349,7 +12349,7 @@ BOOL CrashCounterHandleEntryPoint() #pragma region "Loader for alternate taskbar implementation" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER BOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS) { BOOL bAllValid = TRUE; @@ -12440,7 +12440,7 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const #pragma region "Restore network icon on builds without pnidui.dll shipped" -#ifdef _WIN64 +#if WITH_MAIN_PATCHER typedef struct SSOEntry { GUID* pguid; @@ -12576,7 +12576,7 @@ DWORD Inject(BOOL bIsExplorer) if (bIsExplorer) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER InitializeCriticalSection(&lock_epw); #endif wszWeatherLanguage = malloc(sizeof(WCHAR) * MAX_PATH); @@ -12586,7 +12586,7 @@ DWORD Inject(BOOL bIsExplorer) LoadSettings(MAKELPARAM(bIsExplorer, FALSE)); Explorer_RefreshUI(99); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bIsExplorerProcess) { funchook = funchook_create(); @@ -12771,7 +12771,7 @@ DWORD Inject(BOOL bIsExplorer) if (!bIsExplorer) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (bIsExplorerProcess) { rv = funchook_install(funchook, 0); @@ -12786,7 +12786,7 @@ DWORD Inject(BOOL bIsExplorer) return 0; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER extern void InitializeWilLogCallback(); InitializeWilLogCallback(); wprintf(L"Running on Windows %d, OS Build %d.%d.%d.%d.\n", IsWindows11() ? 11 : 10, global_rovi.dwMajorVersion, global_rovi.dwMinorVersion, global_rovi.dwBuildNumber, global_ubr); @@ -12800,7 +12800,7 @@ DWORD Inject(BOOL bIsExplorer) CreateDirectoryW(wszPath, NULL); } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER wszEPWeatherKillswitch = calloc(sizeof(WCHAR), MAX_PATH); srand(time(NULL)); rand_string(wszEPWeatherKillswitch, MAX_PATH / 2 - 1); @@ -12824,7 +12824,7 @@ DWORD Inject(BOOL bIsExplorer) #endif -#ifdef _WIN64 +#if WITH_MAIN_PATCHER hCanStartSws = CreateEventW(NULL, FALSE, FALSE, NULL); hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL); CreateThread( @@ -13210,7 +13210,7 @@ DWORD Inject(BOOL bIsExplorer) printf("Failed to hook winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessage(). rv = %d\n", rv); }*/ -#ifdef _WIN64 +#if WITH_MAIN_PATCHER #if USE_MOMENT_3_FIXES_ON_MOMENT_2 // Use this only for testing, since the RtlQueryFeatureConfiguration() hook is perfect. // Only tested on 22621.1992. @@ -13388,7 +13388,7 @@ DWORD Inject(BOOL bIsExplorer) } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (global_rovi.dwBuildNumber < 22567) { PatchSndvolsso(); @@ -13736,7 +13736,7 @@ DWORD Inject(BOOL bIsExplorer) return 0; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER char VisibilityChangedEventArguments_GetVisible(__int64 a1) { int v1; @@ -14517,7 +14517,13 @@ void Setup_Regsvr32(BOOL bInstall) wszCurrentDirectory[2] = L' '; wszCurrentDirectory[3] = L'"'; } +#if defined(_M_X64) wcscat_s(wszCurrentDirectory, ARRAYSIZE(wszCurrentDirectory), L"\\ExplorerPatcher.amd64.dll\""); +#elif defined(_M_ARM64) + wcscat_s(wszCurrentDirectory, ARRAYSIZE(wszCurrentDirectory), L"\\ExplorerPatcher.arm64.dll\""); +#else +#error "Unsupported architecture" +#endif SHELLEXECUTEINFOW sei; ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); sei.cbSize = sizeof(sei); @@ -14873,7 +14879,7 @@ HRESULT WINAPI _DllCanUnloadNow() DWORD InjectStartMenu() { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER funchook = funchook_create(); HANDLE hStartDocked = NULL; @@ -15093,7 +15099,7 @@ DWORD InjectStartMenu() void InjectShellExperienceHost() { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER HKEY hKey; if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey) != ERROR_SUCCESS) { @@ -15220,7 +15226,7 @@ BOOL SEH_GetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dw } void InjectShellExperienceHostFor22H2OrHigher() { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (!IsWindows11Version22H2Build1413OrHigher()) { HKEY hKey; @@ -15236,7 +15242,7 @@ void InjectShellExperienceHostFor22H2OrHigher() { #endif } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER bool IsUserOOBE() { BOOL b = FALSE; @@ -15340,7 +15346,7 @@ HRESULT EntryPoint(DWORD dwMethod) TCHAR wszRealDXGIPath[MAX_PATH]; GetSystemDirectoryW(wszRealDXGIPath, MAX_PATH); wcscat_s(wszRealDXGIPath, MAX_PATH, L"\\dxgi.dll"); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER SetupDXGIImportFunctions(LoadLibraryW(wszRealDXGIPath)); #endif } @@ -15356,7 +15362,7 @@ HRESULT EntryPoint(DWORD dwMethod) bIsExplorerProcess = bIsThisExplorer; if (bIsThisExplorer) { -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (GetSystemMetrics(SM_CLEANBOOT) != 0 || IsUserOOBEOrCredentialReset()) { IncrementDLLReferenceCount(hModule); @@ -15365,7 +15371,7 @@ HRESULT EntryPoint(DWORD dwMethod) } #endif BOOL desktopExists = IsDesktopWindowAlreadyPresent(); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (!desktopExists && CrashCounterHandleEntryPoint()) { IncrementDLLReferenceCount(hModule); @@ -15380,7 +15386,7 @@ HRESULT EntryPoint(DWORD dwMethod) else if (bIsThisStartMEH) { InjectStartMenu(); -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (IsXamlSoundsEnabled()) { HMODULE hWindowsUIXaml = LoadLibraryW(L"Windows.UI.Xaml.dll"); @@ -15400,7 +15406,7 @@ HRESULT EntryPoint(DWORD dwMethod) { InjectShellExperienceHost(); } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER if (IsXamlSoundsEnabled()) { HMODULE hWindowsUIXaml = LoadLibraryW(L"Windows.UI.Xaml.dll"); @@ -15420,7 +15426,7 @@ HRESULT EntryPoint(DWORD dwMethod) return E_NOINTERFACE; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER // for explorer.exe and ShellExperienceHost.exe __declspec(dllexport) HRESULT DXGIDeclareAdapterRemovalSupport() { @@ -15439,6 +15445,9 @@ HRESULT InjectStartFromExplorer() EntryPoint(DLL_INJECTION_METHOD_START_INJECTION); return HRESULT_FROM_WIN32(GetLastError()); } +#endif + +#ifdef _WIN64 #pragma comment(linker, "/export:DllGetClassObject=_DllGetClassObject") #else #pragma comment(linker, "/export:DllGetClassObject=__DllGetClassObject@12") @@ -15475,7 +15484,7 @@ BOOL WINAPI DllMain( return TRUE; } -#ifdef _WIN64 +#if WITH_MAIN_PATCHER __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) { // Forward to ep_gui.dll diff --git a/ExplorerPatcher/utility.c b/ExplorerPatcher/utility.c index 3447a07..0917668 100644 --- a/ExplorerPatcher/utility.c +++ b/ExplorerPatcher/utility.c @@ -1611,37 +1611,7 @@ HRESULT SHRegGetDWORD(HKEY hkey, const WCHAR* pwszSubKey, const WCHAR* pwszValue return HRESULT_FROM_WIN32(lres); } -#ifdef _WIN64 -static BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask) -{ - for (PBYTE value = (PBYTE)pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value) - { - if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value) - return FALSE; - } - - return TRUE; -} - -static __declspec(noinline) PVOID FindPatternHelper(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask) -{ - for (SIZE_T index = 0; index < dwSize; ++index) - { - PBYTE pAddress = (PBYTE)pBase + index; - - if (MaskCompare(pAddress, lpPattern, lpMask)) - return pAddress; - } - - return NULL; -} - -PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask) -{ - dwSize -= strlen(lpMask); - return FindPatternHelper(pBase, dwSize, lpPattern, lpMask); -} - +#ifdef WITH_MAIN_PATCHER // https://learn.microsoft.com/en-us/windows/uwp/communication/sharing-named-objects // https://learn.microsoft.com/en-us/windows/win32/api/securityappcontainer/nf-securityappcontainer-getappcontainernamedobjectpath#examples BOOL GetLogonSid(PSID* ppsid) diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index fe7ae47..c3a189e 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -576,7 +576,6 @@ inline BOOL IncrementDLLReferenceCount(HINSTANCE hinst) return TRUE; } -#ifdef _WIN64 PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask); #if _M_ARM64 @@ -689,6 +688,7 @@ inline UINT_PTR ARM64_DecodeADRL(UINT_PTR offset, DWORD insnADRP, DWORD insnADD) } #endif +#if defined(WITH_MAIN_PATCHER) && WITH_MAIN_PATCHER inline BOOL WINAPI PatchContextMenuOfNewMicrosoftIME(BOOL* bFound) { // huge thanks to @Simplestas: https://github.com/valinet/ExplorerPatcher/issues/598 @@ -801,9 +801,35 @@ BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOve HRESULT SHRegGetBOOLWithREGSAM(HKEY key, LPCWSTR subKey, LPCWSTR value, REGSAM regSam, BOOL* data); HRESULT SHRegGetDWORD(HKEY hkey, const WCHAR* pwszSubKey, const WCHAR* pwszValue, DWORD* pdwData); -#ifdef _WIN64 -PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask); -#endif +inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask) +{ + for (PBYTE value = (PBYTE)pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value) + { + if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value) + return FALSE; + } + + return TRUE; +} + +inline __declspec(noinline) PVOID FindPatternHelper(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask) +{ + for (SIZE_T index = 0; index < dwSize; ++index) + { + PBYTE pAddress = (PBYTE)pBase + index; + + if (MaskCompare(pAddress, lpPattern, lpMask)) + return pAddress; + } + + return NULL; +} + +inline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask) +{ + dwSize -= strlen(lpMask); + return FindPatternHelper(pBase, dwSize, lpPattern, lpMask); +} inline HMODULE LoadGuiModule() { diff --git a/ep_gui/GUI.c b/ep_gui/GUI.c index 97588e6..33159ad 100644 --- a/ep_gui/GUI.c +++ b/ep_gui/GUI.c @@ -531,7 +531,6 @@ LSTATUS GUI_Internal_RegSetValueExW( { wszArgs[0] = L'\"'; SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 1); - wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".amd64.dll\""); } else { @@ -540,8 +539,14 @@ LSTATUS GUI_Internal_RegSetValueExW( wszArgs[2] = L' '; wszArgs[3] = L'"'; SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4); - wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".amd64.dll\""); } +#if defined(_M_X64) + wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".amd64.dll\""); +#elif defined(_M_ARM64) + wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".arm64.dll\""); +#else +#error "Unsupported architecture" +#endif wprintf(L"%s\n", wszArgs); WCHAR wszApp[MAX_PATH * 2]; GetSystemDirectoryW(wszApp, MAX_PATH * 2); @@ -2745,7 +2750,6 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) { wszArgs[0] = L'\"'; SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 1); - wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".amd64.dll\""); } else { @@ -2754,8 +2758,14 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) wszArgs[2] = L' '; wszArgs[3] = L'"'; SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4); - wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".amd64.dll\""); } +#if defined(_M_X64) + wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".amd64.dll\""); +#elif defined(_M_ARM64) + wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(PRODUCT_NAME) L".arm64.dll\""); +#else +#error "Unsupported architecture" +#endif wprintf(L"%s\n", wszArgs); WCHAR wszApp[MAX_PATH * 2]; GetSystemDirectoryW(wszApp, MAX_PATH * 2); diff --git a/ep_gui/GUI.h b/ep_gui/GUI.h index e1e76c6..12f4c55 100644 --- a/ep_gui/GUI.h +++ b/ep_gui/GUI.h @@ -25,8 +25,8 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #include "../ExplorerPatcher/fmemopen.h" #include "../ExplorerPatcher/Localization.h" #include "../ExplorerPatcher/utility.h" -#include "../ep_weather_host/ep_weather.h" -#include "../ep_weather_host/ep_weather_host_h.h" +#include "ep_weather.h" +#include "ep_weather_host_h.h" #define MAX_LINE_LENGTH 2000 extern HMODULE hModule; diff --git a/ep_gui/ep_gui.vcxproj b/ep_gui/ep_gui.vcxproj index a6ac04f..a667746 100644 --- a/ep_gui/ep_gui.vcxproj +++ b/ep_gui/ep_gui.vcxproj @@ -92,7 +92,7 @@ true true stdcpp20 - $(SolutionDir)libs\libvalinet;$(SolutionDir)libs\funchook\include;%(AdditionalIncludeDirectories) + $(SolutionDir)libs\libvalinet;$(SolutionDir)libs\funchook\include;$(SolutionDir)\ep_weather_host;$(SolutionDir)\ep_weather_host\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories) pch.h @@ -133,7 +133,7 @@ - + diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index f504164..35ec3d0 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -502,8 +502,11 @@ int WINAPI wWinMain( GetCurrentDirectoryW(MAX_PATH, wszPath); } if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_IA32, wszPath, _T(PRODUCT_NAME) L".IA-32.dll"); +#if defined(_M_X64) if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, _T(PRODUCT_NAME) L".amd64.dll"); - if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_ARM64, wszPath, _T(PRODUCT_NAME) L".arm64.dll"); +#elif defined(_M_ARM64) + if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, _T(PRODUCT_NAME) L".arm64.dll"); +#endif if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_DWM, wszPath, L"ep_dwm.exe"); if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER, wszPath, L"ep_weather_host.dll"); if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER_STUB, wszPath, L"ep_weather_host_stub.dll"); @@ -853,9 +856,10 @@ int WINAPI wWinMain( } } if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_IA32, wszPath, _T(PRODUCT_NAME) L".IA-32.dll"); +#if defined(_M_X64) if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, _T(PRODUCT_NAME) L".amd64.dll"); -#ifdef _M_ARM64 - if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_ARM64, wszPath, _T(PRODUCT_NAME) L".arm64.dll"); +#elif defined(_M_ARM64) + if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, _T(PRODUCT_NAME) L".arm64.dll"); #endif if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_GUI, wszPath, L"ep_gui.dll"); if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_DWM, wszPath, L"ep_dwm.exe"); @@ -872,10 +876,10 @@ int WINAPI wWinMain( // C:\Windows // + dxgi.dll if (bOk) GetWindowsDirectoryW(wszPath, MAX_PATH); -#ifdef _M_X64 +#if defined(_M_X64) if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll"); #elif defined(_M_ARM64) - if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_ARM64, wszPath, L"dxgi.dll"); + if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll"); #endif // -------------------------------------------------------------------------------- @@ -891,10 +895,10 @@ int WINAPI wWinMain( // - pris2\Windows.UI.ShellCommon.en-US.pri if (bOk) GetWindowsDirectoryW(wszPath, MAX_PATH); if (bOk) wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy"); -#ifdef _M_X64 +#if defined(_M_X64) if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll"); #elif defined(_M_ARM64) - if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_ARM64, wszPath, L"dxgi.dll"); + if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll"); #endif if (bOk) bOk = InstallResource(bInstall && IsWindows11(), hInstance, IDR_EP_STARTMENU, wszPath, L"wincorlib.dll"); if (bOk) bOk = DeleteResource(wszPath, L"wincorlib_orig.dll"); @@ -950,10 +954,10 @@ int WINAPI wWinMain( // + dxgi.dll if (bOk) GetWindowsDirectoryW(wszPath, MAX_PATH); if (bOk) wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\ShellExperienceHost_cw5n1h2txyewy"); -#ifdef _M_X64 +#if defined(_M_X64) if (bOk && IsWindows11()) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll"); #elif defined(_M_ARM64) - if (bOk && IsWindows11()) bOk = InstallResource(bInstall, hInstance, IDR_EP_ARM64, wszPath, L"dxgi.dll"); + if (bOk && IsWindows11()) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll"); #endif // -------------------------------------------------------------------------------- diff --git a/ep_setup/resources/ep_setup.rc b/ep_setup/resources/ep_setup.rc index 819d624..1748fb6 100644 --- a/ep_setup/resources/ep_setup.rc +++ b/ep_setup/resources/ep_setup.rc @@ -90,16 +90,12 @@ END // RCDATA // -IDR_EP_AMD64 RCDATA "..\\build\\Release\\x64\\ExplorerPatcher.amd64.dll" - IDR_EP_IA32 RCDATA "..\\build\\Release\\Win32\\ExplorerPatcher.IA-32.dll" -#ifdef PLATFORM_ARM64 -IDR_EP_ARM64 RCDATA "..\\build\\Release\\ARM64\\ExplorerPatcher.arm64.dll" -#endif - #if defined(PLATFORM_AMD64) +IDR_EP_AMD64 RCDATA "..\\build\\Release\\x64\\ExplorerPatcher.amd64.dll" + IDR_EP_DWM RCDATA "..\\build\\Release\\x64\\ep_dwm.exe" IDR_EP_WEATHER RCDATA "..\\build\\Release\\x64\\ep_weather_host.dll" @@ -130,6 +126,8 @@ 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_DWM RCDATA "..\\build\\Release\\ARM64\\ep_dwm.exe" IDR_EP_WEATHER RCDATA "..\\build\\Release\\ARM64\\ep_weather_host.dll" diff --git a/ep_setup/resources/resource.h b/ep_setup/resources/resource.h index cbcd830..4c149b2 100644 --- a/ep_setup/resources/resource.h +++ b/ep_setup/resources/resource.h @@ -4,7 +4,6 @@ // #define IDR_EP_AMD64 103 #define IDR_EP_IA32 104 -#define IDR_EP_ARM64 114 #define IDR_EP_DWM 105 #define IDR_EP_WEATHER 106 #define IDR_EP_WEATHER_STUB 107 diff --git a/ep_weather_host/ep_weather_host.c b/ep_weather_host/ep_weather_host.c index 0d3c0e4..1ea4d39 100644 --- a/ep_weather_host/ep_weather_host.c +++ b/ep_weather_host/ep_weather_host.c @@ -1453,7 +1453,11 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this) GenericObjectWithThis* pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler = GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl, _this, L"pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler"); if (!pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler) goto cleanup; +#if !defined(_M_ARM64EC) _this->hrLastError = CreateCoreWebView2EnvironmentWithOptions(NULL, wszWorkFolder, &EPWeather_ICoreWebView2EnvironmentOptions, pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler); +#else + _this->hrLastError = E_NOTIMPL; +#endif pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler->lpVtbl->Release(pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler); if (FAILED(_this->hrLastError)) goto cleanup; diff --git a/ep_weather_host/ep_weather_host.h b/ep_weather_host/ep_weather_host.h index 297669f..abf5e23 100644 --- a/ep_weather_host/ep_weather_host.h +++ b/ep_weather_host/ep_weather_host.h @@ -2,7 +2,7 @@ #define _H_AS_SERVICE_P_H_ #include "ep_weather.h" #include "ep_weather_utility.h" -#include "../ep_weather_host_stub/ep_weather_host_h.h" +#include "ep_weather_host_h.h" #include "../ExplorerPatcher/def.h" #include #include diff --git a/ep_weather_host/ep_weather_host.vcxproj b/ep_weather_host/ep_weather_host.vcxproj index 1707745..12a5932 100644 --- a/ep_weather_host/ep_weather_host.vcxproj +++ b/ep_weather_host/ep_weather_host.vcxproj @@ -25,6 +25,14 @@ Release ARM64 + + Debug + ARM64EC + + + Release + ARM64EC + 16.0 @@ -32,6 +40,7 @@ {314a50c1-f0a0-4d0c-89e1-ad8f3951043e} epweatherhost 10.0 + false @@ -73,6 +82,19 @@ true Unicode + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + @@ -96,6 +118,12 @@ + + + + + + true @@ -116,10 +144,20 @@ true $(SolutionDir)\build\$(Configuration)\$(Platform)\ + $(WithArm64XBinaries) false $(SolutionDir)\build\$(Configuration)\$(Platform)\ + $(WithArm64XBinaries) + + + true + $(SolutionDir)\build\$(Configuration)\$(Platform)\ + + + false + $(SolutionDir)\build\$(Configuration)\$(Platform)\ @@ -220,13 +258,46 @@ true + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebug + $(SolutionDir)debug.h + $(SolutionDir)libs\libvalinet;%(AdditionalIncludeDirectories) + + + Windows + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + $(SolutionDir)libs\libvalinet;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + - + @@ -248,12 +319,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/ep_weather_host/ep_weather_host.vcxproj.filters b/ep_weather_host/ep_weather_host.vcxproj.filters index 7269537..fc9b293 100644 --- a/ep_weather_host/ep_weather_host.vcxproj.filters +++ b/ep_weather_host/ep_weather_host.vcxproj.filters @@ -38,9 +38,6 @@ Header Files - - Header Files - Header Files @@ -56,6 +53,9 @@ Header Files + + Header Files + diff --git a/ep_weather_host/packages.config b/ep_weather_host/packages.config index 81668dc..3722370 100644 --- a/ep_weather_host/packages.config +++ b/ep_weather_host/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/ep_weather_host_stub/ep_weather_host_stub.vcxproj b/ep_weather_host_stub/ep_weather_host_stub.vcxproj index a5f3afb..5b62f07 100644 --- a/ep_weather_host_stub/ep_weather_host_stub.vcxproj +++ b/ep_weather_host_stub/ep_weather_host_stub.vcxproj @@ -25,6 +25,14 @@ Release ARM64 + + Debug + ARM64EC + + + Release + ARM64EC + 16.0 @@ -32,6 +40,7 @@ {af02abac-eaeb-471c-9957-73d430b8b4de} epweatherhoststub 10.0 + false @@ -73,6 +82,19 @@ true Unicode + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + @@ -96,6 +118,12 @@ + + + + + + true @@ -116,10 +144,20 @@ true $(SolutionDir)\build\$(Configuration)\$(Platform)\ + $(WithArm64XBinaries) false $(SolutionDir)\build\$(Configuration)\$(Platform)\ + $(WithArm64XBinaries) + + + true + $(SolutionDir)\build\$(Configuration)\$(Platform)\ + + + false + $(SolutionDir)\build\$(Configuration)\$(Platform)\ @@ -223,15 +261,51 @@ ep_weather_host_stub.def + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebug + + + Console + true + RpcRT4.lib;%(AdditionalDependencies) + ep_weather_host_stub.def + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + + + Console + true + true + true + RpcRT4.lib;%(AdditionalDependencies) + ep_weather_host_stub.def + + - + + $(IntDir) + - + REGISTER_PROXY_DLL;%(PreprocessorDefinitions) - - + + REGISTER_PROXY_DLL;%(PreprocessorDefinitions) diff --git a/libs/sws b/libs/sws index 586fe7d..971a3f2 160000 --- a/libs/sws +++ b/libs/sws @@ -1 +1 @@ -Subproject commit 586fe7d6bdbab4eec0c4b0999efe7c8602636a0b +Subproject commit 971a3f20262c065c3b001c1781b6d75f9083680e