From 033ad034d58a5069184e8be18b7506d49002d148 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Thu, 18 Nov 2021 19:44:01 +0200 Subject: [PATCH] 22000.318.38.1: Fixed #410 --- CHANGELOG.md | 6 +++++- ExplorerPatcher/dllmain.c | 21 +++++++++++++++++++-- version.h | 6 +++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53c94a5..7ca079f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and r * Functional Windows 10 network flyout * Functional Windows 10 battery flyout * Implemented support for Windows 7 battery flyout (#274) -* Implemented `/extract` switch which unpacks the files from `ep_setup.exe` to disk (#396): +* Implemented `/extract` switch which unpacks the files from `ep_setup.exe` to disk (#396) (.1): * `ep_setup /extract` - extracts `ExplorerPatcher.IA-32.dll` and `ExplorerPatcher.amd64.dll` to current directory * `ep-setup /extract test` - extracts to `test` folder in current directory * `ep-setup /extract "C:\test with space"` - extracts to `C:\test with space` directory @@ -22,6 +22,10 @@ Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and r * Improved reliability when invoking Control Center (`Win`+`A`) when the taskbar icon is disabled (the icon should now not reappear anymore sometimes) (#242) * Small reorganization of some options in "Properties" +#### Fixes + +* Windows 10 network and battery flyout should now always launch when the tray icon is clicked (#410) (.1) + ## 22000.318.37 Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and release preview channels). diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 23419f6..7714f2e 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -462,8 +462,9 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOO return point; } -void TerminateShellExperienceHost() +BOOL TerminateShellExperienceHost() { + BOOL bRet = FALSE; WCHAR wszKnownPath[MAX_PATH]; GetWindowsDirectoryW(wszKnownPath, MAX_PATH); wcscat_s(wszKnownPath, MAX_PATH, L"\\SystemApps\\ShellExperienceHost_cw5n1h2txyewy\\ShellExperienceHost.exe"); @@ -500,6 +501,7 @@ void TerminateShellExperienceHost() if (!_wcsicmp(wszProcessPath, wszKnownPath)) { TerminateProcess(hProcess, 0); + bRet = TRUE; } CloseHandle(hProcess); hProcess = NULL; @@ -511,6 +513,7 @@ void TerminateShellExperienceHost() CloseHandle(hSnapshot); } } + return bRet; } long long elapsedCheckForeground = 0; @@ -546,6 +549,7 @@ DWORD CheckForegroundThread(DWORD dwMode) { RegDeleteKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH)); TerminateShellExperienceHost(); + Sleep(100); } printf("Ended \"Check foreground window\" thread.\n"); return 0; @@ -2498,6 +2502,10 @@ HRESULT stobject_CoCreateInstanceHook( { if (hCheckForegroundThread) { + if (WaitForSingleObject(hCheckForegroundThread, 0) == WAIT_TIMEOUT) + { + return E_NOINTERFACE; + } WaitForSingleObject(hCheckForegroundThread, INFINITE); CloseHandle(hCheckForegroundThread); hCheckForegroundThread = NULL; @@ -2518,6 +2526,8 @@ HRESULT stobject_CoCreateInstanceHook( RegCloseKey(hKey); } TerminateShellExperienceHost(); + InvokeFlyout(0, INVOKE_FLYOUT_BATTERY); + Sleep(100); hCheckForegroundThread = CreateThread( 0, 0, @@ -2596,6 +2606,10 @@ HRESULT pnidui_CoCreateInstanceHook( { if (hCheckForegroundThread) { + if (WaitForSingleObject(hCheckForegroundThread, 0) == WAIT_TIMEOUT) + { + return E_NOINTERFACE; + } WaitForSingleObject(hCheckForegroundThread, INFINITE); CloseHandle(hCheckForegroundThread); hCheckForegroundThread = NULL; @@ -2616,6 +2630,8 @@ HRESULT pnidui_CoCreateInstanceHook( RegCloseKey(hKey); } TerminateShellExperienceHost(); + InvokeFlyout(0, INVOKE_FLYOUT_NETWORK); + Sleep(100); hCheckForegroundThread = CreateThread( 0, 0, @@ -6290,10 +6306,11 @@ void InjectShellExperienceHost() { #ifdef _WIN64 HKEY hKey; - if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey)) + if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey) != ERROR_SUCCESS) { return; } + RegCloseKey(hKey); HMODULE hQA = LoadLibraryW(L"Windows.UI.QuickActions.dll"); if (hQA) { diff --git a/version.h b/version.h index 5c599ae..c51d5a4 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22000 #define VER_MINOR 318 #define VER_BUILD_HI 38 -#define VER_BUILD_LO 0 +#define VER_BUILD_LO 1 #define VER_FLAGS VS_FF_PRERELEASE @@ -12,5 +12,5 @@ #define VER_STR(arg) #arg // The String form of the version numbers -#define VER_FILE_STRING VALUE "FileVersion", "22000.318.38.0" -#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.38.0" +#define VER_FILE_STRING VALUE "FileVersion", "22000.318.38.1" +#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.38.1"