1
0
Fork 0

Use the page address instead of the module name for sections

This fixes an issue where two modules with the same name are confused

Closes #2933
This commit is contained in:
Duncan Ogilvie 2022-09-18 19:52:11 +02:00
parent 3c22b64cd8
commit bc88c85377
1 changed files with 11 additions and 7 deletions

View File

@ -118,8 +118,15 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector)
return;
auto & currentPage = pageVector.at(i);
auto modBase = ModBaseFromName(currentPage.info);
if(!modBase)
// Nothing to do for reserved or free pages
if(currentPage.mbi.State == MEM_RESERVE || currentPage.mbi.State == MEM_FREE)
continue;
auto pageBase = duint(currentPage.mbi.BaseAddress);
auto pageSize = currentPage.mbi.RegionSize;
auto modBase = ModBaseFromAddr(pageBase);
if(modBase == 0)
continue;
// Retrieve module info
@ -166,9 +173,6 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector)
}
}
auto pageBase = duint(currentPage.mbi.BaseAddress);
auto pageSize = currentPage.mbi.RegionSize;
// Section view
if(!bListAllPages)
{
@ -215,14 +219,14 @@ static void ProcessFileSections(std::vector<MEMPAGE> & pageVector)
else
{
// Report an error to make it easier to debug
auto summary = StringUtils::sprintf("Error replacing page: %p[%p]\n", pageBase, pageSize);
auto summary = StringUtils::sprintf("Error replacing page: %p[%p] (%s)\n", pageBase, pageSize, currentPage.info);
summary += "Sections:\n";
for(const auto & section : sections)
summary += StringUtils::sprintf(" \"%s\": %p[%p]\n", section.name, section.addr, section.size);
summary += "New pages:\n";
for(const auto & page : newPages)
summary += StringUtils::sprintf(" \"%s\": %p[%p]\n", page.info, page.mbi.BaseAddress, page.mbi.RegionSize);
summary += "Please report an issue!";
summary += "Please report an issue!\n";
GuiAddLogMessage(summary.c_str());
strncat_s(currentPage.info, " (error, see log)", _TRUNCATE);
}