1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-13 18:50:46 +01:00

Housekeeping

This commit is contained in:
Valentin Radu 2021-10-13 03:38:38 +03:00
parent aa8b1eeb93
commit 776a920865
9 changed files with 121 additions and 62 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
ep_private.h
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
## ##

View File

@ -2,17 +2,19 @@
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub. This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
## 22000.194.0.24 ## 22000.194.0.25
Tested on build: 22000.194. Tested on build: 22000.194.
* Start menu is hooked from File Explorer; please remove the DLL from `C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy` when using this new version * Start menu is hooked from File Explorer; please remove the DLL from `C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy` when using this new version
* `Win`+`X` now opens even when the taskbar is set to autohide (fixes #63)
* `Win`+`C` now opens even when the taskbar is set to autohide (fixes #63)
* Bluetooth and Safe to Remove menus toggle their visibility when clicked * Bluetooth and Safe to Remove menus toggle their visibility when clicked
* Bluetooth and Safe to Remove menus are centered relative to the icon they are invoked from * Bluetooth and Safe to Remove menus are centered relative to the icon they are invoked from
* WiFi list now correctly toggles when clicking the Network icon in the taskbar * WiFi list now correctly toggles when clicking the Network icon in the taskbar
* The settings GUI now supports dark mode and switches correctly when the system theme changes * The settings GUI now supports dark mode and switches correctly when the system theme changes
* The settings GUI draws correctly when themes are disabled (classic theme compatibility) * The settings GUI draws correctly when themes are disabled (classic theme compatibility)
* Optionally uses DLL from StartAllBack (`StartAllBackX64.dll`) instead of StartIsBack(TBD) (which was called `StartIsBack64.dll`); the StartAllBack DLL has SHA-256: `D8D1484D6F7DE94C5018B03A5A93EE8BBB7795BCA5408A721CBB74BE28065689` * Removed interoperability with StartAllBack or StartIsBack
## 22000.194.0.23 ## 22000.194.0.23

View File

@ -214,6 +214,7 @@
<ClInclude Include="GUI.h" /> <ClInclude Include="GUI.h" />
<ClInclude Include="HideExplorerSearchBar.h" /> <ClInclude Include="HideExplorerSearchBar.h" />
<ClInclude Include="hooking.h" /> <ClInclude Include="hooking.h" />
<ClInclude Include="ep_private.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="SettingsMonitor.h" /> <ClInclude Include="SettingsMonitor.h" />
<ClInclude Include="StartMenu.h" /> <ClInclude Include="StartMenu.h" />

View File

@ -57,6 +57,9 @@
<ClInclude Include="TaskbarCenter.h"> <ClInclude Include="TaskbarCenter.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ep_private.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="ExplorerPatcher.rc"> <ResourceCompile Include="ExplorerPatcher.rc">

View File

@ -174,6 +174,17 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{ {
if (strcmp(line, "Windows Registry Editor Version 5.00\r\n") && strcmp(line, "\r\n")) if (strcmp(line, "Windows Registry Editor Version 5.00\r\n") && strcmp(line, "\r\n"))
{ {
#ifndef USE_PRIVATE_INTERFACES
if (!strncmp(line, ";p ", 3))
{
int num = atoi(line + 3);
for (int i = 0; i < num; ++i)
{
getline(&line, &bufsiz, f);
}
}
#endif
if (!strncmp(line, "[", 1)) if (!strncmp(line, "[", 1))
{ {
ZeroMemory(section, MAX_LINE_LENGTH * sizeof(wchar_t)); ZeroMemory(section, MAX_LINE_LENGTH * sizeof(wchar_t));

View File

@ -19,27 +19,10 @@
#include <valinet/pdb/pdb.h> #include <valinet/pdb/pdb.h>
#define _LIBVALINET_DEBUG_HOOKING_IATPATCH #define _LIBVALINET_DEBUG_HOOKING_IATPATCH
#include <valinet/hooking/iatpatch.h> #include <valinet/hooking/iatpatch.h>
#include "utility.h"
#include "symbols.h"
#include "dxgi_imp.h"
#include "ArchiveMenu.h"
#include "StartupSound.h"
#include "SettingsMonitor.h"
#include "HideExplorerSearchBar.h"
#include "StartMenu.h"
#include "GUI.h"
#include "TaskbarCenter.h"
#define WINX_ADJUST_X 5 #define WINX_ADJUST_X 5
#define WINX_ADJUST_Y 5 #define WINX_ADJUST_Y 5
#define SB_MICA_EFFECT_SUBCLASS_OFFSET 0x5BFC // 0x5C70
#define SB_INIT1 0x20054 // 0x26070
#define SB_INIT2 0x83A4 // Enable dark mode fixes
#define SB_TRACKPOPUPMENU_HOOK 0x1C774 // 0x21420
#define SB_TRACKPOPUPMENUEX_HOOK 0x1CB18 // 0x21920
#define SB_LOADIMAGEW_HOOK 0x3BEB0 // 0x4A6F0
#define CHECKFOREGROUNDELAPSED_TIMEOUT 100 #define CHECKFOREGROUNDELAPSED_TIMEOUT 100
#define POPUPMENU_SAFETOREMOVE_TIMEOUT 300 #define POPUPMENU_SAFETOREMOVE_TIMEOUT 300
#define POPUPMENU_BLUETOOTH_TIMEOUT 700 #define POPUPMENU_BLUETOOTH_TIMEOUT 700
@ -55,6 +38,21 @@ HMODULE hModule = NULL;
HANDLE hIsWinXShown = NULL; HANDLE hIsWinXShown = NULL;
HANDLE hWinXThread = NULL; HANDLE hWinXThread = NULL;
#include "utility.h"
#ifdef USE_PRIVATE_INTERFACES
#include "ep_private.h"
#endif
#include "symbols.h"
#include "dxgi_imp.h"
#include "ArchiveMenu.h"
#include "StartupSound.h"
#include "SettingsMonitor.h"
#include "HideExplorerSearchBar.h"
#include "StartMenu.h"
#include "GUI.h"
#include "TaskbarCenter.h"
#pragma region "Generics" #pragma region "Generics"
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
@ -795,7 +793,7 @@ BOOL TrackPopupMenuExHook(
#pragma endregion #pragma endregion
#pragma region "Mica effect for Explorer and remove search bar" #pragma region "Hide search bar in Explorer"
static HWND(*explorerframe_SHCreateWorkerWindowFunc)( static HWND(*explorerframe_SHCreateWorkerWindowFunc)(
WNDPROC wndProc, WNDPROC wndProc,
HWND hWndParent, HWND hWndParent,
@ -824,17 +822,15 @@ HWND WINAPI explorerframe_SHCreateWorkerWindowHook(
); );
if (dwExStyle == 0x10000 && dwStyle == 1174405120) if (dwExStyle == 0x10000 && dwStyle == 1174405120)
{ {
if (hStartIsBack64 && bMicaEffectOnTitlebar) #ifdef USE_PRIVATE_INTERFACES
if (bMicaEffectOnTitlebar)
{ {
BOOL value = TRUE; BOOL value = TRUE;
DwmSetWindowAttribute(hWndParent, DWMWA_MICA_EFFFECT, &value, sizeof(BOOL)); // Set Mica effect on title bar SetPropW(hWndParent, L"NavBarGlass", HANDLE_FLAG_INHERIT);
SetWindowSubclass( DwmSetWindowAttribute(hWndParent, DWMWA_MICA_EFFFECT, &value, sizeof(BOOL));
result, SetWindowSubclass(result, ExplorerMicaTitlebarSubclassProc, ExplorerMicaTitlebarSubclassProc, 0);
(uintptr_t)hStartIsBack64 + SB_MICA_EFFECT_SUBCLASS_OFFSET,
(uintptr_t)hStartIsBack64 + SB_MICA_EFFECT_SUBCLASS_OFFSET,
0
);
} }
#endif
if (bHideExplorerSearchBar) if (bHideExplorerSearchBar)
{ {
SetWindowSubclass(hWndParent, HideExplorerSearchBarSubClass, HideExplorerSearchBarSubClass, 0); SetWindowSubclass(hWndParent, HideExplorerSearchBarSubClass, HideExplorerSearchBarSubClass, 0);
@ -1331,6 +1327,48 @@ BOOL explorer_SetChildWindowNoActivateHook(HWND hWnd)
#pragma endregion #pragma endregion
#pragma region "Hide Show desktop button"
LRESULT(*ShellTrayWndProcFunc)(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
LRESULT ShellTrayWndProcHook(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_DESTROY:
{
break;
}
case WM_ERASEBKGND:
{
HWND v33 = FindWindowExW(hWnd, 0, L"TrayNotifyWnd", 0);
HWND v34 = FindWindowExW(v33, 0, L"TrayShowDesktopButtonWClass", 0);
if (v34)
{
/*BYTE* lpShouldDisplayCCButton = (BYTE*)(GetWindowLongPtrW(v34, 0) + 120);
if (*lpShouldDisplayCCButton)
{
*lpShouldDisplayCCButton = FALSE;
}*/
//ShowWindow(v34, SW_HIDE);
}
break;
}
}
return ShellTrayWndProcFunc(hWnd, uMsg, wParam, lParam);
}
#pragma endregion
#pragma region "Notify shell ready (fixes delay at logon)" #pragma region "Notify shell ready (fixes delay at logon)"
DWORD SignalShellReady(DWORD wait) DWORD SignalShellReady(DWORD wait)
{ {
@ -1382,6 +1420,13 @@ DWORD SignalShellReady(DWORD wait)
); );
*/ */
PositionStartMenu(0, GetStartMenuPosition()); PositionStartMenu(0, GetStartMenuPosition());
/*printf("hook show desktop\n");
void* ShellTrayWndProcFuncT = GetWindowLongPtrW(hWnd, GWLP_WNDPROC);
if (ShellTrayWndProcHook != ShellTrayWndProcFuncT)
{
ShellTrayWndProcFunc = ShellTrayWndProcFuncT;
SetWindowLongPtrW(hWnd, GWLP_WNDPROC, ShellTrayWndProcHook);
}*/
break; break;
} }
} }
@ -1538,6 +1583,7 @@ __declspec(dllexport) DWORD WINAPI main(
/*
TCHAR* wszSBPath = malloc((MAX_PATH + 1) * sizeof(TCHAR)); TCHAR* wszSBPath = malloc((MAX_PATH + 1) * sizeof(TCHAR));
if (!wszSBPath) if (!wszSBPath)
{ {
@ -1561,7 +1607,7 @@ __declspec(dllexport) DWORD WINAPI main(
); );
hStartIsBack64 = LoadLibraryW(wszSBPath); hStartIsBack64 = LoadLibraryW(wszSBPath);
free(wszSBPath); free(wszSBPath);
*/
@ -1645,19 +1691,14 @@ __declspec(dllexport) DWORD WINAPI main(
HANDLE hStobject = LoadLibraryW(L"stobject.dll"); HANDLE hStobject = LoadLibraryW(L"stobject.dll");
if (bSkinMenus) if (bSkinMenus)
{ {
if (1) // !hStartIsBack64 VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
{
VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
}
else
{
VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenu", (uintptr_t)hStartIsBack64 + SB_TRACKPOPUPMENU_HOOK);
}
} }
if (bSkinIcons && hStartIsBack64) #ifdef USE_PRIVATE_INTERFACES
if (bSkinIcons)
{ {
VnPatchDelayIAT(hStobject, "user32.dll", "LoadImageW", (uintptr_t)hStartIsBack64 + SB_LOADIMAGEW_HOOK); VnPatchDelayIAT(hStobject, "user32.dll", "LoadImageW", SystemTray_LoadImageWHook);
} }
#endif
printf("Setup stobject functions done\n"); printf("Setup stobject functions done\n");
@ -1665,39 +1706,38 @@ __declspec(dllexport) DWORD WINAPI main(
HANDLE hBthprops = LoadLibraryW(L"bthprops.cpl"); HANDLE hBthprops = LoadLibraryW(L"bthprops.cpl");
if (bSkinMenus) if (bSkinMenus)
{ {
if (1) //!hStartIsBack64 VnPatchIAT(hBthprops, "user32.dll", "TrackPopupMenuEx", TrackPopupMenuExHook);
{
VnPatchIAT(hBthprops, "user32.dll", "TrackPopupMenuEx", TrackPopupMenuExHook);
}
else
{
VnPatchIAT(hBthprops, "user32.dll", "TrackPopupMenuEx", (uintptr_t)hStartIsBack64 + SB_TRACKPOPUPMENUEX_HOOK);
}
} }
if (bSkinIcons && hStartIsBack64) #ifdef USE_PRIVATE_INTERFACES
if (bSkinIcons)
{ {
VnPatchIAT(hBthprops, "user32.dll", "LoadImageW", (uintptr_t)hStartIsBack64 + SB_LOADIMAGEW_HOOK); VnPatchIAT(hBthprops, "user32.dll", "LoadImageW", SystemTray_LoadImageWHook);
} }
#endif
printf("Setup bthprops functions done\n"); printf("Setup bthprops functions done\n");
HANDLE hPnidui = LoadLibraryW(L"pnidui.dll"); HANDLE hPnidui = LoadLibraryW(L"pnidui.dll");
VnPatchIAT(hPnidui, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", pnidui_CoCreateInstanceHook); VnPatchIAT(hPnidui, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", pnidui_CoCreateInstanceHook);
if (bSkinIcons && hStartIsBack64) #ifdef USE_PRIVATE_INTERFACES
if (bSkinIcons)
{ {
VnPatchIAT(hPnidui, "user32.dll", "LoadImageW", (uintptr_t)hStartIsBack64 + SB_LOADIMAGEW_HOOK); VnPatchIAT(hPnidui, "user32.dll", "LoadImageW", SystemTray_LoadImageWHook);
} }
#endif
printf("Setup pnidui functions done\n"); printf("Setup pnidui functions done\n");
HANDLE hSndvolsso = LoadLibraryW(L"sndvolsso.dll"); HANDLE hSndvolsso = LoadLibraryW(L"sndvolsso.dll");
if (bSkinIcons && hStartIsBack64) #ifdef USE_PRIVATE_INTERFACES
if (bSkinIcons)
{ {
VnPatchIAT(hSndvolsso, "user32.dll", "LoadImageW", (uintptr_t)hStartIsBack64 + SB_LOADIMAGEW_HOOK); VnPatchIAT(hSndvolsso, "user32.dll", "LoadImageW", SystemTray_LoadImageWHook);
} }
#endif
printf("Setup sndvolsso functions done\n"); printf("Setup sndvolsso functions done\n");
@ -1718,7 +1758,7 @@ __declspec(dllexport) DWORD WINAPI main(
printf("Installed hooks.\n"); printf("Installed hooks.\n");
/*
if (hStartIsBack64) if (hStartIsBack64)
{ {
((void(*)())((uintptr_t)hStartIsBack64 + SB_INIT1))(); ((void(*)())((uintptr_t)hStartIsBack64 + SB_INIT1))();
@ -1727,7 +1767,7 @@ __declspec(dllexport) DWORD WINAPI main(
printf("Loaded and initialized StartIsBack64 DLL\n"); printf("Loaded and initialized StartIsBack64 DLL\n");
} }
*/
HANDLE hEvent = CreateEventEx( HANDLE hEvent = CreateEventEx(

View File

@ -21,7 +21,8 @@
"HideControlCenterButton"=dword:00000000 "HideControlCenterButton"=dword:00000000
;b Apply immersive style to system tray icon menus * ;b Apply immersive style to system tray icon menus *
"SkinMenus"=dword:00000001 "SkinMenus"=dword:00000001
;b Apply Windows 11 style to system tray icons (requires StartAllBackX64.dll) * ;p 2
;b Apply Windows 11 style to system tray icons *
"SkinIcons"=dword:00000001 "SkinIcons"=dword:00000001
;T File Explorer ;T File Explorer
@ -37,7 +38,8 @@
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Hide search bar completely * ;b Hide search bar completely *
"HideExplorerSearchBar"=dword:00000000 "HideExplorerSearchBar"=dword:00000000
;b Mica effect on title bar (requires StartAllBackX64.dll) * ;p 2
;b Mica effect on title bar *
"MicaEffectOnTitlebar"=dword:00000000 "MicaEffectOnTitlebar"=dword:00000000
;T Start menu ;T Start menu

View File

@ -1,5 +1,8 @@
#ifndef _H_UTILITY_H_ #ifndef _H_UTILITY_H_
#define _H_UTILITY_H_ #define _H_UTILITY_H_
#if __has_include("ep_private.h")
#define USE_PRIVATE_INTERFACES
#endif
#include <Windows.h> #include <Windows.h>
#include <tchar.h> #include <tchar.h>
#include <windows.data.xml.dom.h> #include <windows.data.xml.dom.h>

View File

@ -27,11 +27,6 @@ In the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section,
* disable the immersive contex menu system-wide * disable the immersive contex menu system-wide
* disable the Windows 11 File Explorer command bar * disable the Windows 11 File Explorer command bar
Also, if you place the `StartAllBackX64.dll` file from StartAllback (needs a DLL with SHA-256: `D8D1484D6F7DE94C5018B03A5A93EE8BBB7795BCA5408A721CBB74BE28065689`) in the folder `%appdata%\ExplorerPatcher` (create if it does not exist), the following additional features will be enabled:
* option to apply Mica effect on File Explorer windows
* option to skin system tray icons to match Windows 11 style
After you have completed the above setup, make sure you have an active Internet connection and restart the Explorer process using Task Manager or by issuing the following command: `taskkill /f /im explorer.exe`. Once File Explorer restarts, some necessary files (symbol files) will be downloaded from Microsoft (around 50MB). This should be relatively quick, depending on your Internet connection speed. When this is done, File Explorer will restart again and will be ready for use. Notifications should show up informing you about the progress, and you can also use Task Manager to watch for network activity. This process only happens when a new Windows 11 build is installed on the machine. After you have completed the above setup, make sure you have an active Internet connection and restart the Explorer process using Task Manager or by issuing the following command: `taskkill /f /im explorer.exe`. Once File Explorer restarts, some necessary files (symbol files) will be downloaded from Microsoft (around 50MB). This should be relatively quick, depending on your Internet connection speed. When this is done, File Explorer will restart again and will be ready for use. Notifications should show up informing you about the progress, and you can also use Task Manager to watch for network activity. This process only happens when a new Windows 11 build is installed on the machine.
Now, the classic taskbar should be enabled. Still, there is some more setup to do, depending on your preferences. Now, the classic taskbar should be enabled. Still, there is some more setup to do, depending on your preferences.