diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ade31b..9590adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and r * Setup program version is synchronized with the version of the application (.2) * Fixed a mismatch between the default value for the setting "Add shortcut to program settings in Win+X menu" displayed in the UI and actually used in the software (#352) (.2) * Fixed an issue that prevented "Restore default settings" in the "Properties" UI from working (#374) (.3) +* Improved some wording in the Properties UI (#377) (.4) +* Added option to show separators between toolbars in the taskbar (#379) (.4) ## 22000.318.36 diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index f79b1fa..e7376f2 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -70,6 +70,7 @@ DWORD bTaskbarMonitorOverride = 0; DWORD dwIMEStyle = 0; DWORD dwTaskbarAl = 0; DWORD bShowUpdateToast = FALSE; +DWORD bToolbarSeparators = FALSE; HMODULE hModule = NULL; HANDLE hDelayedInjectionThread = NULL; HANDLE hIsWinXShown = NULL; @@ -3408,6 +3409,15 @@ void WINAPI LoadSettings(BOOL bIsExplorer) &bShowUpdateToast, &dwSize ); + dwSize = sizeof(DWORD); + RegQueryValueExW( + hKey, + TEXT("ToolbarSeparators"), + 0, + NULL, + &bToolbarSeparators, + &dwSize + ); RegCloseKey(hKey); } @@ -3701,6 +3711,15 @@ HWND CreateWindowExWHook( dwExStyle |= WS_EX_CLIENTEDGE; } } + if (bIsExplorerProcess && bToolbarSeparators && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L"ReBarWindow32")) + { + wchar_t wszClassName[200]; + GetClassNameW(hWndParent, wszClassName, 200); + if (!wcscmp(wszClassName, L"Shell_TrayWnd")) + { + dwStyle |= RBS_BANDBORDERS; + } + } HWND hWnd = CreateWindowExWFunc( dwExStyle, lpClassName, @@ -3744,6 +3763,62 @@ HWND CreateWindowExWHook( return hWnd; } +LONG_PTR(*SetWindowLongPtrWFunc)( + HWND hWnd, + int nIndex, + LONG_PTR dwNewLong + ); +LONG_PTR SetWindowLongPtrWHook( + HWND hWnd, + int nIndex, + LONG_PTR dwNewLong +) +{ + WCHAR lpClassName[200]; + GetClassNameW(hWnd, lpClassName, 200); + HWND hWndParent = GetParent(hWnd); + + if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L"TrayNotifyWnd")) + { + if (nIndex == GWL_EXSTYLE) + { + dwNewLong |= WS_EX_STATICEDGE; + } + } + if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L"NotifyIconOverflowWindow")) + { + if (nIndex == GWL_EXSTYLE) + { + dwNewLong |= WS_EX_STATICEDGE; + } + } + if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && (!wcscmp(lpClassName, L"SysListView32") || !wcscmp(lpClassName, L"SysTreeView32"))) // !wcscmp(lpClassName, L"FolderView") + { + wchar_t wszClassName[200]; + GetClassNameW(GetAncestor(hWndParent, GA_ROOT), wszClassName, 200); + if (!wcscmp(wszClassName, L"CabinetWClass")) + { + if (nIndex == GWL_EXSTYLE) + { + dwNewLong |= WS_EX_CLIENTEDGE; + } + } + } + if (bIsExplorerProcess && bToolbarSeparators && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L"ReBarWindow32")) + { + wchar_t wszClassName[200]; + GetClassNameW(hWndParent, wszClassName, 200); + if (!wcscmp(wszClassName, L"Shell_TrayWnd")) + { + if (nIndex == GWL_STYLE) + { + dwNewLong |= RBS_BANDBORDERS; + } + } + } + return SetWindowLongPtrWFunc(hWnd, nIndex, dwNewLong); +} + #ifdef _WIN64 HRESULT (*explorer_SetWindowThemeFunc)( HWND hwnd, @@ -4549,6 +4624,8 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) { CreateWindowExWFunc = CreateWindowExW; VnPatchIAT(hShell32, "user32.dll", "CreateWindowExW", CreateWindowExWHook); + SetWindowLongPtrWFunc = SetWindowLongPtrW; + VnPatchIAT(hShell32, "user32.dll", "SetWindowLongPtrW", SetWindowLongPtrWHook); } } else @@ -4558,6 +4635,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) if (!bIsExplorer) { VnPatchIAT(hShell32, "user32.dll", "CreateWindowExW", CreateWindowExW); + VnPatchIAT(hShell32, "user32.dll", "SetWindowLongPtrW", SetWindowLongPtrW); } FreeLibrary(hShell32); FreeLibrary(hShell32); @@ -4584,6 +4662,8 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) { CreateWindowExWFunc = CreateWindowExW; VnPatchIAT(hExplorerFrame, "user32.dll", "CreateWindowExW", CreateWindowExWHook); + SetWindowLongPtrWFunc = SetWindowLongPtrW; + VnPatchIAT(hExplorerFrame, "user32.dll", "SetWindowLongPtrW", SetWindowLongPtrWHook); } } else @@ -4594,6 +4674,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) if (!bIsExplorer) { VnPatchIAT(hExplorerFrame, "user32.dll", "CreateWindowExW", CreateWindowExW); + VnPatchIAT(hExplorerFrame, "user32.dll", "SetWindowLongPtrW", SetWindowLongPtrW); } FreeLibrary(hExplorerFrame); FreeLibrary(hExplorerFrame); @@ -4608,6 +4689,8 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) { CreateWindowExWFunc = CreateWindowExW; VnPatchIAT(hWindowsUIFileExplorer, "user32.dll", "CreateWindowExW", CreateWindowExWHook); + SetWindowLongPtrWFunc = SetWindowLongPtrW; + VnPatchIAT(hWindowsUIFileExplorer, "user32.dll", "SetWindowLongPtrW", SetWindowLongPtrWHook); } } else @@ -4617,6 +4700,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) if (!bIsExplorer) { VnPatchIAT(hWindowsUIFileExplorer, "user32.dll", "CreateWindowExW", CreateWindowExW); + VnPatchIAT(hWindowsUIFileExplorer, "user32.dll", "SetWindowLongPtrW", SetWindowLongPtrW); } FreeLibrary(hWindowsUIFileExplorer); FreeLibrary(hWindowsUIFileExplorer); @@ -4935,6 +5019,17 @@ DWORD Inject(BOOL bIsExplorer) FreeLibraryAndExitThread(hModule, rv); return rv; } + SetWindowLongPtrWFunc = SetWindowLongPtrW; + rv = funchook_prepare( + funchook, + (void**)&SetWindowLongPtrWFunc, + SetWindowLongPtrWHook + ); + if (rv != 0) + { + FreeLibraryAndExitThread(hModule, rv); + return rv; + } diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index 1e09b50..6c940ac 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -44,9 +44,10 @@ ;b Show Desktop button "TaskbarSD"=dword:00000001 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +;b Show separators between toolbars * +"ToolbarSeparators"=dword:00000000 ;b Add shortcut to program settings in Win+X menu "PropertiesInWinX"=dword:00000000 -;t ;T System tray ;y Enable missing system tray icons 🡕 diff --git a/version.h b/version.h index a07828e..5360a40 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22000 #define VER_MINOR 318 #define VER_BUILD_HI 37 -#define VER_BUILD_LO 3 +#define VER_BUILD_LO 4 #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.37.3" -#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.37.3" +#define VER_FILE_STRING VALUE "FileVersion", "22000.318.37.4" +#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.37.4"