|
|
|
@ -2525,19 +2525,27 @@ INT64 Shell_TrayWndSubclassProc( |
|
|
|
DWORD_PTR bIsPrimaryTaskbar |
|
|
|
DWORD_PTR bIsPrimaryTaskbar |
|
|
|
) |
|
|
|
) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (uMsg == WM_NCDESTROY) |
|
|
|
switch (uMsg) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case WM_NCDESTROY: |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (bIsPrimaryTaskbar) |
|
|
|
if (bIsPrimaryTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UnhookWindowsHookEx(Shell_TrayWndMouseHook); |
|
|
|
UnhookWindowsHookEx(Shell_TrayWndMouseHook); |
|
|
|
} |
|
|
|
} |
|
|
|
RemoveWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc); |
|
|
|
RemoveWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (bOldTaskbar && !bIsPrimaryTaskbar && TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwMMOldTaskbarAl) && (uMsg == WM_NCLBUTTONDOWN || uMsg == WM_NCRBUTTONUP) && HandleTaskbarCornerInteraction(hWnd, uMsg, wParam, lParam)) |
|
|
|
case WM_NCLBUTTONDOWN: |
|
|
|
|
|
|
|
case WM_NCRBUTTONUP: |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (bOldTaskbar && !bIsPrimaryTaskbar && TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwMMOldTaskbarAl) && HandleTaskbarCornerInteraction(hWnd, uMsg, wParam, lParam)) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!bIsPrimaryTaskbar && uMsg == WM_CONTEXTMENU) |
|
|
|
case WM_CONTEXTMENU: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!bIsPrimaryTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Received some times when right clicking a secondary taskbar button, and it would
|
|
|
|
// Received some times when right clicking a secondary taskbar button, and it would
|
|
|
|
// show the classic taskbar context menu but containing only "Show desktop" instead
|
|
|
|
// show the classic taskbar context menu but containing only "Show desktop" instead
|
|
|
|
@ -2545,41 +2553,69 @@ INT64 Shell_TrayWndSubclassProc( |
|
|
|
// the right menu
|
|
|
|
// the right menu
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!bOldTaskbar && !bIsPrimaryTaskbar && uMsg == WM_SETCURSOR) |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case WM_SETCURSOR: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!bOldTaskbar && !bIsPrimaryTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Received when mouse is over taskbar edge and autohide is on
|
|
|
|
// Received when mouse is over taskbar edge and autohide is on
|
|
|
|
PostMessageW(hWnd, WM_ACTIVATE, WA_ACTIVE, NULL); |
|
|
|
PostMessageW(hWnd, WM_ACTIVATE, WA_ACTIVE, NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (bOldTaskbar && uMsg == WM_LBUTTONDBLCLK && bTaskbarAutohideOnDoubleClick) |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case WM_LBUTTONDBLCLK: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (bOldTaskbar && bTaskbarAutohideOnDoubleClick) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ToggleTaskbarAutohide(); |
|
|
|
ToggleTaskbarAutohide(); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (uMsg == WM_HOTKEY && wParam == 500 && lParam == MAKELPARAM(MOD_WIN, 0x41) && IsWindows11()) |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case WM_HOTKEY: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (wParam == 500 && lParam == MAKELPARAM(MOD_WIN, 'A') && global_rovi.dwBuildNumber >= 25921 && bOldTaskbar == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
InvokeActionCenter(); |
|
|
|
InvokeActionCenter(); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
/*if (lpShouldDisplayCCButton)
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case WM_DISPLAYCHANGE: |
|
|
|
{ |
|
|
|
{ |
|
|
|
*lpShouldDisplayCCButton = 1; |
|
|
|
if (bIsPrimaryTaskbar) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UpdateStartMenuPositioning(MAKELPARAM(TRUE, FALSE)); |
|
|
|
} |
|
|
|
} |
|
|
|
LRESULT lRes = DefSubclassProc(hWnd, uMsg, wParam, lParam); |
|
|
|
break; |
|
|
|
if (lpShouldDisplayCCButton) |
|
|
|
} |
|
|
|
|
|
|
|
/*case WM_PARENTNOTIFY:
|
|
|
|
{ |
|
|
|
{ |
|
|
|
*lpShouldDisplayCCButton = bHideControlCenterButton; |
|
|
|
if (!bOldTaskbar && wParam == WM_RBUTTONDOWN && !Shell_TrayWndMouseHook) // && !IsUndockingDisabled
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
DWORD dwThreadId = GetCurrentThreadId(); |
|
|
|
|
|
|
|
Shell_TrayWndMouseHook = SetWindowsHookExW(WH_MOUSE, Shell_TrayWndMouseProc, NULL, dwThreadId); |
|
|
|
} |
|
|
|
} |
|
|
|
return lRes;*/ |
|
|
|
break; |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
case WM_SETTINGCHANGE: |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (IsWindows11Version22H2OrHigher() && (*((WORD*)&(lParam)+1)) && !wcscmp(lParam, L"EnsureXAML")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
EnsureXAML(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (bIsPrimaryTaskbar && uMsg == WM_DISPLAYCHANGE) |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case 0x558: |
|
|
|
{ |
|
|
|
{ |
|
|
|
UpdateStartMenuPositioning(MAKELPARAM(TRUE, FALSE)); |
|
|
|
g_bIsDesktopRaised = (lParam & 1) == 0; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
//else if (!bOldTaskbar && uMsg == WM_PARENTNOTIFY && wParam == WM_RBUTTONDOWN && !Shell_TrayWndMouseHook) // && !IsUndockingDisabled
|
|
|
|
} |
|
|
|
//{
|
|
|
|
|
|
|
|
// DWORD dwThreadId = GetCurrentThreadId();
|
|
|
|
if (uMsg >= 0xC000 && uMsg <= 0xFFFF && uMsg == RegisterWindowMessageW(L"Windows11ContextMenu_" _T(EP_CLSID))) |
|
|
|
// Shell_TrayWndMouseHook = SetWindowsHookExW(WH_MOUSE, Shell_TrayWndMouseProc, NULL, dwThreadId);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
else if (uMsg == RegisterWindowMessageW(L"Windows11ContextMenu_" _T(EP_CLSID))) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
POINT pt; |
|
|
|
POINT pt; |
|
|
|
pt.x = GET_X_LPARAM(lParam); |
|
|
|
pt.x = GET_X_LPARAM(lParam); |
|
|
|
@ -2726,15 +2762,7 @@ INT64 Shell_TrayWndSubclassProc( |
|
|
|
DestroyMenu(hMenu); |
|
|
|
DestroyMenu(hMenu); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (uMsg == 1368) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
g_bIsDesktopRaised = (lParam & 1) == 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (uMsg == WM_SETTINGCHANGE && IsWindows11Version22H2OrHigher() && (*((WORD*)&(lParam)+1)) && !wcscmp(lParam, L"EnsureXAML")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
EnsureXAML(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return DefSubclassProc(hWnd, uMsg, wParam, lParam); |
|
|
|
return DefSubclassProc(hWnd, uMsg, wParam, lParam); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
@ -10130,7 +10158,9 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (bOldTaskbar) |
|
|
|
if (bOldTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Fixes start menu positioning when the taskbar is at the left or right side
|
|
|
|
// This feature flag when enabled makes the flyouts disregard the left and right offsets, so that they
|
|
|
|
|
|
|
|
// appear over the Copilot sidebar instead of beside it. Disabling this fixes start menu positioning
|
|
|
|
|
|
|
|
// when the taskbar is at the left or right side, but it produce that aforementioned behavior.
|
|
|
|
buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED; |
|
|
|
buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -10548,7 +10578,7 @@ BOOL Moment2PatchToastCenter(LPMODULEINFO mi) |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Pattern 2:
|
|
|
|
// Pattern 2:
|
|
|
|
// Will have a match if CToastCenterExperienceManager::ShouldShowWithinWorkArea() is inlined.
|
|
|
|
// Will have a match if CToastCenterExperienceManager::ShouldShowWithinWorkArea() is inlined.
|
|
|
|
// ```0F 10 45 ?? ?? 0F 7F 44 24 ?? 44 // movups - movdqu - cmp```
|
|
|
|
// ```0F 10 45 ?? ?? 0F 7F 44 24 ?? 44 38 // movups - movdqu - cmp```
|
|
|
|
// 25951.1000: 36B2C4
|
|
|
|
// 25951.1000: 36B2C4
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Pattern 3:
|
|
|
|
// Pattern 3:
|
|
|
|
@ -10558,20 +10588,20 @@ BOOL Moment2PatchToastCenter(LPMODULEINFO mi) |
|
|
|
//
|
|
|
|
//
|
|
|
|
// Pattern 4:
|
|
|
|
// Pattern 4:
|
|
|
|
// Same as pattern 2, but different length of the movdqu instruction.
|
|
|
|
// Same as pattern 2, but different length of the movdqu instruction.
|
|
|
|
// ```0F 10 45 ?? ?? 0F 7F 45 ?? 44 // movups - movdqu - cmp```
|
|
|
|
// ```0F 10 45 ?? ?? 0F 7F 45 ?? 44 38 // movups - movdqu - cmp```
|
|
|
|
// No matches yet, just in case.
|
|
|
|
// No matches yet, just in case.
|
|
|
|
int assignmentSize = 10; |
|
|
|
int assignmentSize = 10; |
|
|
|
PBYTE rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x48\x8B\xCF", "xxx??xxxx?xxx"); |
|
|
|
PBYTE rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x48\x8B\xCF", "xxx??xxxx?xxx"); |
|
|
|
if (!rcMonitorAssignment) |
|
|
|
if (!rcMonitorAssignment) |
|
|
|
{ |
|
|
|
{ |
|
|
|
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x44", "xxx??xxxx?x"); |
|
|
|
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x44\x38", "xxx??xxxx?xx"); |
|
|
|
if (!rcMonitorAssignment) |
|
|
|
if (!rcMonitorAssignment) |
|
|
|
{ |
|
|
|
{ |
|
|
|
assignmentSize = 9; |
|
|
|
assignmentSize = 9; |
|
|
|
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x48\x8B\xCF", "xxx??xxx?xxx"); |
|
|
|
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x48\x8B\xCF", "xxx??xxx?xxx"); |
|
|
|
if (!rcMonitorAssignment) |
|
|
|
if (!rcMonitorAssignment) |
|
|
|
{ |
|
|
|
{ |
|
|
|
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x44", "xxx??xxx?x"); |
|
|
|
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x44\x38", "xxx??xxx?xx"); |
|
|
|
if (!rcMonitorAssignment) return FALSE; |
|
|
|
if (!rcMonitorAssignment) return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -11865,22 +11895,9 @@ BOOL CrashCounterHandleEntryPoint() |
|
|
|
|
|
|
|
|
|
|
|
#pragma region "Loader for alternate taskbar implementation" |
|
|
|
#pragma region "Loader for alternate taskbar implementation" |
|
|
|
#ifdef _WIN64 |
|
|
|
#ifdef _WIN64 |
|
|
|
void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS) |
|
|
|
BOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!IsWindows11Version22H2OrHigher()) |
|
|
|
BOOL bAllValid = TRUE; |
|
|
|
return; // Definitely unsupported
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bOldTaskbar <= 1) |
|
|
|
|
|
|
|
return; // Not enabled
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const WCHAR* pszTaskbarDll = PickTaskbarDll(); |
|
|
|
|
|
|
|
if (!pszTaskbarDll) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
wprintf(L"[TB] Unsupported build\n"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool bAllValid = true; |
|
|
|
|
|
|
|
for (SIZE_T j = 0; j < ARRAYSIZE(symbols_PTRS->explorer_PTRS); ++j) |
|
|
|
for (SIZE_T j = 0; j < ARRAYSIZE(symbols_PTRS->explorer_PTRS); ++j) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DWORD i = symbols_PTRS->explorer_PTRS[j]; |
|
|
|
DWORD i = symbols_PTRS->explorer_PTRS[j]; |
|
|
|
@ -11888,10 +11905,33 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS) |
|
|
|
if (!bAllValid) |
|
|
|
if (!bAllValid) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return bAllValid; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!bAllValid) |
|
|
|
const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (bOldTaskbar < 2 || !IsWindows11Version22H2OrHigher()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const WCHAR* pszTaskbarDll = PickTaskbarDll(); |
|
|
|
|
|
|
|
if (!pszTaskbarDll) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
wprintf(L"[TB] Unsupported build\n"); |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!CheckExplorerSymbols(symbols_PTRS)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
wprintf(L"[TB] Missing offsets\n"); |
|
|
|
wprintf(L"[TB] Missing offsets\n"); |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return pszTaskbarDll; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!symbols_PTRS || !pszTaskbarDll) |
|
|
|
|
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -12345,6 +12385,12 @@ DWORD Inject(BOOL bIsExplorer) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const WCHAR* pszTaskbarDll = GetTaskbarDllChecked(&symbols_PTRS); |
|
|
|
|
|
|
|
if (bOldTaskbar >= 2 && !pszTaskbarDll) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bOldTaskbar = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HANDLE hUser32 = LoadLibraryW(L"user32.dll"); |
|
|
|
HANDLE hUser32 = LoadLibraryW(L"user32.dll"); |
|
|
|
CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand"); |
|
|
|
CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand"); |
|
|
|
@ -12685,7 +12731,7 @@ DWORD Inject(BOOL bIsExplorer) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW); |
|
|
|
VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW); |
|
|
|
PrepareAlternateTaskbarImplementation(&symbols_PTRS); |
|
|
|
PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll); |
|
|
|
printf("Setup twinui.pcshell functions done\n"); |
|
|
|
printf("Setup twinui.pcshell functions done\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|