Skip to content

Commit

Permalink
Merge e2f5642 into 4d63170
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwarcs committed May 2, 2024
2 parents 4d63170 + e2f5642 commit e1eb85a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/dbg/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector, std::vector<S
for(const auto & page : newPages)
totalSize += page.mbi.RegionSize;

if(totalSize < pageSize)
{
// On Windows 11 24H2+, modules that support hotpatching contain an extra page mapped into their image region
MEMPAGE imageExtensionPage = {};
imageExtensionPage.mbi.BaseAddress = (PVOID)(pageBase + totalSize);
imageExtensionPage.mbi.RegionSize = pageSize - totalSize;
sprintf_s(imageExtensionPage.info, "ImageExtension");
newPages.push_back(imageExtensionPage);
totalSize = pageSize;
}

// Replace the single module page with the sections
// newPages should never be empty, but try to avoid data loss if it is
if(!newPages.empty() && totalSize == pageSize)
Expand Down

0 comments on commit e1eb85a

Please sign in to comment.