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

Update to .30

This commit is contained in:
Valentin Radu 2021-10-15 13:50:52 +03:00
parent 453af00138
commit b2ac6991c2
18 changed files with 1734 additions and 875 deletions

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "libs/Detours"]
path = libs/Detours
url = https://github.com/microsoft/Detours
[submodule "libs/sws"]
path = libs/sws
url = https://github.com/valinet/sws

View File

@ -2,6 +2,22 @@
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
## 22000.258.30.0
Tested on build: 22000.258.
* Reworked settings framework
* More settings are available to customize
* Most setting changes take effect immediatly
* Implemented Windows 10 window switcher (Alt+Tab)
* GUI
* Revamped GUI, now the interface is split by categories and is displayed on two columns
* Regular items do not display a "+" sign anymore at the beginning of their label
* The current choice is ticked in the drop down menu
* Regions are now calculated correctly
* Solved memory leaks
* General bug fixes
## 22000.258.26.3
Tested on build: 22000.258.

View File

@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 22000,258,26,3
PRODUCTVERSION 22000,258,26,3
FILEVERSION 22000,258,30,0
PRODUCTVERSION 22000,258,30,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher"
VALUE "FileVersion", "22000.258.26.3"
VALUE "FileVersion", "22000.258.30.0"
VALUE "InternalName", "ExplorerPatcher.dll"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ExplorerPatcher.dll"
VALUE "ProductName", "ExplorerPatcher"
VALUE "ProductVersion", "22000.258.26.3"
VALUE "ProductVersion", "22000.258.30.0"
END
END
BLOCK "VarFileInfo"

View File

@ -193,6 +193,13 @@
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_error.c" />
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_RegistryMonitor.c" />
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_vector.c" />
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowHelpers.c" />
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcher.c" />
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayout.c" />
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayoutWindow.c" />
<ClCompile Include="ArchiveMenu.c" />
<ClCompile Include="dllmain.c" />
<ClCompile Include="fmemopen.c" />
@ -207,6 +214,14 @@
<ClCompile Include="utility.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_def.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_error.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_RegistryMonitor.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_vector.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowHelpers.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcher.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayout.h" />
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayoutWindow.h" />
<ClInclude Include="ArchiveMenu.h" />
<ClInclude Include="dxgi_imp.h" />
<ClInclude Include="fmemopen.h" />

View File

@ -13,6 +13,18 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Header Files\sws">
<UniqueIdentifier>{bd0d631a-7170-49ec-94ef-70c77ec3a4ab}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\sws">
<UniqueIdentifier>{4caf96b4-d282-4cad-a9c6-4d8d1374e5a6}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\internal">
<UniqueIdentifier>{2b202c30-7683-42d3-afc3-ddd3c38e1c8d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\internal">
<UniqueIdentifier>{08cd1a6f-9a8f-45ef-a50b-142a1725c106}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
@ -48,17 +60,41 @@
<ClInclude Include="GUI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="getline.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="fmemopen.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TaskbarCenter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="fmemopen.h">
<Filter>Header Files\internal</Filter>
</ClInclude>
<ClInclude Include="getline.h">
<Filter>Header Files\internal</Filter>
</ClInclude>
<ClInclude Include="ep_private.h">
<Filter>Header Files</Filter>
<Filter>Header Files\internal</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_def.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_error.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_vector.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowHelpers.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcher.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayout.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayoutWindow.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_RegistryMonitor.h">
<Filter>Header Files\sws</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
@ -94,14 +130,35 @@
<ClCompile Include="GUI.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="getline.c">
<ClCompile Include="TaskbarCenter.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="fmemopen.c">
<Filter>Source Files</Filter>
<Filter>Source Files\internal</Filter>
</ClCompile>
<ClCompile Include="TaskbarCenter.c">
<Filter>Source Files</Filter>
<ClCompile Include="getline.c">
<Filter>Source Files\internal</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_error.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_vector.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowHelpers.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcher.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayout.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayoutWindow.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_RegistryMonitor.c">
<Filter>Source Files\sws</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>

View File

@ -89,6 +89,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
_this->padding.right = GUI_PADDING_RIGHT * dx;
_this->padding.top = GUI_PADDING_TOP * dy;
_this->padding.bottom = GUI_PADDING_BOTTOM * dy;
_this->sidebarWidth = GUI_SIDEBAR_WIDTH * dx;
RECT rc;
GetClientRect(hwnd, &rc);
@ -137,6 +138,11 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
logFont.lfWeight = FW_REGULAR;
logFont.lfUnderline = 0;
HFONT hFontRegular = CreateFontIndirect(&logFont);
logFont.lfWeight = FW_DEMIBOLD;
logFont.lfHeight = GUI_SECTION_FONT_SIZE * dy;
HFONT hFontSection = CreateFontIndirect(&logFont);
logFont.lfUnderline = 1;
HFONT hFontSectionSel = CreateFontIndirect(&logFont);
HFONT hOldFont = NULL;
DTTOPTS DttOpts;
@ -148,6 +154,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
RECT rcText;
DWORD dwMaxHeight = 0, dwMaxWidth = 0;
BOOL bTabOrderHit = FALSE;
DWORD dwLeftPad = _this->padding.left + _this->sidebarWidth + _this->padding.right;
DWORD dwInitialLeftPad = dwLeftPad;
HDC hdcPaint = NULL;
BP_PAINTPARAMS params = { sizeof(BP_PAINTPARAMS) };
@ -156,7 +164,12 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
if (!hDC || (hDC && hdcPaint))
{
if (!IsThemeActive())
if (!hDC)
{
hdcPaint = GetDC(hwnd);
}
if (!IsThemeActive() && hDC)
{
COLORREF oldcr = SetBkColor(hdcPaint, GetSysColor(COLOR_WINDOW));
ExtTextOutW(hdcPaint, 0, 0, ETO_OPAQUE, &rc, L"", 0, 0);
@ -166,13 +179,13 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
FILE* f = fmemopen(pRscr, cbRscr, "r");
char* line = malloc(MAX_LINE_LENGTH * sizeof(char));
wchar_t* text = malloc(MAX_LINE_LENGTH * sizeof(wchar_t));
wchar_t* text = malloc((MAX_LINE_LENGTH + 3) * sizeof(wchar_t));
wchar_t* name = malloc(MAX_LINE_LENGTH * sizeof(wchar_t));
wchar_t* section = malloc(MAX_LINE_LENGTH * sizeof(wchar_t));
size_t bufsiz = 0, numChRd = 0, tabOrder = 1;
size_t bufsiz = MAX_LINE_LENGTH, numChRd = 0, tabOrder = 1, currentSection = -1, topAdj = 0;
while ((numChRd = getline(&line, &bufsiz, f)) != -1)
{
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") && (currentSection == -1 || currentSection == _this->section || !strncmp(line, ";T ", 3) || !strncmp(line, ";f", 2)))
{
#ifndef USE_PRIVATE_INTERFACES
if (!strncmp(line, ";p ", 3))
@ -184,6 +197,25 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
}
#endif
if (!strncmp(line, ";f", 2))
{
//if (topAdj + ((currentSection + 2) * GUI_SECTION_HEIGHT * dy) > dwMaxHeight)
//{
// dwMaxHeight = topAdj + ((currentSection + 2) * GUI_SECTION_HEIGHT * dy);
//}
if (_this->dwStatusbarY == 0)
{
dwMaxHeight += GUI_STATUS_PADDING * dy;
_this->dwStatusbarY = dwMaxHeight / dy;
}
else
{
dwMaxHeight = _this->dwStatusbarY * dy;
}
currentSection = -1;
dwLeftPad = 0;
continue;
}
if (!strncmp(line, "[", 1))
{
@ -201,31 +233,115 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
DWORD dwLineHeight = GUI_LINE_HEIGHT;
rcText.left = _this->padding.left;
rcText.left = dwLeftPad + _this->padding.left;
rcText.top = _this->padding.top + dwMaxHeight;
rcText.right = (rc.right - rc.left) - _this->padding.right;
rcText.bottom = dwMaxHeight + dwLineHeight * dy - _this->padding.bottom;
if (!strncmp(line, ";T ", 3))
{
hOldFont = SelectObject(hDC ? hdcPaint : GetDC(hwnd), hFontTitle);
if (currentSection + 1 == _this->section)
{
hOldFont = SelectObject(hdcPaint, hFontSectionSel);
}
else
{
hOldFont = SelectObject(hdcPaint, hFontSection);
}
rcText.left = _this->padding.left;
rcText.right = _this->padding.left + _this->sidebarWidth;
rcText.top = topAdj + ((currentSection + 1) * GUI_SECTION_HEIGHT * dy);
rcText.bottom = topAdj + ((currentSection + 2) * GUI_SECTION_HEIGHT * dy);
ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));
MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
line + 3,
numChRd - 3,
text,
MAX_LINE_LENGTH
);
if (hDC)
{
if (IsThemeActive())
{
DrawThemeTextEx(
_this->hTheme,
hdcPaint,
0,
0,
text,
-1,
dwTextFlags,
&rcText,
&DttOpts
);
}
else
{
DrawTextW(
hdcPaint,
text,
-1,
&rcText,
dwTextFlags
);
}
}
else
{
RECT rcTemp;
rcTemp = rcText;
DrawTextW(
hdcPaint,
text,
-1,
&rcTemp,
DT_CALCRECT
);
rcTemp.bottom = rcText.bottom;
if (PtInRect(&rcTemp, pt))
{
_this->section = currentSection + 1;
InvalidateRect(hwnd, NULL, FALSE);
}
}
currentSection++;
continue;
}
else if (!strncmp(line, ";M ", 3))
{
hOldFont = SelectObject(hDC ? hdcPaint : GetDC(hwnd), hFontCaption);
rcText.left = _this->padding.left;
topAdj = dwMaxHeight + GUI_CAPTION_LINE_HEIGHT * dy;
hOldFont = SelectObject(hdcPaint, hFontCaption);
}
else if (!strncmp(line, ";u ", 3))
{
hOldFont = SelectObject(hDC ? hdcPaint : GetDC(hwnd), hFontUnderline);
hOldFont = SelectObject(hdcPaint, hFontUnderline);
}
else
{
hOldFont = SelectObject(hDC ? hdcPaint : GetDC(hwnd), hFontRegular);
hOldFont = SelectObject(hdcPaint, hFontRegular);
}
if (!strncmp(line, ";T ", 3) || !strncmp(line, ";t ", 3) || !strncmp(line, ";u ", 3) || !strncmp(line, ";M ", 3))
{
ZeroMemory(text, MAX_LINE_LENGTH * sizeof(wchar_t));
if (!strncmp(line, ";t ", 3))
{
char* p = strstr(line, "%VERSIONINFO%");
if (p)
{
DWORD dwLeftMost = 0;
DWORD dwSecondLeft = 0;
DWORD dwSecondRight = 0;
DWORD dwRightMost = 0;
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);
sprintf_s(p, MAX_PATH, "%d.%d.%d.%d", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);
}
}
ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));
MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
@ -247,13 +363,15 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
MAX_PATH
);
PathStripPath(exeName);
if (wcscmp(exeName, L"explorer.exe"))
{
LoadStringW(hModule, IDS_PRODUCTNAME, text, MAX_LINE_LENGTH);
}
else
{
LoadStringW(GetModuleHandleW(L"ExplorerFrame.dll"), 50222, text, 260);
//if (wcscmp(exeName, L"explorer.exe"))
//{
// LoadStringW(hModule, IDS_PRODUCTNAME, text, MAX_LINE_LENGTH);
//}
//else
//{
HMODULE hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
LoadStringW(hExplorerFrame, 50222, text, 260);
FreeLibrary(hExplorerFrame);
wchar_t* p = wcschr(text, L'(');
if (p)
{
@ -268,7 +386,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
*p = 0;
}
}
}
//}
rcText.bottom += GUI_CAPTION_LINE_HEIGHT - dwLineHeight;
dwLineHeight = GUI_CAPTION_LINE_HEIGHT;
_this->extent.cyTopHeight = rcText.bottom;
@ -343,7 +461,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
RECT rcTemp;
rcTemp = rcText;
DrawTextW(
GetDC(hwnd),
hdcPaint,
text,
-1,
&rcTemp,
@ -535,7 +653,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
else if (!strncmp(line, ";l ", 3) || !strncmp(line, ";c ", 3) || !strncmp(line, ";b ", 3) || !strncmp(line, ";i ", 3) || !strncmp(line, ";d ", 3) || !strncmp(line, ";v ", 3))
{
ZeroMemory(text, MAX_LINE_LENGTH * sizeof(wchar_t));
ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));
text[0] = L'\u2795';
text[1] = L' ';
text[2] = L' ';
@ -624,7 +742,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
wchar_t* x = wcschr(d + 1, L':');
x++;
value = _wtoi(x);
value = wcstol(x, NULL, 16);
}
if (!bJustCheck)
@ -707,28 +825,41 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
MAX_LINE_LENGTH,
L" : "
);
MENUITEMINFOA menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
MENUITEMINFOW menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));
menuInfo.cbSize = sizeof(MENUITEMINFOW);
menuInfo.fMask = MIIM_STRING;
GetMenuItemInfoA(hMenu, value + 1, FALSE, &menuInfo);
char* buf = malloc(sizeof(char) * (menuInfo.cch + 1));
menuInfo.dwTypeData = buf;
GetMenuItemInfoW(hMenu, value + 1, FALSE, &menuInfo);
menuInfo.cch += 1;
GetMenuItemInfoA(hMenu, value + 1, FALSE, &menuInfo);
MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
buf,
menuInfo.cch,
text + wcslen(text),
MAX_LINE_LENGTH
menuInfo.dwTypeData = text + wcslen(text);
GetMenuItemInfoW(hMenu, value + 1, FALSE, &menuInfo);
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));
menuInfo.cbSize = sizeof(MENUITEMINFOW);
menuInfo.fMask = MIIM_STATE;
menuInfo.fState = MFS_CHECKED;
SetMenuItemInfo(hMenu, value + 1, FALSE, &menuInfo);
}
if (hDC && !bInvert && !bBool && !bJustCheck)
{
RECT rcTemp;
rcTemp = rcText;
DrawTextW(
hdcPaint,
text,
3,
&rcTemp,
DT_CALCRECT
);
rcText.left += rcTemp.right - rcTemp.left;
for (unsigned int i = 0; i < wcslen(text); ++i)
{
text[i] = text[i + 3];
}
}
RECT rcTemp;
rcTemp = rcText;
DrawTextW(
GetDC(hwnd),
hdcPaint,
text,
-1,
&rcTemp,
@ -786,8 +917,17 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
if (bChoice)
{
RECT rcTemp;
rcTemp = rcText;
DrawTextW(
hdcPaint,
text,
3,
&rcTemp,
DT_CALCRECT
);
POINT p;
p.x = rcText.left;
p.x = rcText.left + rcTemp.right - rcTemp.left;
p.y = rcText.bottom;
ClientToScreen(
hwnd,
@ -849,7 +989,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
RECT rcTemp;
rcTemp = rcText;
DrawTextW(
GetDC(hwnd),
hdcPaint,
text,
-1,
&rcTemp,
@ -945,14 +1085,24 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
}
fclose(f);
free(section);
free(name);
free(text);
free(line);
SelectObject(hdcPaint, hOldFont);
if (!hDC)
{
ReleaseDC(hwnd, hdcPaint);
}
DeleteObject(hFontSectionSel);
DeleteObject(hFontSection);
DeleteObject(hFontRegular);
DeleteObject(hFontTitle);
DeleteObject(hFontUnderline);
DeleteObject(hFontCaption);
if (hDC)
{
SelectObject(hdcPaint, hOldFont);
DeleteObject(hFontRegular);
DeleteObject(hFontTitle);
DeleteObject(hFontUnderline);
DeleteObject(hFontCaption);
if (_this->tabOrder == GUI_MAX_TABORDER)
{
_this->tabOrder = tabOrder;
@ -969,7 +1119,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
GetWindowRect(hwnd, &rcWin);
printf("%d %d - %d %d\n", rcWin.right - rcWin.left, rcWin.bottom - rcWin.top, dwMaxWidth, dwMaxHeight);
dwMaxWidth += _this->padding.left + _this->padding.right;
dwMaxWidth += dwInitialLeftPad + _this->padding.left + _this->padding.right;
dwMaxHeight += GUI_LINE_HEIGHT * dy + 20 * dy;
HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY);
@ -1057,6 +1207,10 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
PostQuitMessage(0);
return 0;
}
else if (uMsg == WM_GETICON)
{
return _this->hIcon;
}
else if (uMsg == WM_SETTINGCHANGE)
{
if (IsColorSchemeChangeMessage(lParam))
@ -1113,6 +1267,14 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
GUI_Build(0, hWnd, pt);
return 0;
}
// this should be determined from the file, but for now it works
else if (wParam >= 0x30 + 1 && wParam <= 0x30 + 7)
{
_this->tabOrder = 0;
_this->section = wParam - 0x30 - 1;
InvalidateRect(hWnd, NULL, FALSE);
return 0;
}
}
else if (uMsg == WM_NCHITTEST && IsThemeActive())
{
@ -1239,9 +1401,28 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
_this.padding.right = GUI_PADDING_RIGHT;
_this.padding.top = GUI_PADDING_TOP;
_this.padding.bottom = GUI_PADDING_BOTTOM;
_this.sidebarWidth = GUI_SIDEBAR_WIDTH;
_this.hTheme = OpenThemeData(NULL, TEXT(GUI_WINDOWSWITCHER_THEME_CLASS));
_this.tabOrder = 0;
_this.bCalcExtent = TRUE;
_this.section = 0;
_this.dwStatusbarY = 0;
_this.hIcon = NULL;
wchar_t wszPath[MAX_PATH];
ZeroMemory(
wszPath,
(MAX_PATH) * sizeof(wchar_t)
);
GetWindowsDirectoryW(
wszPath,
MAX_PATH
);
wcscat_s(
wszPath,
MAX_PATH,
L"\\explorer.exe"
);
WNDCLASS wc = { 0 };
ZeroMemory(&wc, sizeof(WNDCLASSW));
@ -1251,10 +1432,18 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
wc.hInstance = hModule;
wc.lpszClassName = L"ExplorerPatcherGUI";
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
HMODULE hExplorer = LoadLibraryExW(wszPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hExplorer)
{
_this.hIcon = LoadIconW(hExplorer, L"ICO_MYCOMPUTER");
wc.hIcon = _this.hIcon;
}
RegisterClassW(&wc);
TCHAR title[260];
LoadStringW(GetModuleHandleW(L"ExplorerFrame.dll"), 726, title, 260);
HMODULE hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
LoadStringW(hExplorerFrame, 726, title, 260);
FreeLibrary(hExplorerFrame);
if (title[0] == 0)
{
LoadStringW(hModule, IDS_PRODUCTNAME, title, 260);
@ -1326,10 +1515,27 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
DispatchMessage(&msg);
}
if (bHasLoadedUxtheme)
if (hExplorer)
{
CloseHandle(_this.hIcon);
FreeLibrary(hExplorer);
}
if (bHasLoadedUxtheme && hUxtheme)
{
FreeLibrary(hUxtheme);
}
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
_CrtDumpMemoryLeaks();
#ifdef _DEBUG
_getch();
#endif
printf("Ended \"GUI\" thread.\n");
}

View File

@ -1,5 +1,8 @@
#ifndef _H_GUI_H_
#define _H_GUI_H_
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
@ -28,9 +31,11 @@ extern HMODULE hModule;
#define GUI_POSITION_X CW_USEDEFAULT
#define GUI_POSITION_Y CW_USEDEFAULT
#define GUI_POSITION_WIDTH 367
#define GUI_POSITION_HEIGHT 616
#define GUI_POSITION_HEIGHT 316
#define GUI_WINDOWSWITCHER_THEME_CLASS "ControlPanelStyle"
#define GUI_CAPTION_FONT_SIZE -22
#define GUI_SECTION_FONT_SIZE -12
#define GUI_SECTION_HEIGHT 32
#define GUI_TITLE_FONT_SIZE -12
#define GUI_LINE_HEIGHT 26
#define GUI_CAPTION_LINE_HEIGHT 42
@ -41,20 +46,26 @@ extern HMODULE hModule;
#define GUI_MAX_TABORDER 9999
#define GUI_PADDING 5
#define GUI_PADDING_LEFT GUI_PADDING * 3
#define GUI_SIDEBAR_WIDTH 110
#define GUI_PADDING_RIGHT GUI_PADDING * 3
#define GUI_PADDING_TOP GUI_PADDING
#define GUI_PADDING_BOTTOM GUI_PADDING
#define GUI_STATUS_PADDING 10
typedef struct _GUI
{
POINT location;
SIZE size;
RECT padding;
UINT sidebarWidth;
HBRUSH hBackgroundBrush;
HTHEME hTheme;
POINT dpi;
MARGINS extent;
UINT tabOrder;
BOOL bCalcExtent;
SIZE_T section;
DWORD dwStatusbarY;
HICON hIcon;
} GUI;
static HRESULT GUI_AboutProc(

View File

@ -1,336 +1,64 @@
#include "SettingsMonitor.h"
DWORD MonitorSettingsChanges(SettingsChangeParameters* params)
DWORD MonitorSettings(SettingsChangeParameters* params)
{
HMODULE hModule = LoadLibraryW(L"Shlwapi.dll");
if (hModule)
{
FARPROC SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, "SHRegGetValueFromHKCUHKLM");
DWORD dwSize = sizeof(DWORD);
LONG lRes = ERROR_SUCCESS;
HKEY hKeyCU, hKeyLM;
while (TRUE)
{
HANDLE* handles = malloc(sizeof(HANDLE) * params->size);
if (!handles)
{
return 0;
}
for (unsigned int i = 0; i < params->size; ++i)
{
params->settings[i].hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!params->settings[i].hEvent)
{
return 0;
}
handles[i] = params->settings[i].hEvent;
if (RegCreateKeyExW(
params->settings[i].origin,
params->settings[i].name,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_READ,
NULL,
&(params->settings[i].hKey),
NULL
) != ERROR_SUCCESS)
{
return 0;
}
if (RegNotifyChangeKeyValue(
params->settings[i].hKey,
FALSE,
REG_NOTIFY_CHANGE_LAST_SET,
params->settings[i].hEvent,
TRUE
) != ERROR_SUCCESS)
{
return 0;
}
}
DWORD dwRes = WaitForMultipleObjects(
params->size,
handles,
FALSE,
INFINITE
);
if (dwRes != WAIT_FAILED)
{
unsigned int i = dwRes - WAIT_OBJECT_0;
params->settings[i].callback(params->settings[i].data);
}
free(handles);
for (unsigned int i = 0; i < params->size; ++i)
{
CloseHandle(params->settings[i].hEvent);
RegCloseKey(params->settings[i].hKey);
}
}
}
dwSize = sizeof(DWORD);
DWORD dwInitialTaskbarAl = 0, dwTaskbarAl = 0, dwInitialTaskbarAlWas = 0;
if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"),
TEXT("TaskbarAl"),
SRRF_RT_REG_DWORD,
NULL,
&dwInitialTaskbarAl,
(LPDWORD)(&dwSize)
) != ERROR_SUCCESS)
{
dwInitialTaskbarAl = 0;
}
else
{
dwInitialTaskbarAlWas = 1;
}
dwSize = sizeof(DWORD);
DWORD dwInitialMaximumFrequentApps = 6, dwMaximumFrequentApps = 6, dwInitialMaximumFrequentAppsWas = 0;
if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"),
TEXT("Start_MaximumFrequentApps"),
SRRF_RT_REG_DWORD,
NULL,
&dwInitialMaximumFrequentApps,
(LPDWORD)(&dwSize)
) != ERROR_SUCCESS)
{
dwInitialMaximumFrequentApps = 6;
}
else
{
dwInitialMaximumFrequentAppsWas = 1;
}
while (TRUE)
{
lRes = RegOpenKeyExW(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"),
0,
KEY_READ,
&hKeyCU
);
if (hKeyCU == NULL || hKeyCU == INVALID_HANDLE_VALUE)
{
hKeyCU = NULL;
}
if (lRes != ERROR_SUCCESS)
{
return 0;
}
HANDLE hEvHKCU = CreateEvent(NULL, FALSE, FALSE, NULL);
if (hEvHKCU == NULL || hEvHKCU == INVALID_HANDLE_VALUE)
{
hEvHKCU = NULL;
return 0;
}
RegNotifyChangeKeyValue(
hKeyCU,
FALSE,
REG_NOTIFY_CHANGE_LAST_SET,
hEvHKCU,
TRUE
);
lRes = RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"),
0,
KEY_READ,
&hKeyLM
);
if (hKeyLM == NULL || hKeyLM == INVALID_HANDLE_VALUE)
{
hKeyLM = NULL;
}
if (lRes != ERROR_SUCCESS)
{
return 0;
}
HANDLE hEvHKLM = CreateEvent(NULL, FALSE, FALSE, NULL);
if (hEvHKLM == NULL || hEvHKLM == INVALID_HANDLE_VALUE)
{
hEvHKLM = NULL;
return 0;
}
RegNotifyChangeKeyValue(
hKeyLM,
FALSE,
REG_NOTIFY_CHANGE_LAST_SET,
hEvHKLM,
TRUE
);
printf("!!! Setup monitor %d %d\n", hEvHKCU, hEvHKLM);
HANDLE hEvents[2];
hEvents[0] = hEvHKCU;
hEvents[1] = hEvHKLM;
DWORD rv = WaitForMultipleObjects(
2,
hEvents,
FALSE,
INFINITE
);
if (rv == WAIT_OBJECT_0)
{
dwSize = sizeof(DWORD);
lRes = RegQueryValueExW(
hKeyCU,
TEXT("TaskbarAl"),
0,
NULL,
&dwTaskbarAl,
&dwSize
);
if (lRes != ERROR_SUCCESS && dwInitialTaskbarAlWas)
{
if (params->TaskbarAlChangedCallback)
{
void* p = 0;
if (params->TaskbarAlChangedCallbackData)
{
p = params->TaskbarAlChangedCallbackData;
}
params->TaskbarAlChangedCallback(p, dwTaskbarAl);
}
else
{
exit(0);
}
dwInitialTaskbarAl = dwTaskbarAl;
}
if (lRes == ERROR_SUCCESS && dwTaskbarAl != dwInitialTaskbarAl)
{
if (params->TaskbarAlChangedCallback)
{
void* p = 0;
if (params->TaskbarAlChangedCallbackData)
{
p = params->TaskbarAlChangedCallbackData;
}
params->TaskbarAlChangedCallback(p, dwTaskbarAl);
}
else
{
exit(0);
}
dwInitialTaskbarAl = dwTaskbarAl;
}
if (params->isStartMenuExperienceHost)
{
dwSize = sizeof(DWORD);
lRes = RegQueryValueExW(
hKeyCU,
TEXT("Start_MaximumFrequentApps"),
0,
NULL,
&dwMaximumFrequentApps,
&dwSize
);
if (lRes != ERROR_SUCCESS && dwInitialMaximumFrequentAppsWas)
{
if (params->Start_MaximumRecentAppsChangedCallback)
{
void* p = 0;
if (params->Start_MaximumRecentAppsChangedCallbackData)
{
p = params->Start_MaximumRecentAppsChangedCallbackData;
}
params->Start_MaximumRecentAppsChangedCallback(p, dwMaximumFrequentApps);
}
else
{
exit(0);
}
dwInitialMaximumFrequentApps = dwMaximumFrequentApps;
}
if (lRes == ERROR_SUCCESS && dwMaximumFrequentApps != dwInitialMaximumFrequentApps)
{
if (params->Start_MaximumRecentAppsChangedCallback)
{
void* p = 0;
if (params->Start_MaximumRecentAppsChangedCallbackData)
{
p = params->Start_MaximumRecentAppsChangedCallbackData;
}
params->Start_MaximumRecentAppsChangedCallback(p, dwMaximumFrequentApps);
}
else
{
exit(0);
}
dwInitialMaximumFrequentApps = dwMaximumFrequentApps;
}
}
}
else if (rv == WAIT_OBJECT_0 + 1)
{
dwSize = sizeof(DWORD);
lRes = RegQueryValueExW(
hKeyCU,
TEXT("TaskbarAl"),
0,
NULL,
&dwTaskbarAl,
&dwSize
);
if (lRes != ERROR_SUCCESS)
{
dwSize = sizeof(DWORD);
lRes = RegQueryValueExW(
hKeyLM,
TEXT("TaskbarAl"),
0,
NULL,
&dwTaskbarAl,
&dwSize
);
if (lRes != ERROR_SUCCESS && dwInitialTaskbarAlWas)
{
if (params->TaskbarAlChangedCallback)
{
void* p = 0;
if (params->TaskbarAlChangedCallbackData)
{
p = params->TaskbarAlChangedCallbackData;
}
params->TaskbarAlChangedCallback(p, dwTaskbarAl);
}
else
{
exit(0);
}
dwInitialTaskbarAl = dwTaskbarAl;
}
if (lRes == ERROR_SUCCESS && dwTaskbarAl != dwInitialTaskbarAl)
{
if (params->TaskbarAlChangedCallback)
{
void* p = 0;
if (params->TaskbarAlChangedCallbackData)
{
p = params->TaskbarAlChangedCallbackData;
}
params->TaskbarAlChangedCallback(p, dwTaskbarAl);
}
else
{
exit(0);
}
dwInitialTaskbarAl = dwTaskbarAl;
}
}
if (params->isStartMenuExperienceHost)
{
dwSize = sizeof(DWORD);
lRes = RegQueryValueExW(
hKeyCU,
TEXT("Start_MaximumFrequentApps"),
0,
NULL,
&dwMaximumFrequentApps,
&dwSize
);
if (lRes != ERROR_SUCCESS)
{
dwSize = sizeof(DWORD);
lRes = RegQueryValueExW(
hKeyLM,
TEXT("Start_MaximumFrequentApps"),
0,
NULL,
&dwMaximumFrequentApps,
&dwSize
);
if (lRes != ERROR_SUCCESS && dwInitialMaximumFrequentAppsWas)
{
if (params->Start_MaximumRecentAppsChangedCallback)
{
void* p = 0;
if (params->Start_MaximumRecentAppsChangedCallbackData)
{
p = params->Start_MaximumRecentAppsChangedCallbackData;
}
params->Start_MaximumRecentAppsChangedCallback(p, dwMaximumFrequentApps);
}
else
{
exit(0);
}
dwInitialMaximumFrequentApps = dwMaximumFrequentApps;
}
if (lRes == ERROR_SUCCESS && dwMaximumFrequentApps != dwInitialMaximumFrequentApps)
{
if (params->Start_MaximumRecentAppsChangedCallback)
{
void* p = 0;
if (params->Start_MaximumRecentAppsChangedCallbackData)
{
p = params->Start_MaximumRecentAppsChangedCallbackData;
}
params->Start_MaximumRecentAppsChangedCallback(p, dwMaximumFrequentApps);
}
else
{
exit(0);
}
dwInitialMaximumFrequentApps = dwMaximumFrequentApps;
}
}
}
}
if (hEvHKCU) CloseHandle(hEvHKCU);
if (hEvHKLM) CloseHandle(hEvHKLM);
if (hKeyCU) RegCloseKey(hKeyCU);
if (hKeyLM) RegCloseKey(hKeyLM);
}
}
}

View File

@ -4,13 +4,19 @@
#include <Shlwapi.h>
#pragma comment(lib, "Shlwapi.lib")
typedef struct _Setting
{
HKEY origin;
wchar_t name[MAX_PATH];
HKEY hKey;
HANDLE hEvent;
void(*callback)(void*);
void* data;
} Setting;
typedef struct _SettingsChangeParameters
{
BOOL isStartMenuExperienceHost;
void (*TaskbarAlChangedCallback)(INT64, DWORD);
void* TaskbarAlChangedCallbackData;
void (*Start_MaximumRecentAppsChangedCallback)(INT64, DWORD);
void* Start_MaximumRecentAppsChangedCallbackData;
Setting* settings;
DWORD size;
} SettingsChangeParameters;
DWORD MonitorSettingsChanges(SettingsChangeParameters* params);
DWORD MonitorSettings(SettingsChangeParameters*);
#endif

View File

@ -77,7 +77,12 @@ LRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(
MSG* msg = (MSG*)lParam;
if (GetSystemMetrics(SM_CMONITORS) >= 2 && msg->message == WM_SYSCOMMAND && (msg->wParam & 0xFFF0) == SC_TASKLIST)
{
DWORD dwStatus = 0;
if (bMonitorOverride)
{
goto finish;
}
/*DWORD dwStatus = 0;
DWORD dwSize = sizeof(DWORD);
HMODULE hModule = GetModuleHandle(TEXT("Shlwapi.dll"));
FARPROC SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, "SHRegGetValueFromHKCUHKLM");
@ -91,7 +96,7 @@ LRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(
) != ERROR_SUCCESS || dwStatus == 1)
{
goto finish;
}
}*/
DWORD pts = GetMessagePos();
POINT pt;
@ -163,7 +168,12 @@ DWORD OpenStartAtLogonThread(OpenStartAtLogonThreadParams* unused)
);
printf("Started \"Open Start at Logon\" thread.\n");
DWORD dwStatus = 0;
if (!bOpenAtLogon)
{
return 0;
}
/*DWORD dwStatus = 0;
DWORD dwSize = sizeof(DWORD);
HMODULE hModule = GetModuleHandle(TEXT("Shlwapi"));
FARPROC SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, "SHRegGetValueFromHKCUHKLM");
@ -177,7 +187,7 @@ DWORD OpenStartAtLogonThread(OpenStartAtLogonThreadParams* unused)
) != ERROR_SUCCESS || dwStatus == 0)
{
return 0;
}
}*/
POINT pt;
pt.x = 0;

View File

@ -7,6 +7,9 @@
#pragma comment(lib, "Shlwapi.lib")
#include <TlHelp32.h>
extern DWORD bMonitorOverride;
extern DWORD bOpenAtLogon;
DEFINE_GUID(CLSID_ImmersiveShell,
0xc2f03a33,
0x21f5, 0x47fa, 0xb4, 0xbb,

View File

@ -2,6 +2,25 @@
HANDLE hEvent;
HRESULT TaskbarCenter_Center()
{
HRESULT hr = S_OK;
HWND hWnd = FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL);
while (hWnd)
{
if (SUCCEEDED(hr))
{
/*hr = AccessibleObjectFromWindow(
);*/
}
hWnd = NULL;
}
}
BOOL TaskbarCenter_Notify()
{
if (hEvent)
@ -19,7 +38,7 @@ BOOL GetClientRectHook(HWND hWnd, LPRECT lpRect)
GetClassNameW(hWnd, wszClassName, 100);
if (!wcscmp(wszClassName, L"MSTaskListWClass"))
{
TaskbarCenter_Notify();
TaskbarCenter_Center();
}
return GetClientRect(hWnd, lpRect);
}

View File

@ -2,6 +2,8 @@
#define _H_TASKBARCENTER_H_
#include <initguid.h>
#include <Windows.h>
#include <oleacc.h>
#pragma comment(lib, "Oleacc.lib")
#include <valinet/hooking/iatpatch.h>
#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification_{B37553B7-425C-44F6-A04A-126849EE59CB}"

File diff suppressed because it is too large Load Diff

View File

@ -3,62 +3,88 @@
;M Settings
;T Taskbar
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Enable Windows 10 taskbar *
"OldTaskbar"=dword:00000001
;t The following settings only apply to the Windows 10 taskbar:
;l Enable missing system tray icons
;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\SystemIcons
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;c 3 Combine taskbar icons on main taskbar *
;c 3 Combine taskbar icons on main taskbar
;x 0 Always combine
;x 1 Combine when taskbar is full
;x 2 Never combine
"TaskbarGlomLevel"=dword:00000002
;c 3 Combine taskbar icons on other taskbars *
;c 3 Combine taskbar icons on other taskbars
;x 0 Always combine
;x 1 Combine when taskbar is full
;x 2 Never combine
"MMTaskbarGlomLevel"=dword:00000002
;c 2 Taskbar icon size *
;c 2 Taskbar icon size
;x 1 Small
;x 0 Large (default)
"TaskbarSmallIcons"=dword:00000000
;b Show Task view button
"ShowTaskViewButton"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
;b Show Search button
"SearchboxTaskbarMode"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Disable Control Center button *
"HideControlCenterButton"=dword:00000000
;b Center and skin system tray icon menus *
;b Skin taskbar and tray pop-up menus
"SkinMenus"=dword:00000001
;b Center tray icon pop-up menus
"CenterMenus"=dword:00000001
;b Flyout behavior for tray icon pop-up menus
"FlyoutMenus"=dword:00000001
;b Open Network and Sharing Center from pop-up menu of network tray icon
"ReplaceNetwork"=dword:00000000
;b Hide Control Center button *
"HideControlCenterButton"=dword:00000000
;p 2
;b Apply Windows 11 style to system tray icons *
"SkinIcons"=dword:00000001
;b Open network settings in Control Panel for system tray icon *
"ReplaceNetwork"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People]
;b Show People on the taskbar *
"PeopleBand"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7]
;b Show touch keyboard button *
"TipbandDesiredVisibility"=dword:00000000
;T File Explorer
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32]
;d Disable immersive context menu *
@=""
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32]
;d Disable command bar *
;d Disable the Windows 11 command bar *
@=""
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32]
;d Disable the Windows 11 context menu *
@=""
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Disable the Windows 10 (immersive) context menu
"DisableImmersiveContextMenu"=dword:00000000
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs]
;d Disable modern search bar
@="{64bc32b5-4eec-4de7-972d-bd8bd0324537}"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Hide search bar completely *
;b Hide search bar completely
"HideExplorerSearchBar"=dword:00000000
;p 2
;b Mica effect on title bar *
;b Mica effect on title bar
"MicaEffectOnTitlebar"=dword:00000000
;T Start menu
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage]
;i Open Start on monitor containing the cursor
"MonitorOverride"=dword:00000001
;b Open Start at logon
"OpenAtLogon"=dword:00000000
;b Open Start in All apps by default
"MakeAllAppsDefault"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;c 2 Location on screen *
;x 0 Left
;x 1 Center (default)
"TaskbarAl"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage]
;b Open Start to All apps by default
"MakeAllAppsDefault"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;c 22 Maximum number of frequent apps to show in Start
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;c 22 Maximum number of frequent apps to show
;x 0 None
;x 1 1
;x 2 2
@ -83,7 +109,98 @@
;x 99999 Unlimited
"Start_MaximumFrequentApps"=dword:00000006
;T Window switcher
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws]
;b Use Windows 10 window switcher (Alt+Tab)
"Enabled"=dword:00000000
;t The following settings only apply to the Windows 10 window switcher:
;b Include desktop
"IncludeWallpaper"=dword:00000001
;c 3 Color scheme
;x 0 Follow system setting (default)
;x 1 Light
;x 2 Dark
"ColorScheme"=dword:00000000
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MultitaskingView\AltTabViewHost]
;c 15 Opacity
;x 100 Opaque
;x 95 95 %
;x 90 90 %
;x 85 85 %
;x 80 80 %
;x 75 75 %
;x 70 70 %
;x 65 65 %
;x 60 60 % (default)
;x 55 55 %
;x 50 50 %
;x 45 45 %
;x 40 40 %
;x 35 35 %
;x 30 30 %
"Grid_backgroundPercent"=dword:0000003c
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws]
;c 15 Row height
;x 330 330 pt
;x 320 320 pt
;x 310 310 pt
;x 300 300 pt
;x 290 290 pt
;x 280 280 pt
;x 270 270 pt
;x 260 260 pt
;x 250 250 pt (default)
;x 240 240 pt
;x 230 230 pt
;x 220 220 pt
;x 210 210 pt
;x 200 200 pt
;x 190 190 pt
"RowHeight"=dword:000000fa
;c 10 Maximum width (percentage of screen width)
;x 100 100 % (not recommended)
;x 95 95 %
;x 90 90 %
;x 85 85 %
;x 80 80 % (default)
;x 75 75 %
;x 70 70 %
;x 65 65 %
;x 60 60 %
;x 55 55 %
"MaxWidth"=dword:00000050
;c 10 Maximum height (percentage of screen height)
;x 100 100 % (not recommended)
;x 95 95 %
;x 90 90 %
;x 85 85 %
;x 80 80 % (default)
;x 75 75 %
;x 70 70 %
;x 65 65 %
;x 60 60 %
;x 55 55 %
"MaxHeight"=dword:00000050
;T Other
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Open clock flyout when pressing Win+C instead of Microsoft Teams
"ClockFlyoutOnWinC"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;c 6 Default action in shutdown dialog (Alt+F4 on desktop)
;x 256 Switch user
;x 1 Sign out
;x 16 Sleep
;x 64 Hibernate
;x 2 Shut down (default)
;x 4 Restart
"Start_PowerButtonAction"=dword:00000002
;b Show Command Prompt instead of PowerShell in Win+X menu *
"DontUsePowerShellOnWinX"=dword:00000000
;T Advanced
;t Only change these settings if you know what you are doing. You've been warned!
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Enable console *
"AllocConsole"=dword:00000000
@ -96,11 +213,30 @@
;x 2000 2 seconds
;x 3000 3 seconds
"ExplorerReadyDelay"=dword:00000000
[HKEY_CURRENT_USER\Control Panel\Desktop]
;b Show Windows build info on the desktop *
"PaintDesktopversion"=dword:00000000
;T About
;t Version %VERSIONINFO%
;t Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved.
;t
;t This project aims to bring back a productive working environment on Windows 11.
;t Proudly programmed by Valentin-Gabriel Radu.
;l Visit project GitHub (https://github.com/valinet)
;https://github.com/valinet
;l Visit web site (https://www.valinet.ro)
;https://www.valinet.ro
;l E-mail author (valentingabrielradu@gmail.com)
;mailto:valentingabrielradu@gmail.com
;l Donate (using PayPal)
;https://www.paypal.com/donate?business=valentingabrielradu%40gmail.com&no_recurring=0&item_name=ExplorerPatcher&currency_code=EUR
;f
;t Settings marked with an (*) require restarting the File Explorer process.
;u Restart File Explorer
;restart
;u Restore default settings
;reset
;u About ExplorerPatcher
;about
;;u About ExplorerPatcher
;;about

View File

@ -284,7 +284,7 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOO
{
RECT rc;
GetWindowRect(hWnd, &rc);
if (rc.left - mi.rcMonitor.left == 0)
if (rc.left - mi.rcMonitor.left <= 0)
{
if (bUseRcWork)
{
@ -298,7 +298,7 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOO
{
point.x++;
}
if (rc.top - mi.rcMonitor.top == 0)
if (rc.top - mi.rcMonitor.top <= 0)
{
if (bUseRcWork)
{
@ -345,7 +345,7 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOO
{
point.x--;
}
if (rc.top - mi.rcMonitor.top == 0)
if (rc.top - mi.rcMonitor.top <= 0)
{
if (bUseRcWork)
{

191
README.md
View File

@ -12,41 +12,63 @@ PayPal donations: [here](https://www.paypal.com/donate?business=valentingabrielr
<img src="https://gist.githubusercontent.com/valinet/d0f72ff09773702584e77c46065b95e0/raw/94036ed3e38218b87744a29ae5c40b06be637daf/ep_img0.png" width=100% height=100%>
The functionality of this software includes:
* Taskbar from Windows 10:
* "always combine" / "combine when full" / "never combine" options for main and secondary taskbars
* Search button
* Task View button
* optional skinned, centered and toggled pop-up menus, or non-skinned (useful for classic theme users)
* open "Network and Sharing Center" when clicking "Open Network & Internet settings" in the pop-ip menu of the system tray network icon
* hide Control Center button
* Show People on the taskbar
* Show touch keyboard button
* File Explorer
* disable the Windows 11 command bar
* disable the Windows 11 context menu
* disable even the Windows 10 (immersive) context menu (useful for classic theme users)
* disable modern search bar (reverts to the search bar in early Windows 10 builds or Windows 7/8)
* disable search bar completely
* Start menu from Windows 11
* open Start on monitor containing the cursor
* open Start at logon
* open Start in "All apps" by default
* positioning on screen
* maximum number of frequent apps to show
* Window switcher (Alt-Tab) from Windows 10:
* choose whether to include desktop in the window list
* ability to set opacity of the window list
* set row size, maximum extents etc
* Others
* Open the time and date flyout when pressing `Win`+`C` (instead of Microsoft Teams)
* Set default shutdown action for `Alt`+`F4` on the desktop
* Show Command Prompt instead of PowerShell in the `Win`+`X` menu
Screenshots: [<1>](https://gist.githubusercontent.com/valinet/d0f72ff09773702584e77c46065b95e0/raw/94036ed3e38218b87744a29ae5c40b06be637daf/ep_img0.png) [<2>](https://user-images.githubusercontent.com/6503598/131937638-d513ca72-ead7-459b-a8ce-619fb302b7da.png)
## dxgi.dll - the patcher
In the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section, you will find a download for a DLL called `dxgi.dll`. It has been tested on the latest stable build of Windows 11 (22000.258), but it may work just fine on newer builds too. This is the runtime part of the application. You need to place this DLL in the following location: `C:\Windows`. This will enable the following functionality:
* use the classic taskbar from Windows 10 (without the nasty effects of `UndockingDisabled`)
* restores the classic power user menu (`Win+X`) when using the classic taskbar
* Start menu follows the taskbar alignment setting (`Left`/`Center`) specified in `Settings\Personalization\Taskbar\Taskbar behaviors\Taskbar alignment`
* ability to show the Start menu on the monitor containing the cursor when pressing the Windows key
* skin "Safe to Remove Hardware" and "Bluetooth" popup menus
* play log on sound, if enabled
* option to hide the search bar in File Explorer
* option to disable the control center button in the taskbar
* show the "All apps" list by default when opening the Start menu
* customize the maximum number of "Most used" apps displayed in the "All apps" list in Start
* disable the immersive contex menu system-wide
* disable the Windows 11 File Explorer command bar
In the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section, you will find a download for a DLL called `dxgi.dll`. It has been tested on the latest stable build of Windows 11 (22000.258), but it may work just fine on newer builds too. This is the runtime part of the application. You need to place this DLL in the following location: `C:\Windows`.
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.
Important! As you may notice, the usual system tray icons are not enabled by default. To enable them, open the GUI (`Win`+`X` and choose "Enable missing system tray icons").
## Configuration interface
To configure the most common options, the application now comes with a configuration user interface. To open it, right click the Start button (or press `Win`+`X`) and choose "Properties". Alternatively, to open the GUI standalone, run the following command: `rundll32.exe C:\Windows\dxgi.dll,ZZGUI`.
To configure the most common options, the application now comes with a configuration user interface. To open it, right click the Start button (or press `Win`+`X`) and choose "Properties".
<img src="https://user-images.githubusercontent.com/6503598/137055901-68856ad5-4a52-4eea-a011-3b907a469938.png" width=60% height=60%>
All of the options described above, and more, can be configured using the GUI. Below is a screenshot of the main page ("Taskbar") of the configuration interface.
<img src="https://user-images.githubusercontent.com/6503598/137473878-4f1307c3-e070-40f8-863f-3c77de8a4364.png" width=60% height=60%>
The icon near an option signifies its current state:
* ✔️ enabled
* ❌ disabled
* performs an action that allows you to change that option (usually, the current value is located after the colon in its description)
The links at the bottom allow you to perform the most frequent actions.
* link to another resource
## Recommended tools
@ -70,137 +92,8 @@ You can try one of my other utilities available [here](https://github.com/valine
## Manual configuration
To learn how to configure all the options manually, read on:
You can manually configure the application by setting registry values. The registry entries supported by this application are described in [this file](https://github.com/valinet/ExplorerPatcher/blob/master/ExplorerPatcher/settings.reg).
### Enable system tray icons
As you have noticed, some system tray icons are missing (for example, the clock, notification center button, network, battery, sound etc). To enable these icons, open the following using Run:
```
%windir%\explorer.exe shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\SystemIcons
```
In the window that appears, toggle to `On` whatever icons you would like to have enabled in the taskbar.
### Show labels for taskbar buttons
One of the great features the old taskbar had was the ability to ungroup the taskbar buttons, showing a button with a label for each window that the user currently has open. To enable this functionality, run either of the following commands, depending on your preference.
#### Ungroup icons on all taskbars
Run this command as administrator:
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /f /v "NoTaskGrouping" /t REG_DWORD /d 1
```
#### Ungroup icons on main taskbar only
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v "TaskbarGlomLevel" /t REG_DWORD /d 2
```
#### Ungroup icons on secondary taskbars
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v "MMTaskbarGlomLevel" /t REG_DWORD /d 2
```
In the commands above, change `2` to `0` for "Always combine" and `2` to `1` for "Combine when taskbar is full`.
### Disable the immersive context menu
As you probably have noticed, Windows 11 introduced a simplified context menu in File Explorer. To get to the old menu which contains all entries from shell extensions, one has to click on "Show more options" or type Shift+F10. To disable this new menu, run the following command:
```
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
```
To restore back the immersive menu, run:
```
reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f
```
### Disable the command bar in File Explorer
In Windows 11, File Explorer comes with a command bar instead of the traditional ribbon. To disable this and get back the ribbon, run the following command:
```
reg.exe add "HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" /f /ve
```
To restore back the command bar, run:
```
reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f
```
If you want to get back the command bar from Windows 7, after enabling back the ribbon, [OldNewExplorer](https://msfn.org/board/topic/170375-oldnewexplorer-119/) will allow you to do so, and many more options, like drive ungrouping in This PC, as it used to be prior to Windows 8.1.
### Disable the modern search box in File Explorer
In Windows 10 1903, Microsoft introduced a new search box in File Explorer. This new search control is clunky, does not search automatically and usually is kind of broken. The old search box remains available, but only in Control Panel windows. To enable it on all File Explorer windows, run the following command:
```
reg.exe add "HKCU\Software\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs" /f /ve /t REG_SZ /d "{64bc32b5-4eec-4de7-972d-bd8bd0324537}"
```
To restore the modern search box, run:
```
reg.exe delete "HKCU\Software\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}" /f
```
Also, in the next section, which desribes the configuration options for the software, you will learn about how to disable the search box altogether, should you want to.
### Patcher settings
Now that you have set up the basic stuff, you can choose to enable additional settings to enhance the experience even more. For this, customize the following commands by changing the number acording to your needs:
* `HideExplorerSearchBar` completely removes the search box in File Explorer (default = 0)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher" /f /v "HideExplorerSearchBar" /t REG_DWORD /d 1
```
* `HideControlCenterButton` disables the Control Center button and its associated shortcut key (`Win`+`A`) (default = 0)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher" /f /v "HideControlCenterButton" /t REG_DWORD /d 1
```
* `SkinMenus` applies the immersive skin to "Safe to Remove Hardware" and "Bluetooth" pop-up menus (default = 1)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher" /f /v "SkinMenus" /t REG_DWORD /d 1
```
* `ReplaceNetwork` makes right clicking the system tray network icon and choosing "Open Network & Internet settings" open the "Network and Sharing Center" page in Control Panel instead of the network section of the Settings app (default = 0)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher" /f /v "ReplaceNetwork" /t REG_DWORD /d 1
```
* `AllocConsole` will display a console window (for debugging purposes) (default = 0, for advanced users only)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher" /f /v "AllocConsole" /t REG_DWORD /d 1
```
* `ExplorerReadyDelay` adds even more delay before the shell is announced that Explorer is ready loading (helps if you experience a delay at logon) - the unit is ms (milliseconds), 1000ms = 1 second (default = 0, for advanced users only)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher" /f /v "ExplorerReadyDelay" /t REG_DWORD /d 1000
```
Also, if you chose to place the patcher in `C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy` as well, use the following commands to configure Start menu options:
* Open Start menu to "All apps" directly (replace with 0 to disable)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage" /f /v "MakeAllAppsDefault" /t REG_DWORD /d 1
```
* Show only 4 most recent apps (change the number to customize)
```
reg.exe add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v "Start_MaximumFrequentApps" /t REG_DWORD /d 4
```
## More configuration
Even more registry configuration settings are described in the following document, make sure to take a look on it [here](https://github.com/valinet/ExplorerPatcher/issues/9).

1
libs/sws Submodule

@ -0,0 +1 @@
Subproject commit 52572a5d458bef414812a3c32836530d0a857514