diff --git a/CHANGELOG.md b/CHANGELOG.md index d069a73a5..a957d9ce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ Tested on OS builds 22621.2715, 22621.2861, 22631.2787, 22631.2861, 22635.2915, * The properties window has been made slightly wider to accomodate the newly added languages. (#2574) * Localization: Added a language switcher to the About section of Properties window. (7c3be29, a7a3d27) +##### 2 + +* Symbols: Fixed languages with longer strings such as French crashing Explorer when attempting to download symbols. (ce9f973) + **Note:** Due to the breakages as well as frequent changes happening in Canary builds, we strongly do not recommend using ExplorerPatcher on Canary builds for now. ## 22621.2506.60 diff --git a/ExplorerPatcher-L10N b/ExplorerPatcher-L10N index 101692022..5fae9fa7d 160000 --- a/ExplorerPatcher-L10N +++ b/ExplorerPatcher-L10N @@ -1 +1 @@ -Subproject commit 101692022f3e3b21c425e2239feb365d34ffc712 +Subproject commit 5fae9fa7db51ed2a2ffccb8714ac571e6bc68c41 diff --git a/ExplorerPatcher/symbols.c b/ExplorerPatcher/symbols.c index a6468f426..89f0956c1 100644 --- a/ExplorerPatcher/symbols.c +++ b/ExplorerPatcher/symbols.c @@ -339,9 +339,9 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params) ubr ); - wchar_t title[100]; + wchar_t title[160]; wchar_t body[200]; - wchar_t titleFormat[100]; + wchar_t titleFormat[160]; wchar_t buffer[1000]; title[0] = 0; body[0] = 0; titleFormat[0] = 0; buffer[0] = 0; diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 4e728cca4..be16cc73d 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -583,64 +583,41 @@ inline BOOL IncrementDLLReferenceCount(HINSTANCE hinst) return TRUE; } +#ifdef _WIN64 +PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask); + inline BOOL WINAPI PatchContextMenuOfNewMicrosoftIME(BOOL* bFound) { // huge thanks to @Simplestas: https://github.com/valinet/ExplorerPatcher/issues/598 - if (bFound) *bFound = FALSE; - DWORD patch_from, patch_to; - if (IsWindows11Version22H2OrHigher()) - { - // cmp byte ptr [rbp+40h+arg_0], r13b - patch_from = 0x506D3844; - patch_to = 0x546D3844; - } - else - { - // cmp byte ptr [rbp+50h], r12b - patch_from = 0x50653844; - patch_to = 0x54653844; - } HMODULE hInputSwitch = NULL; if (!GetModuleHandleExW(0, L"InputSwitch.dll", &hInputSwitch)) - { return FALSE; - } - PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)hInputSwitch; - PIMAGE_NT_HEADERS pNTHeader = (PIMAGE_NT_HEADERS)((DWORD_PTR)dosHeader + dosHeader->e_lfanew); - PIMAGE_SECTION_HEADER pSectionHeader = (PIMAGE_SECTION_HEADER)(pNTHeader + 1); - char* mod = 0; - int i; - for (i = 0; i < pNTHeader->FileHeader.NumberOfSections; i++) - { - //if (strcmp((char*)pSectionHeader[i].Name, ".text") == 0) - if ((pSectionHeader[i].Characteristics & IMAGE_SCN_CNT_CODE) && pSectionHeader[i].SizeOfRawData) - { - mod = (char*)dosHeader + pSectionHeader[i].VirtualAddress; - break; - } - } - if (!mod) - { + + MODULEINFO mi; + GetModuleInformation(GetCurrentProcess(), hInputSwitch, &mi, sizeof(mi)); + + // 44 38 ?? ?? 74 ?? 48 8B CE E8 ?? ?? ?? ?? 85 C0 + // ^^ Change jz into jmp + PBYTE match = (PBYTE)FindPattern( + hInputSwitch, + mi.SizeOfImage, + "\x44\x38\x00\x00\x74\x00\x48\x8B\xCE\xE8\x00\x00\x00\x00\x85\xC0", + "xx??x?xxxx????xx" + ); + if (!match) return FALSE; - } - for (size_t off = 0; off < pSectionHeader[i].Misc.VirtualSize - sizeof(DWORD); ++off) - { - DWORD* ptr = (DWORD*)(mod + off); - if (*ptr == patch_from) - { - if (bFound) *bFound = TRUE; - DWORD prot; - if (VirtualProtect(ptr, sizeof(DWORD), PAGE_EXECUTE_READWRITE, &prot)) - { - *ptr = patch_to; - VirtualProtect(ptr, sizeof(DWORD), prot, &prot); - return TRUE; - } - break; - } - } - return FALSE; + + DWORD dwOldProtect; + if (!VirtualProtect(match + 4, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect)) + return FALSE; + + match[4] = 0xEB; + + VirtualProtect(match + 4, 1, dwOldProtect, &dwOldProtect); + + return TRUE; } +#endif extern UINT PleaseWaitTimeout; extern HHOOK PleaseWaitHook; diff --git a/version.h b/version.h index 974a10a0f..335032b8e 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22621 #define VER_MINOR 2861 #define VER_BUILD_HI 62 -#define VER_BUILD_LO 1 +#define VER_BUILD_LO 2 #define VER_FLAGS VS_FF_PRERELEASE