Skip to content

Commit 6d946bd

Browse files
committed
File Explorer: Updated shrink address bar patterns to account for non-inlined CAddressBand::_GetAdjustedClientRect() in recent GE builds (#4552)
1 parent 18dfcd0 commit 6d946bd

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

ExplorerPatcher/dllmain.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8801,7 +8801,7 @@ static void PatchAddressBarSizing(const MODULEINFO* mi)
88018801
VirtualProtect(match, 9, dwOldProtect, &dwOldProtect);
88028802
}
88038803

8804-
// CAddressBand::_AddressBandWndProc()
8804+
// CAddressBand::_AddressBandWndProc() <- CAddressBand::_GetAdjustedClientRect()
88058805
// 83 45 ?? ?? 83 6D ?? ?? 0F
88068806
// xx To 03 xx To 01
88078807
match = FindPattern(
@@ -8810,11 +8810,32 @@ static void PatchAddressBarSizing(const MODULEINFO* mi)
88108810
"\x83\x45\x00\x00\x83\x6D\x00\x00\x0F",
88118811
"xx??xx??x"
88128812
);
8813-
if (match && VirtualProtect(match, 9, PAGE_EXECUTE_READWRITE, &dwOldProtect))
8813+
if (match)
88148814
{
8815-
match[3] = 3;
8816-
match[7] = 1;
8817-
VirtualProtect(match, 9, dwOldProtect, &dwOldProtect);
8815+
if (VirtualProtect(match, 9, PAGE_EXECUTE_READWRITE, &dwOldProtect))
8816+
{
8817+
match[3] = 3;
8818+
match[7] = 1;
8819+
VirtualProtect(match, 9, dwOldProtect, &dwOldProtect);
8820+
}
8821+
}
8822+
else
8823+
{
8824+
// CAddressBand::_GetAdjustedClientRect()
8825+
// 0F 1F 44 00 00 83 43 04 ?? 83 43 0C ??
8826+
// xx To 03 xx To FF (-1)
8827+
match = FindPattern(
8828+
mi->lpBaseOfDll,
8829+
mi->SizeOfImage,
8830+
"\x0F\x1F\x44\x00\x00\x83\x43\x04\x00\x83\x43\x0C",
8831+
"xxxxxxxx?xxx"
8832+
);
8833+
if (match && VirtualProtect(match + 5, 8, PAGE_EXECUTE_READWRITE, &dwOldProtect))
8834+
{
8835+
match[8] = 3;
8836+
match[12] = (BYTE)-1;
8837+
VirtualProtect(match + 5, 8, dwOldProtect, &dwOldProtect);
8838+
}
88188839
}
88198840
}
88208841
else

0 commit comments

Comments
 (0)