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

Symbols: Update explorer.exe symbols reading for 26244+

This commit is contained in:
Amrsatrio 2024-07-04 06:10:23 +07:00
parent 62dcb98cb2
commit 9844324b5e
4 changed files with 80 additions and 19 deletions

View File

@ -19,7 +19,7 @@ Tested on OS builds 22621.3296, 22621.3447, 22621.3527, 22635.3566, 26058.1000,
##### 3 ##### 3
* All: Updated some patterns to work with 22635.3430+ (Beta) and recent 24H2 builds. (b51ef38) * All: Updated some patterns to work with 22635.3430+ (Beta) and recent 24H2 builds. (6d22947)
* This should fix the Windows 10 start menu crashing and Win+X not working on both aforementioned builds when symbols are not yet downloaded. * This should fix the Windows 10 start menu crashing and Win+X not working on both aforementioned builds when symbols are not yet downloaded.
##### 4 ##### 4

View File

@ -1861,6 +1861,18 @@ void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoIni
} }
} }
} }
__declspec(dllexport) unsigned __int64 FindTaskbarLayoutTokenByHMONITOR(HMONITOR hMonitor)
{
for (DWORD i = 0; i < dwMonitorCount; i++)
{
if (hMonitorList[i].hMonitor == hMonitor)
{
return hMonitorList[i].token;
}
}
return 0;
}
#else #else
void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoInitialize) {} void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoInitialize) {}
#endif #endif
@ -11480,10 +11492,16 @@ BOOL FixStartMenuAnimation(LPMODULEINFO mi)
} }
// ### CStartExperienceManager::Hide() // ### CStartExperienceManager::Hide()
// * Pattern 1, mov [rbx+2A3h], r12b:
// ``` // ```
// 74 ?? ?? 03 00 00 00 44 88 // 74 ?? ?? 03 00 00 00 44 88
// ^^ Turn jz into jmp // ^^ Turn jz into jmp
// ``` // ```
// * Pattern 2, mov byte ptr [rbx+2A3h], 1:
// ```
// 74 ?? ?? 03 00 00 00 C6 83
// ^^ Turn jz into jmp
// ```
// Perform on exactly two matches // Perform on exactly two matches
PBYTE matchHideA = FindPattern( PBYTE matchHideA = FindPattern(
mi->lpBaseOfDll, mi->lpBaseOfDll,
@ -11507,6 +11525,31 @@ BOOL FixStartMenuAnimation(LPMODULEINFO mi)
} }
} }
if (!matchHideA || !matchHideB)
{
matchHideA = FindPattern(
mi->lpBaseOfDll,
mi->SizeOfImage,
"\x74\x00\x00\x03\x00\x00\x00\xC6\x83",
"x??xxxxxx"
);
matchHideB = NULL;
if (matchHideA)
{
printf("[SMA] matchHideA in CStartExperienceManager::Hide() = %llX\n", matchHideA - (PBYTE)mi->lpBaseOfDll);
matchHideB = FindPattern(
matchHideA + 14,
mi->SizeOfImage - (matchHideA + 14 - (PBYTE)mi->lpBaseOfDll),
"\x74\x00\x00\x03\x00\x00\x00\xC6\x83",
"x??xxxxxx"
);
if (matchHideB)
{
printf("[SMA] matchHideB in CStartExperienceManager::Hide() = %llX\n", matchHideB - (PBYTE)mi->lpBaseOfDll);
}
}
}
if (!matchVtable if (!matchVtable
|| !matchSingleViewShellExperienceFields || !matchSingleViewShellExperienceFields
|| !matchAnimationHelperFields || !matchAnimationHelperFields
@ -11859,11 +11902,11 @@ const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)
return pszTaskbarDll; return pszTaskbarDll;
} }
void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll) HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll)
{ {
if (!symbols_PTRS || !pszTaskbarDll) if (!symbols_PTRS || !pszTaskbarDll)
{ {
return; return NULL;
} }
wchar_t szPath[MAX_PATH]; wchar_t szPath[MAX_PATH];
@ -11875,7 +11918,7 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCH
if (!hMyTaskbar) if (!hMyTaskbar)
{ {
wprintf(L"[TB] '%s' not found\n", pszTaskbarDll); wprintf(L"[TB] '%s' not found\n", pszTaskbarDll);
return; return NULL;
} }
typedef DWORD (*GetVersion_t)(); typedef DWORD (*GetVersion_t)();
@ -11884,7 +11927,8 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCH
if (version != 2) if (version != 2)
{ {
wprintf(L"[TB] '%s' with version %d is not compatible\n", pszTaskbarDll, version); wprintf(L"[TB] '%s' with version %d is not compatible\n", pszTaskbarDll, version);
return; FreeLibrary(hMyTaskbar);
return NULL;
} }
explorer_TrayUI_CreateInstanceFunc = GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance"); explorer_TrayUI_CreateInstanceFunc = GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance");
@ -11908,6 +11952,7 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCH
} }
wprintf(L"[TB] Using '%s'\n", pszTaskbarDll); wprintf(L"[TB] Using '%s'\n", pszTaskbarDll);
return hMyTaskbar;
} }
#endif #endif
#endif #endif
@ -12764,7 +12809,7 @@ DWORD Inject(BOOL bIsExplorer)
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);
#if WITH_ALT_TASKBAR_IMPL #if WITH_ALT_TASKBAR_IMPL
PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll); HMODULE hMyTaskbar = PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll);
#endif #endif
printf("Setup twinui.pcshell functions done\n"); printf("Setup twinui.pcshell functions done\n");
@ -13151,6 +13196,10 @@ DWORD Inject(BOOL bIsExplorer)
VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook); VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook);
#if WITH_ALT_TASKBAR_IMPL
if (hMyTaskbar)
VnPatchIAT(hMyTaskbar, "USER32.dll", "GetClientRect", TaskbarCenter_GetClientRectHook);
#endif
VnPatchIAT(hExplorer, "SHCORE.dll", (LPCSTR)190, TaskbarCenter_SHWindowsPolicy); VnPatchIAT(hExplorer, "SHCORE.dll", (LPCSTR)190, TaskbarCenter_SHWindowsPolicy);
printf("Initialized taskbar centering module.\n"); printf("Initialized taskbar centering module.\n");

View File

@ -96,8 +96,14 @@ extern "C"
#endif #endif
#if HOW_TO_HOOK == HOOK_WITH_FUNCHOOK #if HOW_TO_HOOK == HOOK_WITH_FUNCHOOK
#ifdef __cplusplus
inline
#endif
funchook_t* funchook; funchook_t* funchook;
#elif HOW_TO_HOOK == HOOK_WITH_DETOURS #elif HOW_TO_HOOK == HOOK_WITH_DETOURS
#ifdef __cplusplus
inline
#endif
void* funchook; void* funchook;
#endif #endif

View File

@ -8,6 +8,9 @@ const char* explorer_SN[EXPLORER_SB_CNT] = {
EXPLORER_SB_4, EXPLORER_SB_4,
EXPLORER_SB_5 EXPLORER_SB_5
}; };
const char* explorer_SN_26244[1] = {
EXPLORER_SB_4,
};
const char* twinui_pcshell_SN[TWINUI_PCSHELL_SB_CNT] = { const char* twinui_pcshell_SN[TWINUI_PCSHELL_SB_CNT] = {
TWINUI_PCSHELL_SB_0, TWINUI_PCSHELL_SB_0,
TWINUI_PCSHELL_SB_1, TWINUI_PCSHELL_SB_1,
@ -113,17 +116,20 @@ static BOOL ProcessExplorerSymbols(const char* pszSettingsPath, DWORD* pOffsets)
} }
printf("[Symbols] Reading symbols...\n"); printf("[Symbols] Reading symbols...\n");
if (VnGetSymbols( if (VnGetSymbols(pszSettingsPath, pOffsets, explorer_SN, ARRAYSIZE(explorer_SN)) != 0)
pszSettingsPath, {
pOffsets, DWORD offsets26244[ARRAYSIZE(explorer_SN_26244)];
explorer_SN, if (VnGetSymbols(pszSettingsPath, offsets26244, explorer_SN_26244, ARRAYSIZE(explorer_SN_26244)) == 0)
EXPLORER_SB_CNT {
)) pOffsets[4] = offsets26244[0];
}
else
{ {
printf("[Symbols] Failure in reading symbols for \"%s\".\n", explorer_sb_dll); printf("[Symbols] Failure in reading symbols for \"%s\".\n", explorer_sb_dll);
if (hKey) RegCloseKey(hKey); if (hKey) RegCloseKey(hKey);
return FALSE; return FALSE;
} }
}
RegSetValueExW(hKey, TEXT(EXPLORER_SB_0), 0, REG_DWORD, &pOffsets[0], sizeof(DWORD)); RegSetValueExW(hKey, TEXT(EXPLORER_SB_0), 0, REG_DWORD, &pOffsets[0], sizeof(DWORD));
RegSetValueExW(hKey, TEXT(EXPLORER_SB_1), 0, REG_DWORD, &pOffsets[1], sizeof(DWORD)); RegSetValueExW(hKey, TEXT(EXPLORER_SB_1), 0, REG_DWORD, &pOffsets[1], sizeof(DWORD));