Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Merge branch 'valinet-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
creeper-0910 committed Oct 28, 2023
2 parents 9e860d8 + 9b62585 commit 75a5cf8
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 70 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ Note: After updating to this version, the symbols will be re-downloaded even if
* Taskbar10: Fixed Control Center and Toast Center positioning on build 25951 (Canary). (dca0b3a)
* Taskbar10: Fixed start menu position when the taskbar is at the left or right side on Moment 4 builds. (a57471f)
* Taskbar10: Fixed the Windows 10 taskbar background patch to not crash anymore on build 25951 (Canary). (b52bd79)
* Taskbar10: Made taskbar fonts (when using classic theme mitigations) more accurate (thanks @aubymori). (8fc53a1)
* Start10: Fixed a bug where certain texts in the Windows 10 Start menu stayed in English. (c6a7d3f, ed251e9)
* Taskbar10: Made classic theme taskbar fonts more accurate. Thanks @aubymori! (8fc53a1)
* Start10: Fixed a bug where certain texts in the Windows 10 Start menu stayed in English. (655e62c, 5321766)
* Start10: Properly fixed start menu showing/hiding along with its original animations on builds 22000.65+. (7e2f768)
* GUI: Fixed a bug where "Remember last used section" doesn't remember the current page after being enabled. (dcf72bb)
* GUI: Fixed a bug where "Remember last used section" doesn't remember the current page after being enabled. (11160c8)
* Symbols: Reworked how symbols are managed so that symbols don't need to be successfully downloaded in succession. (8412bd6)
* Setup: Fixed uninstallation of EP installations that have went through upgrades before the proper Pin to Start fix. (845d2b5, a7c87ce)

## 22621.2361.58

Expand Down
38 changes: 31 additions & 7 deletions ExplorerPatcher/StartMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ BOOL NeedsRo_PositionStartMenuForMonitor(
//hr = (*(HRESULT(**)(INT64, INT64*))(*(INT64*)pTaskbarLayoutFactory + 48))(pTaskbarLayoutFactory, &v12);
hr = pTaskbarLayoutFactory->lpVtbl->get_Current(pTaskbarLayoutFactory, &pTaskbarLayout);
}
int interfaceVersion = 1;
if (SUCCEEDED(hr))
{
/*hr = (**(HRESULT(***)(INT64, GUID*, INT64*))v12)(
Expand All @@ -689,6 +690,15 @@ BOOL NeedsRo_PositionStartMenuForMonitor(
&IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,
&pTaskbarLayoutManager
);
if (hr == E_NOINTERFACE)
{
interfaceVersion = 2;
hr = pTaskbarLayout->lpVtbl->QueryInterface(
pTaskbarLayout,
&IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2,
&pTaskbarLayoutManager
);
}
}
if (SUCCEEDED(hr))
{
Expand All @@ -714,12 +724,26 @@ BOOL NeedsRo_PositionStartMenuForMonitor(

if (data->operation == STARTMENU_POSITIONING_OPERATION_ADD)
{
hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,
NULL
);
if (interfaceVersion == 1)
{
hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,
NULL
);
}
else
{
unsigned __int64 result = 0;
hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded2(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,
NULL,
&result
);
}
data->pMonitorList[InterlockedIncrement(data->pMonitorCount) - 1] = hMonitor;
printf("[Positioning] Added settings for monitor %p : %d\n", hMonitor, data->location);
}
Expand All @@ -729,7 +753,7 @@ BOOL NeedsRo_PositionStartMenuForMonitor(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings
);
); // TODO Doesn't work when the 2nd interface is used. Needs further investigation
printf("[Positioning] Changed settings for monitor: %p : %d\n", hMonitor, data->location);
}
else if (data->operation == STARTMENU_POSITIONING_OPERATION_REMOVE)
Expand Down
31 changes: 24 additions & 7 deletions ExplorerPatcher/StartMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,16 @@ interface WindowsUdk_UI_Shell_TaskbarLayoutStatics // : IInspectable
};

DEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,
0x4FB10D7C4,
0xFB10D7C4,
0x4F7F, 0x5DE5, 0xA5, 0x28,
0x7e, 0xfe, 0xf4, 0x18, 0xaa, 0x48
0x7E, 0xFE, 0xF4, 0x18, 0xAA, 0x48
);

// Used in 23545+ (or maybe couple lower builds too). Still named ITaskbarLayoutManager but has different ReportMonitorAdded signature.
DEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2,
0x98F82ED2,
0x4791, 0x58A0, 0x8D, 0x2F,
0xDA, 0xBD, 0x7A, 0x2F, 0x18, 0x9F
);

typedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtbl
Expand Down Expand Up @@ -325,11 +332,21 @@ typedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtb
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
/* [out] */ __RPC__out TrustLevel* trustLevel);

HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
__RPC__in HMONITOR hMonitor,
__RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,
__RPC__in LPRECT _unknown_lpGeometry);
union
{
HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
__RPC__in HMONITOR hMonitor,
__RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,
__RPC__in void* _unknown_shellViewToRectMap);

HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded2)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
__RPC__in HMONITOR hMonitor,
__RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,
__RPC__in void* _unknown_shellViewToRectMap,
/* [out] */ __RPC__out unsigned __int64* result);
};

HRESULT(STDMETHODCALLTYPE* ReportMonitorRemoved)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
Expand Down
98 changes: 60 additions & 38 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,29 +1247,32 @@ DWORD ShowLauncherTipContextMenu(
offset_in_class = 8;
}

WNDCLASS wc = { 0 };
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = CLauncherTipContextMenu_WndProc;
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = LAUNCHERTIP_CLASS_NAME;
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
RegisterClass(&wc);
static ATOM windowRegistrationAtom = 0;
if (windowRegistrationAtom == 0)
{
WNDCLASS wc = {
.style = CS_DBLCLKS,
.lpfnWndProc = CLauncherTipContextMenu_WndProc,
.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH),
.hInstance = GetModuleHandleW(NULL),
.lpszClassName = LAUNCHERTIP_CLASS_NAME,
.hCursor = LoadCursorW(NULL, IDC_ARROW)
};
ATOM atom = RegisterClassW(&wc);
if (atom)
windowRegistrationAtom = atom;
}

hWinXWnd = CreateWindowInBand(
0,
LAUNCHERTIP_CLASS_NAME,
MAKEINTATOM(windowRegistrationAtom),
0,
WS_POPUP,
0,
0,
0,
0,
0,
0,
0, 0, 0, 0,
NULL, NULL,
GetModuleHandle(NULL),
(char*)params->_this - 0x58,
7
7 // ZBID_IMMERSIVE_EDGY
);
// DO NOT USE ShowWindow here; it breaks the window order
// and renders the desktop toggle unusable; but leave
Expand Down Expand Up @@ -10689,8 +10692,25 @@ static struct
int startExperienceManager_bMaybeFullScreenMode;
} g_SMAnimationPatchOffsets;

enum EDGEUI_TRAYSTUCKPLACE {};
enum DWMTRANSITION_TARGET {};
// Names are custom
enum EDGEUI_TRAYSTUCKPLACE
{
TSP_LEFT,
TSP_TOP,
TSP_RIGHT,
TSP_BOTTOM,
};

// Names taken from Windows.UI.Xaml.pdb, only defining the used ones
enum DWMTRANSITION_TARGET
{
DWMTARGET_LAUNCHERFLYOUTTOLEFT = 0x4D,
DWMTARGET_LAUNCHERFLYOUTTORIGHT = 0x4E,
DWMTARGET_LAUNCHERFLYOUTTOTOP = 0x4F,
DWMTARGET_LAUNCHERFLYOUTTOBOTTOM = 0x50,
DWMTARGET_LAUNCHERFLYOUT = 0x51,
DWMTARGET_LAUNCHERFULLSCREEN = 0x52,
};

HRESULT(*CStartExperienceManager_GetMonitorInformationFunc)(void* _this, void* experience, RECT* a3, enum EDGEUI_TRAYSTUCKPLACE* pTsp, bool* a5, RECT* a6, HMONITOR* a7);
HRESULT(*CExperienceManagerAnimationHelper_BeginFunc)(void* _this, void*, enum DWMTRANSITION_TARGET, const RECT*, const RECT*, const RECT*, const RECT*, const RECT*);
Expand All @@ -10713,17 +10733,17 @@ HRESULT OnViewCloakingHook(void* eventHandler, void* experience)
if (FAILED(hr))
return hr;

enum DWMTRANSITION_TARGET target = 0x51;
enum DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT;
if (*(bool*)((PBYTE)experience + 0x34))
target = 0x52;
else if (tsp == 0)
target = 0x4D;
else if (tsp == 1)
target = 0x4F;
else if (tsp == 2)
target = 0x4E;
else if (tsp == 3)
target = 0x50;
target = DWMTARGET_LAUNCHERFULLSCREEN;
else if (tsp == TSP_LEFT)
target = DWMTARGET_LAUNCHERFLYOUTTOLEFT;
else if (tsp == TSP_TOP)
target = DWMTARGET_LAUNCHERFLYOUTTOTOP;
else if (tsp == TSP_RIGHT)
target = DWMTARGET_LAUNCHERFLYOUTTORIGHT;
else if (tsp == TSP_BOTTOM)
target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM;

hr = CExperienceManagerAnimationHelper_BeginFunc(
_this + g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation,
Expand All @@ -10741,17 +10761,19 @@ HRESULT CStartExperienceManager_GetMonitorInformationHook(void* _this, void* exp
if (SUCCEEDED(hr) && *(PBYTE)_ReturnAddress() == 0x85 && *((PBYTE)_ReturnAddress() + 1) == 0xC0 && *((PBYTE)_ReturnAddress() + 2) == 0x78)
{
experience = (PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_singleViewShellExperience;
enum DWMTRANSITION_TARGET target = 0x51;

enum DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT;
if (*(bool*)((PBYTE)experience + 0x34))
target = 0x52;
else if (*pTsp == 0)
target = 0x4E;
else if (*pTsp == 1)
target = 0x50;
else if (*pTsp == 2)
target = 0x4D;
else if (*pTsp == 3)
target = 0x4F;
target = DWMTARGET_LAUNCHERFULLSCREEN;
else if (*pTsp == TSP_LEFT)
target = DWMTARGET_LAUNCHERFLYOUTTORIGHT;
else if (*pTsp == TSP_TOP)
target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM;
else if (*pTsp == TSP_RIGHT)
target = DWMTARGET_LAUNCHERFLYOUTTOLEFT;
else if (*pTsp == TSP_BOTTOM)
target = DWMTARGET_LAUNCHERFLYOUTTOTOP;

CExperienceManagerAnimationHelper_BeginFunc(
(PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation,
*(void**)((PBYTE)experience + 0x18), // viewWrapper
Expand Down
15 changes: 6 additions & 9 deletions ExplorerPatcher/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,8 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS)
{
szStoredHash[0] = 0;
dwSize = sizeof(szStoredHash);
RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize);

if (!_stricmp(szHash, szStoredHash))
if (RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS
&& !_stricmp(szHash, szStoredHash))
{
dwSize = sizeof(DWORD);
RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_0), 0, NULL, &symbols_PTRS->twinui_pcshell_PTRS[0], &dwSize);
Expand Down Expand Up @@ -613,9 +612,8 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS)
{
szStoredHash[0] = 0;
dwSize = sizeof(szStoredHash);
RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize);

if (!_stricmp(szHash, szStoredHash))
if (RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS
&& !_stricmp(szHash, szStoredHash))
{
dwSize = sizeof(DWORD);
RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_0), 0, NULL, &symbols_PTRS->startdocked_PTRS[0], &dwSize);
Expand Down Expand Up @@ -663,9 +661,8 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS)
{
szStoredHash[0] = 0;
dwSize = sizeof(szStoredHash);
RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize);

if (!_stricmp(szHash, szStoredHash))
if (RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS
&& !_stricmp(szHash, szStoredHash))
{
dwSize = sizeof(DWORD);
RegQueryValueExW(hKey, TEXT(STARTUI_SB_0), 0, NULL, &symbols_PTRS->startui_PTRS[0], &dwSize);
Expand Down
6 changes: 3 additions & 3 deletions ExplorerPatcher/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
return lRes;
}

static HWND(WINAPI* CreateWindowInBand)(
HWND(WINAPI* CreateWindowInBand)(
_In_ DWORD dwExStyle,
_In_opt_ ATOM atom,
_In_opt_ LPCWSTR lpClassName,
_In_opt_ LPCWSTR lpWindowName,
_In_ DWORD dwStyle,
_In_ int X,
Expand All @@ -357,7 +357,7 @@ static HWND(WINAPI* CreateWindowInBand)(
_In_opt_ HINSTANCE hInstance,
_In_opt_ LPVOID lpParam,
DWORD band
);
);

BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand);

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# ExplorerPatcher-jp

[![Discordに参加する](https://discordapp.com/api/guilds/1155912047897350204/widget.png?style=shield)](https://discord.gg/gsPcfqHTD2)

このプロジェクトは、Windows上での作業環境を改善することを目的としています。

## ⚠️警告
Expand Down Expand Up @@ -100,4 +103,4 @@ valinet氏 (ExplorerPatcher公式の作者)へ寄付は、[PayPal](https://www.p

creeper-0910 (ExplorerPatcher-jpの作者)へ寄付は、[Github Sponsor](https://github.com/sponsors/creeper-0910)かTwitterのDMからAmazonギフト券を送っていただけるとめちゃくちゃ喜びます。

Discord サーバーは[こちら](https://discord.gg/gsPcfqHTD2)から参加可能です
ExplorerPatcherについての詳細は[こちら](https://github.com/valinet/ExplorerPatcher/wiki)から確認できます。(英語)
17 changes: 15 additions & 2 deletions ep_setup/ep_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,23 @@ int WINAPI wWinMain(
if (bOk && IsWindows11())
{
GetWindowsDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\en-US\\StartTileDataLegacy.dll.mui");
wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\en-US");
if (FileExistsW(wszPath))
{
bOk = DeleteFileW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\StartTileDataLegacy.dll.mui");
if (FileExistsW(wszPath))
{
bOk = DeleteFileW(wszPath);
}
if (bOk)
{
PathRemoveExtensionW(wszPath);
wcscat_s(wszPath, MAX_PATH, L".prev");
if (FileExistsW(wszPath))
{
bOk = DeleteFileW(wszPath);
}
}
if (bOk)
{
GetWindowsDirectoryW(wszPath, MAX_PATH);
Expand Down

0 comments on commit 75a5cf8

Please sign in to comment.