Browse Source

Merge branch 'master' of https://github.com/valinet/ExplorerPatcher into valinet-master

pull/979/head
PenguinLucky 4 years ago
parent
commit
496d043951
  1. 2
      CHANGELOG.md
  2. 69
      ExplorerPatcher/GUI.c
  3. 261
      ExplorerPatcher/TaskbarCenter.c
  4. 5
      ExplorerPatcher/TaskbarCenter.h
  5. 139
      ExplorerPatcher/dllmain.c
  6. 35
      ExplorerPatcher/settings.reg
  7. 6
      version.h

2
CHANGELOG.md

@ -16,6 +16,7 @@ Please make sure you are connected to the Internet while installing, the applica @@ -16,6 +16,7 @@ Please make sure you are connected to the Internet while installing, the applica
* Implemented Weather widget for the classic taskbar, similar to what is available in the more recent updates to Windows 10. Read more about it [here](https://github.com/valinet/ExplorerPatcher/wiki/Weather).
* Implemented 2 features that help in replacing the functionality of the quick launch toolbar with pinned taskbar items. Read more about it [here](https://github.com/valinet/ExplorerPatcher/discussions/819) (.7).
* Implemented option to have the Start menu open on a specific monitor (#821) (.8)
* Options to center Windows 10 taskbar (.26)
#### Feature enhancements
@ -60,6 +61,7 @@ Please make sure you are connected to the Internet while installing, the applica @@ -60,6 +61,7 @@ Please make sure you are connected to the Internet while installing, the applica
* Fixed program windows in older 22000-based OS builds (.21)
* Fixed a bug that prevented correct displaying of the weather widget contents when using a right-to-left language (#954) (.22)
* Fixed a bug that prevented the Windows 10 Start menu from working in full screen mode (.23)
* Fixed a bug that presented the weather widget with a wrong height when using the taskbar vertically (.26)
## 22000.469.41

69
ExplorerPatcher/GUI.c

@ -14,6 +14,40 @@ static BOOL(*ShouldAppsUseDarkMode)() = NULL; @@ -14,6 +14,40 @@ static BOOL(*ShouldAppsUseDarkMode)() = NULL;
DWORD dwTaskbarPosition = 3;
BOOL gui_bOldTaskbar = TRUE;
LSTATUS SetPolicy(HKEY hKey, LPCWSTR wszPolicyPath, LPCWSTR wszPolicyName, DWORD dwVal)
{
WCHAR wszPath[MAX_PATH];
GetSystemDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\reg.exe");
WCHAR wszArguments[MAX_PATH];
if (dwVal)
{
swprintf_s(wszArguments, MAX_PATH, L"ADD \"%s\\%s\" /V %s /T REG_DWORD /D %d /F", (hKey == HKEY_LOCAL_MACHINE ? L"HKLM" : L"HKCU"), wszPolicyPath, wszPolicyName, dwVal);
}
else
{
swprintf_s(wszArguments, MAX_PATH, L"DELETE \"%s\\%s\" /V %s /F", (hKey == HKEY_LOCAL_MACHINE ? L"HKLM" : L"HKCU"), wszPolicyPath, wszPolicyName);
}
SHELLEXECUTEINFO ShExecInfo = { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = L"runas";
ShExecInfo.lpFile = wszPath;
ShExecInfo.lpParameters = wszArguments;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_HIDE;
ShExecInfo.hInstApp = NULL;
if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)
{
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
DWORD dwExitCode = 0;
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
CloseHandle(ShExecInfo.hProcess);
}
return ERROR_SUCCESS;
}
int GUI_DeleteWeatherFolder()
{
WCHAR wszWorkFolder[MAX_PATH + 1];
@ -420,36 +454,11 @@ LSTATUS GUI_Internal_RegSetValueExW( @@ -420,36 +454,11 @@ LSTATUS GUI_Internal_RegSetValueExW(
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_ForceStartSize"))
{
WCHAR wszPath[MAX_PATH];
GetSystemDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\reg.exe");
WCHAR wszArguments[MAX_PATH];
if (*(DWORD*)lpData)
{
swprintf_s(wszArguments, MAX_PATH, L"ADD \"HKCU\\Software\\Policies\\Microsoft\\Windows\\Explorer\" /V ForceStartSize /T REG_DWORD /D %d /F", *(DWORD*)lpData);
return SetPolicy(HKEY_CURRENT_USER, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer", L"ForceStartSize", *(DWORD*)lpData);
}
else
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_NoStartMenuMorePrograms"))
{
swprintf_s(wszArguments, MAX_PATH, L"DELETE \"HKCU\\Software\\Policies\\Microsoft\\Windows\\Explorer\" /V ForceStartSize /F");
}
SHELLEXECUTEINFO ShExecInfo = { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = L"runas";
ShExecInfo.lpFile = wszPath;
ShExecInfo.lpParameters = wszArguments;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_HIDE;
ShExecInfo.hInstApp = NULL;
if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)
{
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
DWORD dwExitCode = 0;
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
CloseHandle(ShExecInfo.hProcess);
}
return ERROR_SUCCESS;
return SetPolicy(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", L"NoStartMenuMorePrograms", *(DWORD*)lpData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_DisableRoundedCorners"))
{
@ -658,6 +667,10 @@ LSTATUS GUI_Internal_RegQueryValueExW( @@ -658,6 +667,10 @@ LSTATUS GUI_Internal_RegQueryValueExW(
{
return RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer", L"ForceStartSize", RRF_RT_DWORD, NULL, lpData, lpcbData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_NoStartMenuMorePrograms"))
{
return RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", L"NoStartMenuMorePrograms", RRF_RT_DWORD, NULL, lpData, lpcbData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_DisableRoundedCorners"))
{
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, _T(EP_DWM_EVENTNAME));

261
ExplorerPatcher/TaskbarCenter.c

@ -1,62 +1,247 @@ @@ -1,62 +1,247 @@
#include "TaskbarCenter.h"
HANDLE hEvent;
extern DWORD dwOldTaskbarAl;
extern DWORD dwMMOldTaskbarAl;
extern wchar_t* EP_TASKBAR_LENGTH_PROP_NAME;
#define EP_TASKBAR_LENGTH_TOO_SMALL 20
HRESULT TaskbarCenter_Center()
inline BOOL TaskbarCenter_IsTaskbarHorizontal(HWND hWnd)
{
HRESULT hr = S_OK;
HWND hWnd = FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL);
while (hWnd)
{
if (SUCCEEDED(hr))
{
/*hr = AccessibleObjectFromWindow(
);*/
}
__int64 v1;
__int64 result;
v1 = *((__int64*)GetWindowLongPtrW(hWnd, 0) + 13);
result = 1i64;
if (v1)
return (*(__int64(__fastcall**)(__int64))(*(__int64*)v1 + 96))(v1);
return result;
}
hWnd = NULL;
}
inline BOOL TaskbarCenter_ShouldCenter(DWORD dwSetting)
{
return (dwSetting & 0b001);
}
inline BOOL TaskbarCenter_ShouldStartBeCentered(DWORD dwSetting)
{
return (dwSetting & 0b010);
}
BOOL TaskbarCenter_Notify()
inline BOOL TaskbarCenter_ShouldLeftAlignWhenSpaceConstrained(DWORD dwSetting)
{
if (hEvent)
{
SetEvent(hEvent);
return TRUE;
}
return FALSE;
return (dwSetting & 0b100);
}
BOOL GetClientRectHook(HWND hWnd, LPRECT lpRect)
HRESULT TaskbarCenter_Center(HWND hWnd, RECT rc, BOOL bIsTaskbarHorizontal)
{
wchar_t wszClassName[100];
ZeroMemory(wszClassName, 100);
GetClassNameW(hWnd, wszClassName, 100);
if (!wcscmp(wszClassName, L"MSTaskListWClass"))
HRESULT hr = S_OK;
VARIANT vtChild[10];
VARIANT vt;
long k = 0, kk = 0;
IAccessible* pAccessible = NULL;
AccessibleObjectFromWindow(hWnd, 0, &IID_IAccessible, &pAccessible);
if (pAccessible)
{
pAccessible->lpVtbl->get_accChildCount(pAccessible, &kk);
if (kk <= 10)
{
AccessibleChildren(pAccessible, 0, kk, vtChild, &k);
for (int i = 0; i < k; ++i)
{
if (vtChild[i].vt == VT_DISPATCH)
{
TaskbarCenter_Center();
IDispatch* pDisp = vtChild[i].ppdispVal;
IAccessible* pChild = NULL;
pDisp->lpVtbl->QueryInterface(pDisp, &IID_IAccessible, &pChild);
if (pChild)
{
vt.vt = VT_I4;
vt.lVal = CHILDID_SELF;
pChild->lpVtbl->get_accRole(pChild, vt, &vt);
if (vt.lVal == ROLE_SYSTEM_TOOLBAR)
{
IAccessible* pLast = NULL;
kk = 0;
pChild->lpVtbl->get_accChildCount(pChild, &kk);
if (kk <= 1)
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, -1);
}
return GetClientRect(hWnd, lpRect);
else if (kk >= 2)
{
vt.vt = VT_I4;
vt.lVal = kk - 1;
long x = 0, y = 0, w = 0, h = 0, d = 0;
pChild->lpVtbl->accLocation(pChild, &x, &y, &w, &h, vt);
if (bIsTaskbarHorizontal ? (x == -1 || w < EP_TASKBAR_LENGTH_TOO_SMALL) : (y == -1 || h < EP_TASKBAR_LENGTH_TOO_SMALL))
{
hr = E_FAIL;
}
else
{
if (kk >= 3)
{
d = (bIsTaskbarHorizontal ? ((x - rc.left) + w) : ((y - rc.top) + h));
vt.vt = VT_I4;
vt.lVal = 1;
x = 0, y = 0, w = 0, h = 0;
pChild->lpVtbl->accLocation(pChild, &x, &y, &w, &h, vt);
if (bIsTaskbarHorizontal ? w == 0 : h == 0)
{
vt.vt = VT_I4;
vt.lVal = 2;
x = 0, y = 0, w = 0, h = 0;
pChild->lpVtbl->accLocation(pChild, &x, &y, &w, &h, vt);
}
if (bIsTaskbarHorizontal ? (x == -1 || w < EP_TASKBAR_LENGTH_TOO_SMALL) : (y == -1 || h < EP_TASKBAR_LENGTH_TOO_SMALL))
{
hr == E_FAIL;
}
else
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (bIsTaskbarHorizontal ? (d - (x - rc.left)) : (d - (y - rc.top))));
}
}
else
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, bIsTaskbarHorizontal ? w : h);
}
}
}
}
pChild->lpVtbl->Release(pChild);
}
pDisp->lpVtbl->Release(pDisp);
}
}
}
pAccessible->lpVtbl->Release(pAccessible);
}
return hr;
}
HRESULT TaskbarCenter_Initialize(HMODULE hExplorer)
BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
{
if (!(hEvent = CreateEventW(NULL, TRUE, FALSE, TASKBAR_CHANGED_NOTIFICATION)))
BOOL bWasCalled = FALSE;
HWND hWndStart = NULL;
RECT rcStart;
SetRect(&rcStart, 0, 0, 0, 0);
if (GetClassWord(hWnd, GCW_ATOM) == RegisterWindowMessageW(L"MSTaskListWClass"))
{
BOOL bIsPrimaryTaskbar = GetClassWord(GetParent(hWnd), GCW_ATOM) == RegisterWindowMessageW(L"MSTaskSwWClass");
DWORD dwSetting = (bIsPrimaryTaskbar ? dwOldTaskbarAl : dwMMOldTaskbarAl);
HWND hWndTaskbar = NULL;
if (bIsPrimaryTaskbar)
{
return E_NOTIMPL;
hWndTaskbar = GetParent(GetParent(GetParent(hWnd)));
}
if (FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL))
else
{
return E_NOTIMPL;
hWndTaskbar = GetParent(GetParent(hWnd));
}
// This is one of the methods called by explorer!CTaskListWnd::_RecomputeLayout
if (!VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", GetClientRectHook))
hWndStart = FindWindowExW(hWndTaskbar, NULL, L"Start", NULL);
BOOL bIsTaskbarHorizontal = TaskbarCenter_IsTaskbarHorizontal(hWnd);
if (TaskbarCenter_ShouldCenter(dwSetting))
{
return E_NOTIMPL;
if (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)
{
GetClientRect(hWndStart, &rcStart);
}
return S_OK;
RECT rc;
GetWindowRect(hWnd, &rc);
MONITORINFO mi;
ZeroMemory(&mi, sizeof(MONITORINFO));
mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfoW(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), &mi);
DWORD dwLength = 0;
TaskbarCenter_Center(hWnd, mi.rcMonitor, bIsTaskbarHorizontal);
if (dwLength = GetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME))
{
if (dwLength == -1)
{
if (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)
{
if (bIsTaskbarHorizontal)
{
SetWindowPos(hWndStart, NULL, ((mi.rcMonitor.right - mi.rcMonitor.left) - (rcStart.right - rcStart.left)) / 2, rcStart.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
}
else
{
SetWindowPos(hWndStart, NULL, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
}
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
}
}
else
{
if (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)
{
dwLength += (bIsTaskbarHorizontal ? (rcStart.right - rcStart.left) : (rcStart.bottom - rcStart.top));
}
bWasCalled = GetClientRect(hWnd, lpRect);
long res = 0;
if (bIsTaskbarHorizontal)
{
res = ((mi.rcMonitor.right - mi.rcMonitor.left) - dwLength) / 2 - (!TaskbarCenter_ShouldStartBeCentered(dwSetting) ? (rc.left - mi.rcMonitor.left) : 0);
}
else
{
res = ((mi.rcMonitor.bottom - mi.rcMonitor.top) - dwLength) / 2 - (!TaskbarCenter_ShouldStartBeCentered(dwSetting) ? (rc.top - mi.rcMonitor.top) : 0);
}
if (res + dwLength + 5 - (TaskbarCenter_ShouldStartBeCentered(dwSetting) ? (bIsTaskbarHorizontal ? (rc.left - mi.rcMonitor.left) : (rc.top - mi.rcMonitor.top)) : 0) < (bIsTaskbarHorizontal ? lpRect->right : lpRect->bottom))
{
if (bIsTaskbarHorizontal)
{
lpRect->left = res;
}
else
{
lpRect->top = res;
}
if (TaskbarCenter_ShouldLeftAlignWhenSpaceConstrained(dwSetting) || !bIsTaskbarHorizontal)
{
if (bIsTaskbarHorizontal)
{
lpRect->right = (TaskbarCenter_ShouldStartBeCentered(dwSetting) ? (rc.left - mi.rcMonitor.left) : 0) + 10 + lpRect->right;
}
else
{
lpRect->bottom = (TaskbarCenter_ShouldStartBeCentered(dwSetting) ? (rc.top - mi.rcMonitor.top) : 0) + 10 + lpRect->bottom;
}
}
}
if (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)
{
if (bIsTaskbarHorizontal)
{
SetWindowPos(hWndStart, NULL, (rc.left - mi.rcMonitor.left) + lpRect->left - (rcStart.right - rcStart.left), rcStart.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
}
else
{
SetWindowPos(hWndStart, NULL, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
}
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
}
}
}
}
else
{
if (GetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME))
{
RemovePropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME);
}
}
if ((!TaskbarCenter_ShouldCenter(dwSetting) || !TaskbarCenter_ShouldStartBeCentered(dwSetting)) && hWndStart)
{
GetWindowRect(hWndStart, &rcStart);
if (rcStart.left != 0 || rcStart.top != 0)
{
SetWindowPos(hWndStart, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
}
}
}
if (bWasCalled) return bWasCalled;
return GetClientRect(hWnd, lpRect);
}

5
ExplorerPatcher/TaskbarCenter.h

@ -3,10 +3,9 @@ @@ -3,10 +3,9 @@
#include <initguid.h>
#include <Windows.h>
#include <oleacc.h>
#include <tchar.h>
#pragma comment(lib, "Oleacc.lib")
#include <valinet/hooking/iatpatch.h>
#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification_{B37553B7-425C-44F6-A04A-126849EE59CB}"
HRESULT TaskbarCenter_Initialize(HMODULE);
BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect);
#endif

139
ExplorerPatcher/dllmain.c

@ -125,6 +125,8 @@ DWORD bWasPinnedItemsActAsQuickLaunch = FALSE; @@ -125,6 +125,8 @@ DWORD bWasPinnedItemsActAsQuickLaunch = FALSE;
DWORD bPinnedItemsActAsQuickLaunch = FALSE;
DWORD bWasRemoveExtraGapAroundPinnedItems = FALSE;
DWORD bRemoveExtraGapAroundPinnedItems = FALSE;
DWORD dwOldTaskbarAl = 0b110;
DWORD dwMMOldTaskbarAl = 0b110;
int Code = 0;
HRESULT InjectStartFromExplorer();
void InvokeClockFlyout();
@ -179,6 +181,7 @@ DWORD S_Icon_Dark_Widgets = 0; @@ -179,6 +181,7 @@ DWORD S_Icon_Dark_Widgets = 0;
#include "ImmersiveFlyouts.h"
#include "updates.h"
DWORD dwUpdatePolicy = UPDATE_POLICY_DEFAULT;
wchar_t* EP_TASKBAR_LENGTH_PROP_NAME = _T("ExplorerPatcher_") _T(EP_CLSID) _T("_Length");
HRESULT WINAPI _DllRegisterServer();
HRESULT WINAPI _DllUnregisterServer();
@ -744,6 +747,19 @@ LRESULT CALLBACK EP_Service_Window_WndProc( @@ -744,6 +747,19 @@ LRESULT CALLBACK EP_Service_Window_WndProc(
InvokeClockFlyout();
return 0;
}
else if (uMsg == WM_TIMER && wParam == 1)
{
SendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L"ConvertibleSlateMode");
SetTimer(hWnd, 2, 1000, NULL);
KillTimer(hWnd, 1);
return 0;
}
else if (uMsg == WM_TIMER && wParam == 2)
{
SendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L"ConvertibleSlateMode");
KillTimer(hWnd, 2);
return 0;
}
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
@ -779,6 +795,10 @@ DWORD EP_ServiceWindowThread(DWORD unused) @@ -779,6 +795,10 @@ DWORD EP_ServiceWindowThread(DWORD unused)
RegisterHotKey(hWnd, 1, MOD_WIN | MOD_NOREPEAT, 'C');
}
RegisterHotKey(hWnd, 2, MOD_WIN | MOD_ALT, 'D');
if (bOldTaskbar && (dwOldTaskbarAl || dwMMOldTaskbarAl))
{
SetTimer(hWnd, 1, 5000, NULL);
}
MSG msg;
BOOL bRet;
while ((bRet = GetMessageW(&msg, NULL, 0, 0)) != 0)
@ -4099,6 +4119,8 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz) @@ -4099,6 +4119,8 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)
int PeopleBand_MulDivHook(int nNumber, int nNumerator, int nDenominator)
{
if (nNumber != 46) // 46 = vertical taskbar, 48 = horizontal taskbar
{
//printf("[MulDivHook] %d %d %d\n", nNumber, nNumerator, nDenominator);
AcquireSRWLockShared(&lock_epw);
if (epw)
@ -4141,6 +4163,7 @@ int PeopleBand_MulDivHook(int nNumber, int nNumerator, int nDenominator) @@ -4141,6 +4163,7 @@ int PeopleBand_MulDivHook(int nNumber, int nNumerator, int nDenominator)
}
}
ReleaseSRWLockShared(&lock_epw);
}
return MulDiv(nNumber, nNumerator, nDenominator);
}
@ -5271,11 +5294,12 @@ DWORD WindowSwitcher(DWORD unused) @@ -5271,11 +5294,12 @@ DWORD WindowSwitcher(DWORD unused)
#pragma region "Load Settings from registry"
#define REFRESHUI_NONE 0b0000
#define REFRESHUI_GLOM 0b0001
#define REFRESHUI_ORB 0b0010
#define REFRESHUI_PEOPLE 0b0100
#define REFRESHUI_TASKBAR 0b1000
#define REFRESHUI_NONE 0b00000
#define REFRESHUI_GLOM 0b00001
#define REFRESHUI_ORB 0b00010
#define REFRESHUI_PEOPLE 0b00100
#define REFRESHUI_TASKBAR 0b01000
#define REFRESHUI_CENTER 0b10000
void WINAPI LoadSettings(LPARAM lParam)
{
BOOL bIsExplorer = LOWORD(lParam);
@ -5468,6 +5492,36 @@ void WINAPI LoadSettings(LPARAM lParam) @@ -5468,6 +5492,36 @@ void WINAPI LoadSettings(LPARAM lParam)
);
}
dwSize = sizeof(DWORD);
dwTemp = 0;
RegQueryValueExW(
hKey,
TEXT("OldTaskbarAl"),
0,
NULL,
&dwTemp,
&dwSize
);
if (dwTemp != dwOldTaskbarAl)
{
dwOldTaskbarAl = dwTemp;
dwRefreshUIMask |= REFRESHUI_CENTER;
}
dwSize = sizeof(DWORD);
dwTemp = 0;
RegQueryValueExW(
hKey,
TEXT("MMOldTaskbarAl"),
0,
NULL,
&dwTemp,
&dwSize
);
if (dwTemp != dwMMOldTaskbarAl)
{
dwMMOldTaskbarAl = dwTemp;
dwRefreshUIMask |= REFRESHUI_CENTER;
}
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("HideExplorerSearchBar"),
@ -6093,6 +6147,10 @@ void WINAPI LoadSettings(LPARAM lParam) @@ -6093,6 +6147,10 @@ void WINAPI LoadSettings(LPARAM lParam)
if (bOldTaskbar && (dwTemp != dwTaskbarGlomLevel))
{
dwRefreshUIMask = REFRESHUI_GLOM;
if (dwOldTaskbarAl)
{
dwRefreshUIMask = REFRESHUI_CENTER;
}
}
dwTaskbarGlomLevel = dwTemp;
dwTemp = MMTASKBARGLOMLEVEL_DEFAULT;
@ -6108,6 +6166,10 @@ void WINAPI LoadSettings(LPARAM lParam) @@ -6108,6 +6166,10 @@ void WINAPI LoadSettings(LPARAM lParam)
if (bOldTaskbar && (dwTemp != dwMMTaskbarGlomLevel))
{
dwRefreshUIMask = REFRESHUI_GLOM;
if (dwMMOldTaskbarAl)
{
dwRefreshUIMask = REFRESHUI_CENTER;
}
}
dwMMTaskbarGlomLevel = dwTemp;
RegCloseKey(hKey);
@ -6338,6 +6400,15 @@ void WINAPI LoadSettings(LPARAM lParam) @@ -6338,6 +6400,15 @@ void WINAPI LoadSettings(LPARAM lParam)
RegSetKeyValueW(HKEY_CURRENT_USER, IsWindows11() ? TEXT(REGPATH) : L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"TaskbarGlomLevel", REG_DWORD, &dwGlomLevel, sizeof(DWORD));
Explorer_RefreshUI(0);*/
}
if (dwRefreshUIMask & REFRESHUI_CENTER)
{
#ifdef _WIN64
//SendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L"ConvertibleSlateMode");
ToggleTaskbarAutohide();
Sleep(1000);
ToggleTaskbarAutohide();
#endif
}
}
}
@ -8935,15 +9006,15 @@ DWORD Inject(BOOL bIsExplorer) @@ -8935,15 +9006,15 @@ DWORD Inject(BOOL bIsExplorer)
// This notifies applications when the taskbar has recomputed its layout
/*if (SUCCEEDED(TaskbarCenter_Initialize(hExplorer)))
if (VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook))
{
printf("Initialized taskbar update notification.\n");
printf("Initialized taskbar centering module.\n");
}
else
{
printf("Failed to register taskbar update notification.\n");
}*/
printf("Failed to initialize taskbar centering module.\n");
}
@ -8997,6 +9068,7 @@ char VisibilityChangedEventArguments_GetVisible(__int64 a1) @@ -8997,6 +9068,7 @@ char VisibilityChangedEventArguments_GetVisible(__int64 a1)
return v3[0];
}
DWORD Start_NoStartMenuMorePrograms = 0;
DWORD Start_ForceStartSize = 0;
DWORD StartMenu_maximumFreqApps = 6;
DWORD StartMenu_ShowAllApps = 0;
@ -9191,6 +9263,43 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged) @@ -9191,6 +9263,43 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged)
exit(0);
}
Start_ForceStartSize = dwVal;
RegCloseKey(hKey);
}
RegCreateKeyExW(
HKEY_CURRENT_USER,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_READ,
NULL,
&hKey,
NULL
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwSize = sizeof(DWORD);
dwVal = 0;
RegQueryValueExW(
hKey,
TEXT("NoStartMenuMorePrograms"),
0,
NULL,
&dwVal,
&dwSize
);
if (bRestartIfChanged && dwVal != Start_NoStartMenuMorePrograms)
{
exit(0);
}
Start_NoStartMenuMorePrograms = dwVal;
RegCloseKey(hKey);
}
}
@ -9871,7 +9980,7 @@ void InjectStartMenu() @@ -9871,7 +9980,7 @@ void InjectStartMenu()
VnPatchDelayIAT(hStartDocked, "ext-ms-win-ntuser-draw-l1-1-0.dll", "SetWindowRgn", StartDocked_SetWindowRgn);
}
Setting* settings = calloc(5, sizeof(Setting));
Setting* settings = calloc(6, sizeof(Setting));
settings[0].callback = NULL;
settings[0].data = NULL;
settings[0].hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
@ -9902,10 +10011,16 @@ void InjectStartMenu() @@ -9902,10 +10011,16 @@ void InjectStartMenu()
settings[4].hKey = NULL;
wcscpy_s(settings[4].name, MAX_PATH, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer");
settings[4].origin = HKEY_CURRENT_USER;
settings[5].callback = StartMenu_LoadSettings;
settings[5].data = TRUE;
settings[5].hEvent = NULL;
settings[5].hKey = NULL;
wcscpy_s(settings[5].name, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer");
settings[5].origin = HKEY_CURRENT_USER;
SettingsChangeParameters* params = calloc(1, sizeof(SettingsChangeParameters));
params->settings = settings;
params->size = 5;
params->size = 6;
CreateThread(
0,
0,

35
ExplorerPatcher/settings.reg

@ -47,16 +47,30 @@ Windows Registry Editor Version 5.00 @@ -47,16 +47,30 @@ Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b タスクバーを自動で隠す
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_AutoHideTaskbar"=dword:00000000
;t 以下の設定は、Windows 10のタスクバーだけに適用されます。:
;t The following settings only apply to the Windows 10 taskbar:
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 2 スタートボタンスタイル
;x 0 Windows 10 (デフォルト)
;x 1 Windows 11
"OrbStyle"=dword:00000000
;c 3 プライマリタスクバーにタスクバーアイコンをまとめる
;x 0 常に組み合わせる
;x 1 タスクバーが一杯のときに結合する
;x 2 絶対に組み合わせない (デフォルト)
;c 5 Primary taskbar alignment
;x 0 At screen edge (default)
;x 1 Centered
;x 5 Centered, at screen edge when full
;x 3 Centered with Start button
;x 7 Centered with Start button, at screen edge when full
"OldTaskbarAl"=dword:00000000
;c 5 Secondary taskbar(s) alignment
;x 0 At screen edge (default)
;x 1 Centered
;x 5 Centered, at screen edge when full
;x 3 Centered with Start button
;x 7 Centered with Start button, at screen edge when full
"MMOldTaskbarAl"=dword:00000000
;c 3 Combine taskbar icons on primary taskbar
;x 0 Always combine
;x 1 Combine when taskbar is full
;x 2 Never combine (default)
"TaskbarGlomLevel"=dword:00000002
;c 3 セカンダリータスクバーにタスクバーアイコンを配置する。
;x 0 常に組み合わせる
@ -222,9 +236,9 @@ Windows Registry Editor Version 5.00 @@ -222,9 +236,9 @@ Windows Registry Editor Version 5.00
;b デフォルトで「すべてのアプリ」で「スタート」を開く
"MakeAllAppsDefault"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;c 2 画面上の位置
;x 0
;x 1 中央 (デフォルト)
;c 2 Position on screen
;x 0 At screen edge
;x 1 Center (default)
"TaskbarAl"=dword:00000001
;t 以下の設定は、Windows 10のスタートメニューにのみ適用されます。:
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
@ -241,6 +255,11 @@ Windows Registry Editor Version 5.00 @@ -241,6 +255,11 @@ Windows Registry Editor Version 5.00
;x 1 スタートメニュー
;x 2 フルスクリーン起動
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_ForceStartSize"=dword:00000000
;c 3 App list
;x 0 Display
;x 3 Hide
;x 1 Disable
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_NoStartMenuMorePrograms"=dword:00000000
;T ウインドウスイッチャー

6
version.h

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
#define VER_MAJOR 22000
#define VER_MINOR 493
#define VER_BUILD_HI 42
#define VER_BUILD_LO 25
#define VER_BUILD_LO 26
#define VER_FLAGS VS_FF_PRERELEASE
@ -12,5 +12,5 @@ @@ -12,5 +12,5 @@
#define VER_STR(arg) #arg
// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22000.493.42.25"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.493.42.25"
#define VER_FILE_STRING VALUE "FileVersion", "22000.493.42.26"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.493.42.26"

Loading…
Cancel
Save