diff --git a/ExplorerPatcher/TwinUIPatches.cpp b/ExplorerPatcher/TwinUIPatches.cpp index 149f612..55d9486 100644 --- a/ExplorerPatcher/TwinUIPatches.cpp +++ b/ExplorerPatcher/TwinUIPatches.cpp @@ -2414,6 +2414,11 @@ namespace ABI::Windows::UI::Xaml }; } +static struct +{ + int jumpViewExperienceManager_rcWorkArea; +} g_JVPositioningPatchOffsets; + HRESULT CJumpViewExperienceManager_CalcWindowPosition( RECT rcWork, POINT ptAnchor, @@ -2571,7 +2576,7 @@ HRESULT CJumpViewExperienceManager_EnsureWindowPositionHook(void* _this, CSingle RETURN_IF_FAILED(CJumpViewExperienceManager_GetMonitorInformation( _this, ptAnchor, &rcWorkArea, &dpi, (EDGEUI_TRAYSTUCKPLACE*)((PBYTE)_this + 0x1F0))); // 850 - *((RECT*)((PBYTE)_this + 0x200)) = rcWorkArea; + *((RECT*)((PBYTE)_this + g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea)) = rcWorkArea; int width, height; ExperienceManagerUtils::ScaleByDPI(&experience->_desiredSize, dpi, &width, &height); @@ -2600,14 +2605,14 @@ BOOL FixJumpViewPositioning(MODULEINFO* mi) "xxxxxxxxxxxxx" ); #elif defined(_M_ARM64) - // 08 B0 41 B9 89 0B 80 52 - // ^^^^^^^^^^^ + // ?? ?? 41 B9 89 0B 80 52 A8 01 00 34 1F 05 00 71 20 01 00 54 1F 09 00 71 A0 00 00 54 1F 0D 00 71 01 01 00 54 69 0B 80 52 + // ^^^^^^^^^^^ Important instr. to distinguish from MeetNowExperienceManager::OnViewUncloaking() in GE > !!!!!!!!!!! // Ref: CJumpViewExperienceManager::OnViewCloaking() PBYTE matchOffsetTrayStuckPlace = (PBYTE)FindPattern( mi->lpBaseOfDll, mi->SizeOfImage, - "\x08\xB0\x41\xB9\x89\x0B\x80\x52", - "xxxxxxxx" + "\x41\xB9\x89\x0B\x80\x52\xA8\x01\x00\x34\x1F\x05\x00\x71\x20\x01\x00\x54\x1F\x09\x00\x71\xA0\x00\x00\x54\x1F\x0D\x00\x71\x01\x01\x00\x54\x69\x0B\x80\x52", + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ); #endif if (matchOffsetTrayStuckPlace) @@ -2618,30 +2623,60 @@ BOOL FixJumpViewPositioning(MODULEINFO* mi) // RECT CJumpViewExperienceManager::m_rcWorkArea PBYTE matchOffsetRcWorkArea = nullptr; #if defined(_M_X64) - // 48 8B 53 70 48 8D 83 C0 01 00 00 + // 48 8B 53 70 48 8D 83 ?? ?? ?? ?? // -- ^^^^^^^^^^^ // Ref: CJumpViewExperienceManager::OnViewUncloaking() + // Note: The ref function belongs to SingleViewShellExperienceEventHandler so `this` is +0x40. + // As long as the above sanity check passes, hardcoding it should be fine. if (matchOffsetTrayStuckPlace) { matchOffsetRcWorkArea = (PBYTE)FindPattern( matchOffsetTrayStuckPlace + 13, 256, - "\x48\x8B\x53\x70\x48\x8D\x83\xC0\x01\x00\x00", - "xxxxxxxxxxx" + "\x48\x8B\x53\x70\x48\x8D\x83", + "xxxxxxx" ); + if (matchOffsetRcWorkArea) + { + g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea = 0x40 + *(int*)(matchOffsetRcWorkArea + 7); + } } #elif defined(_M_ARM64) - // 01 38 40 F9 07 00 07 91 - // ----------- ^^^^^^^^^^^ - // Ref: CJumpViewExperienceManager::OnViewCloaking() if (matchOffsetTrayStuckPlace) { + // Without Feature_TaskbarJumplistOnHover (48980211) + // 01 38 40 F9 07 00 07 91 + // ----------- ^^^^^^^^^^^ + // If this matches then the offset of m_rcWorkArea is +0x200 + // Ref: CJumpViewExperienceManager::OnViewCloaking() matchOffsetRcWorkArea = (PBYTE)FindPattern( - matchOffsetTrayStuckPlace + 8, + matchOffsetTrayStuckPlace + 38, 128, "\x01\x38\x40\xF9\x07\x00\x07\x91", "xxxxxxxx" ); + if (matchOffsetRcWorkArea) + { + g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea = 0x200; + } + if (!matchOffsetRcWorkArea) + { + // With Feature_TaskbarJumplistOnHover (48980211) + // 22 01 03 32 67 32 07 91 + // ^^^^^^^^^^^ + // If this matches then the offset of m_rcWorkArea is +0x20C + // Ref: CJumpViewExperienceManager::OnViewCloaking() + matchOffsetRcWorkArea = (PBYTE)FindPattern( + matchOffsetTrayStuckPlace + 38, + 128, + "\x22\x01\x03\x32\x67\x32\x07\x91", + "xxxxxxxx" + ); + if (matchOffsetRcWorkArea) + { + g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea = 0x20C; + } + } } #endif if (matchOffsetRcWorkArea) @@ -2651,6 +2686,7 @@ BOOL FixJumpViewPositioning(MODULEINFO* mi) // CJumpViewExperienceManager::EnsureWindowPosition() #if defined(_M_X64) + // Base Nickel and Germanium // 8D 4E C0 48 8B ?? E8 ?? ?? ?? ?? 8B // ^^^^^^^^^^^ // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging() @@ -2665,15 +2701,54 @@ BOOL FixJumpViewPositioning(MODULEINFO* mi) matchEnsureWindowPosition += 6; matchEnsureWindowPosition += 5 + *(int*)(matchEnsureWindowPosition + 1); } + if (!matchEnsureWindowPosition) + { + // Nickel with Feature_TaskbarJumplistOnHover (48980211) + // - 22621.3930, 3936, 4000, 4010, 4076, 4082, 4110, 4145, ... + // 4C 8D 76 C0 48 8B D3 49 8B CE E8 ?? ?? ?? ?? 8B + // ^^^^^^^^^^^ + // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging() + matchEnsureWindowPosition = (PBYTE)FindPattern( + mi->lpBaseOfDll, + mi->SizeOfImage, + "\x4C\x8D\x76\xC0\x48\x8B\xD3\x49\x8B\xCE\xE8\x00\x00\x00\x00\x8B", + "xxxxxxxxxxx????x" + ); + if (matchEnsureWindowPosition) + { + matchEnsureWindowPosition += 10; + matchEnsureWindowPosition += 5 + *(int*)(matchEnsureWindowPosition + 1); + } + } + if (!matchEnsureWindowPosition) + { + // Germanium with Feature_TaskbarJumplistOnHover (48980211) + // - 26100.1350, 1591, ... + // 48 8B D7 49 8D 4E C0 E8 ?? ?? ?? ?? 8B + // ^^^^^^^^^^^ + // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging() + matchEnsureWindowPosition = (PBYTE)FindPattern( + mi->lpBaseOfDll, + mi->SizeOfImage, + "\x48\x8B\xD7\x49\x8D\x4E\xC0\xE8\x00\x00\x00\x00\x8B", + "xxxxxxxx????x" + ); + if (matchEnsureWindowPosition) + { + matchEnsureWindowPosition += 7; + matchEnsureWindowPosition += 5 + *(int*)(matchEnsureWindowPosition + 1); + } + } #elif defined(_M_ARM64) - // E1 03 15 AA 80 02 01 D1 ?? ?? ?? ?? F3 03 00 2A - // ^^^^^^^^^^^ + // E1 03 ?? AA ?? 02 01 D1 ?? ?? ?? ?? ?? 03 00 2A + // !! ^^^^^^^^^^^ + // Do not change this to a wildcard, this byte is important // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging() PBYTE matchEnsureWindowPosition = (PBYTE)FindPattern( mi->lpBaseOfDll, mi->SizeOfImage, - "\xE1\x03\x15\xAA\x80\x02\x01\xD1\x00\x00\x00\x00\xF3\x03\x00\x2A", - "xxxxxxxx????xxxx" + "\xE1\x03\x00\xAA\x00\x02\x01\xD1\x00\x00\x00\x00\x00\x03\x00\x2A", + "xx?x?xxx?????xxx" ); if (matchEnsureWindowPosition) {