Browse Source

Default to Windows 10 (EP) taskbar, then Windows 10 stock taskbar, then Windows 11 taskbar

pull/4568/head
Amrsatrio 3 months ago
parent
commit
ad2fa72c02
  1. 2
      ExplorerPatcher-L10N
  2. 4
      ExplorerPatcher/dllmain.c
  3. 11
      ExplorerPatcher/utility.h
  4. 74
      ep_gui/GUI.c
  5. 1
      ep_gui/resources/EPSettingsResources.h
  6. 1
      ep_gui/resources/lang/ep_gui.en-US.rc
  7. 5
      ep_gui/resources/settings.reg
  8. 4
      ep_gui/resources/settings10.reg

2
ExplorerPatcher-L10N

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 721eaab183e199f552d21af53a5e55a4070cd2ce
Subproject commit 314ebed7656c480f39c2a0813f78633edab895f5

4
ExplorerPatcher/dllmain.c

@ -74,7 +74,7 @@ DWORD32 global_ubr; @@ -74,7 +74,7 @@ DWORD32 global_ubr;
BOOL bIsExplorerProcess = FALSE;
BOOL bInstanced = FALSE;
HWND archivehWnd;
DWORD bOldTaskbar = TRUE;
DWORD bOldTaskbar = -1;
DWORD bWasOldTaskbarSet = FALSE;
DWORD bAllocConsole = FALSE;
DWORD bHideExplorerSearchBar = FALSE;
@ -5896,7 +5896,7 @@ void WINAPI LoadSettings(LPARAM lParam) @@ -5896,7 +5896,7 @@ void WINAPI LoadSettings(LPARAM lParam)
RegCloseKey(hKey);
return;
}
dwTemp = TRUE;
dwTemp = IsWindows11() ? 2 : 1;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,

11
ExplorerPatcher/utility.h

@ -1007,11 +1007,22 @@ inline void AdjustTaskbarStyleValue(DWORD* pdwValue) @@ -1007,11 +1007,22 @@ inline void AdjustTaskbarStyleValue(DWORD* pdwValue)
{
*pdwValue = 1;
}
if (IsWindows11())
{
if (*pdwValue == 1 && !IsStockWindows10TaskbarAvailable())
{
*pdwValue = 0;
}
}
else
{
if (*pdwValue == 0)
{
*pdwValue = 1; // There's no such thing as Windows 11 taskbar on Windows 10
}
}
}
#ifdef __cplusplus
}

74
ep_gui/GUI.c

@ -11,7 +11,7 @@ void* GUI_FileMapping = NULL; @@ -11,7 +11,7 @@ void* GUI_FileMapping = NULL;
DWORD GUI_FileSize = 0;
BOOL g_darkModeEnabled = FALSE;
DWORD dwTaskbarPosition = 3;
DWORD GUI_TaskbarStyle = 1;
DWORD GUI_TaskbarStyle = -1;
LSTATUS SetPolicy(HKEY hKey, LPCWSTR wszPolicyPath, LPCWSTR wszPolicyName, DWORD dwVal)
{
@ -1022,9 +1022,9 @@ static void GUI_UpdateLanguages() @@ -1022,9 +1022,9 @@ static void GUI_UpdateLanguages()
EP_L10N_GetCurrentThreadLanguage(wszThreadLanguage, ARRAYSIZE(wszThreadLanguage));
}
DWORD GUI_GetTaskbarStyle(BOOL bAdjust)
static DWORD GUI_GetTaskbarStyle(BOOL bAdjust)
{
DWORD dwRes = 1;
DWORD dwRes = IsWindows11() ? 2 : 1;
DWORD dwSize = sizeof(DWORD);
RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L"OldTaskbar", RRF_RT_DWORD, NULL, &dwRes, &dwSize);
if (bAdjust)
@ -1034,6 +1034,20 @@ DWORD GUI_GetTaskbarStyle(BOOL bAdjust) @@ -1034,6 +1034,20 @@ DWORD GUI_GetTaskbarStyle(BOOL bAdjust)
return dwRes;
}
static void GUI_RemoveChoiceEntry(HMENU hMenu, UINT value)
{
MENUITEMINFOA menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
menuInfo.fMask = MIIM_DATA;
GetMenuItemInfoA(hMenu, value + 1, FALSE, &menuInfo);
if (menuInfo.dwItemData)
{
free(menuInfo.dwItemData);
}
RemoveMenu(hMenu, value + 1, MF_BYCOMMAND);
}
static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
GUI* _this;
@ -1187,7 +1201,6 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) @@ -1187,7 +1201,6 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
else if (!_stricmp(funcName, "!IsOldTaskbar") && GUI_GetTaskbarStyle(TRUE) != 0) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsStockWin10Taskbar") && GUI_GetTaskbarStyle(TRUE) != 1) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsAltImplTaskbar") && GUI_GetTaskbarStyle(TRUE) <= 1) bSkipLines = TRUE;
else if (!_stricmp(funcName, "!IsStockWindows10TaskbarAvailable") && !(!IsStockWindows10TaskbarAvailable() && GUI_GetTaskbarStyle(FALSE) == 1)) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsWindows10StartMenu") && (!DoesWindows10StartMenuExist() || (dwRes = 0, RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"Start_ShowClassicMode", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 1)))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "!IsWindows10StartMenu") && (DoesWindows10StartMenuExist() && (dwRes = 0, RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"Start_ShowClassicMode", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes == 1)))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "DoesWindows10StartMenuExist") && !DoesWindows10StartMenuExist()) bSkipLines = TRUE;
@ -2517,16 +2530,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) @@ -2517,16 +2530,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
if (GUI_TaskbarStyle == 0)
{
MENUITEMINFOA menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
menuInfo.fMask = MIIM_DATA;
GetMenuItemInfoA(hMenu, 3, FALSE, &menuInfo);
if (menuInfo.dwItemData)
{
free(menuInfo.dwItemData);
}
RemoveMenu(hMenu, 3, MF_BYCOMMAND);
GUI_RemoveChoiceEntry(hMenu, 2);
bShouldAlterTaskbarDa = TRUE;
}
}
@ -2534,41 +2538,19 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) @@ -2534,41 +2538,19 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
if (GUI_TaskbarStyle == 0)
{
MENUITEMINFOA menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
menuInfo.fMask = MIIM_DATA;
GetMenuItemInfoA(hMenu, 1, FALSE, &menuInfo);
if (menuInfo.dwItemData)
{
free(menuInfo.dwItemData);
}
RemoveMenu(hMenu, 1, MF_BYCOMMAND);
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
menuInfo.fMask = MIIM_DATA;
GetMenuItemInfoA(hMenu, 3, FALSE, &menuInfo);
if (menuInfo.dwItemData)
{
free(menuInfo.dwItemData);
}
RemoveMenu(hMenu, 3, MF_BYCOMMAND);
GUI_RemoveChoiceEntry(hMenu, 0); // Left
GUI_RemoveChoiceEntry(hMenu, 2); // Right
}
}
else if (!wcscmp(name, L"OldTaskbar"))
{
if (!DoesTaskbarDllExist())
{
MENUITEMINFOA menuInfo;
ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));
menuInfo.cbSize = sizeof(MENUITEMINFOA);
menuInfo.fMask = MIIM_DATA;
GetMenuItemInfoA(hMenu, 3, FALSE, &menuInfo);
if (menuInfo.dwItemData)
if (IsWindows11() && !IsStockWindows10TaskbarAvailable())
{
free(menuInfo.dwItemData);
GUI_RemoveChoiceEntry(hMenu, 1); // Windows 10
}
RemoveMenu(hMenu, 3, MF_BYCOMMAND);
if (!DoesTaskbarDllExist())
{
GUI_RemoveChoiceEntry(hMenu, 2); // Windows 10 (ExplorerPatcher)
}
}
else if (!wcscmp(name, L"ReplaceVan"))
@ -2663,12 +2645,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) @@ -2663,12 +2645,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
);
if (!wcscmp(name, L"OldTaskbar"))
{
AdjustTaskbarStyleValue(&value);
GUI_TaskbarStyle = value;
AdjustTaskbarStyleValue(&GUI_TaskbarStyle);
if (value >= 2 && !DoesTaskbarDllExist())
{
value = 0;
}
}
if (hDC && bInvert)
{

1
ep_gui/resources/EPSettingsResources.h

@ -49,7 +49,6 @@ @@ -49,7 +49,6 @@
#define IDS_TB_ICONSIZE_0 1046
#define IDS_TB_STYLE_2 1047
#define IDS_TB_ALTIMPL_NOTICE 1048
#define IDS_TB_WIN10_UNAVAILABLE 1049
#define IDS_TRAY 1101
#define IDS_TRAY_SKINMENUS 1102

1
ep_gui/resources/lang/ep_gui.en-US.rc

@ -43,7 +43,6 @@ BEGIN @@ -43,7 +43,6 @@ BEGIN
IDS_TB_STYLE_0 "Windows 11 (default)"
IDS_TB_STYLE_1 "Windows 10"
IDS_TB_STYLE_2 "Windows 10 (ExplorerPatcher)"
IDS_TB_WIN10_UNAVAILABLE "Windows 10 taskbar is not available in this version of Windows."
IDS_TB_MORE "More taskbar options in the Settings app"
IDS_TB_CUSTOMIZETRAYICONS "Customize notification area icons"
IDS_TB_CUSTOMIZESYSTEMICONS "Customize system icons in the notification area"

5
ep_gui/resources/settings.reg

@ -10,10 +10,7 @@ @@ -10,10 +10,7 @@
;x 0 %R:1003%
;x 1 %R:1004%
;x 2 %R:1047%
"OldTaskbar"=dword:00000001
;s Taskbar_StockWin10Unavailable !IsStockWindows10TaskbarAvailable
;t ⚠ %R:1049%
;g Taskbar_StockWin10Unavailable
"OldTaskbar"=dword:00000002
;y %R:1005% 🡕
;ms-settings:taskbar
;y %R:1006% 🡕

4
ep_gui/resources/settings10.reg

@ -7,9 +7,9 @@ @@ -7,9 +7,9 @@
;T %R:1001%
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;z 2 %R:1002% *
;x 0 %R:1404%
;x 1 %R:1404%
;x 2 %R:1047%
"OldTaskbar"=dword:00000000
"OldTaskbar"=dword:00000001
;y %R:1005% 🡕
;ms-settings:taskbar
;y %R:1006% 🡕

Loading…
Cancel
Save