mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-27 17:00:59 +01:00
Taskbar10: Fixed start menu/search flyout positioning code crashing Explorer when the display resolution changes
This commit is contained in:
parent
d6cdb5d8ed
commit
7d0cdde356
@ -1 +1 @@
|
||||
Subproject commit 6012fe38c9220ebfc685e3a2f65ea6d8262717a5
|
||||
Subproject commit d09fb3722cda34c082a1bb2645224a85af1d27e8
|
@ -1079,6 +1079,13 @@ HRESULT WINAPI windowsudkshellcommon_SLGetWindowsInformationDWORDHook(PCWSTR pws
|
||||
return hr;
|
||||
}
|
||||
|
||||
static BOOL(*windowsudkshellcommon_TaskbarMultiMonIsEnabledFunc)(void* _this) = NULL;
|
||||
|
||||
bool windowsudkshellcommon_TaskbarMultiMonIsEnabledHook(void* _this)
|
||||
{
|
||||
return bOldTaskbar ? false : windowsudkshellcommon_TaskbarMultiMonIsEnabledFunc(_this);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@ -12264,14 +12271,42 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
}
|
||||
|
||||
HANDLE hWindowsudkShellcommon = LoadLibraryW(L"windowsudk.shellcommon.dll");
|
||||
HANDLE hSLC = LoadLibraryW(L"slc.dll");
|
||||
if (hWindowsudkShellcommon && hSLC)
|
||||
if (hWindowsudkShellcommon)
|
||||
{
|
||||
SLGetWindowsInformationDWORDFunc = GetProcAddress(hSLC, "SLGetWindowsInformationDWORD");
|
||||
|
||||
if (SLGetWindowsInformationDWORDFunc)
|
||||
HANDLE hSLC = LoadLibraryW(L"slc.dll");
|
||||
if (hSLC)
|
||||
{
|
||||
VnPatchDelayIAT(hWindowsudkShellcommon, "ext-ms-win-security-slc-l1-1-0.dll", "SLGetWindowsInformationDWORD", windowsudkshellcommon_SLGetWindowsInformationDWORDHook);
|
||||
SLGetWindowsInformationDWORDFunc = GetProcAddress(hSLC, "SLGetWindowsInformationDWORD");
|
||||
|
||||
if (SLGetWindowsInformationDWORDFunc)
|
||||
{
|
||||
VnPatchDelayIAT(hWindowsudkShellcommon, "ext-ms-win-security-slc-l1-1-0.dll", "SLGetWindowsInformationDWORD", windowsudkshellcommon_SLGetWindowsInformationDWORDHook);
|
||||
}
|
||||
}
|
||||
|
||||
MODULEINFO mi;
|
||||
GetModuleInformation(GetCurrentProcess(), hWindowsudkShellcommon, &mi, sizeof(MODULEINFO));
|
||||
|
||||
// Fix ReportMonitorRemoved in UpdateStartMenuPositioning crashing, *for now*
|
||||
// We can't use our RtlQueryFeatureConfiguration() hook because our function didn't get called with the feature ID
|
||||
// TODO Need to check again later after this feature flag has been removed
|
||||
// E8 ?? ?? ?? ?? 48 8B 7D FF 84 C0 74 1F 48 8D 4F 08
|
||||
PBYTE match = FindPattern(
|
||||
hWindowsudkShellcommon,
|
||||
mi.SizeOfImage,
|
||||
"\xE8\x00\x00\x00\x00\x48\x8B\x7D\xFF\x84\xC0\x74\x1F\x48\x8D\x4F\x08",
|
||||
"x????xxxxxxxxxxxx"
|
||||
);
|
||||
if (match)
|
||||
{
|
||||
match += 5 + *(int*)(match + 1);
|
||||
windowsudkshellcommon_TaskbarMultiMonIsEnabledFunc = match;
|
||||
printf("wil::details::FeatureImpl<__WilFeatureTraits_Feature_Servicing_TaskbarMultiMon_38545217>::__private_IsEnabled() = %llX\n", match - (PBYTE)hWindowsudkShellcommon);
|
||||
rv = funchook_prepare(
|
||||
funchook,
|
||||
(void**)&windowsudkshellcommon_TaskbarMultiMonIsEnabledFunc,
|
||||
windowsudkshellcommon_TaskbarMultiMonIsEnabledHook
|
||||
);
|
||||
}
|
||||
|
||||
printf("Setup windowsudk.shellcommon functions done\n");
|
||||
|
@ -368,9 +368,9 @@ BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand);
|
||||
|
||||
INT64(*SetWindowCompositionAttribute)(HWND, void*);
|
||||
|
||||
static void(*SetPreferredAppMode)(bool bAllowDark);
|
||||
static void(*SetPreferredAppMode)(BOOL bAllowDark);
|
||||
|
||||
static void(*AllowDarkModeForWindow)(HWND hWnd, bool bAllowDark);
|
||||
static void(*AllowDarkModeForWindow)(HWND hWnd, BOOL bAllowDark);
|
||||
|
||||
static bool(*ShouldAppsUseDarkMode)();
|
||||
|
||||
|
@ -1002,7 +1002,9 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
||||
DttOpts.crText = g_darkModeEnabled ? GUI_TEXTCOLOR_DARK : GUI_TEXTCOLOR;
|
||||
DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS;
|
||||
RECT rcText;
|
||||
DWORD dwMaxHeight = 0, dwMaxWidth = (DWORD)(480 * (_this->dpi.x / 96.0));
|
||||
DWORD dwMinWidthDp = 480;
|
||||
if (!wcscmp(wszLanguage, L"nl-NL")) dwMinWidthDp = 600;
|
||||
DWORD dwMaxHeight = 0, dwMaxWidth = (DWORD)(dwMinWidthDp * (_this->dpi.x / 96.0));
|
||||
BOOL bTabOrderHit = FALSE;
|
||||
DWORD dwLeftPad = _this->padding.left + _this->sidebarWidth + _this->padding.right;
|
||||
DWORD dwInitialLeftPad = dwLeftPad;
|
||||
@ -3841,11 +3843,11 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
|
||||
ULONG ulNumLanguages = 0;
|
||||
LPCWSTR wszLanguagesBuffer = NULL;
|
||||
ULONG cchLanguagesBuffer = 0;
|
||||
if (GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, NULL, &cchLanguagesBuffer))
|
||||
if (GetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, NULL, &cchLanguagesBuffer))
|
||||
{
|
||||
if (wszLanguagesBuffer = malloc(cchLanguagesBuffer * sizeof(WCHAR)))
|
||||
{
|
||||
if (GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, wszLanguagesBuffer, &cchLanguagesBuffer))
|
||||
if (GetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, wszLanguagesBuffer, &cchLanguagesBuffer))
|
||||
{
|
||||
wcscpy_s(wszLanguage, MAX_PATH, wszLanguagesBuffer);
|
||||
bOk = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user