parent
e2a20266d1
commit
b0ba7d40e1
|
@ -116,7 +116,8 @@ void MemUpdateMap()
|
|||
if(!currentPage.info[0] || (scmp(curMod, currentPage.info) && !bListAllPages)) //there is a module
|
||||
continue; //skip non-modules
|
||||
strcpy_s(curMod, pageVector.at(i).info);
|
||||
if(!ModBaseFromName(currentPage.info))
|
||||
auto modBase = ModBaseFromName(currentPage.info);
|
||||
if(!modBase)
|
||||
continue;
|
||||
auto base = duint(currentPage.mbi.AllocationBase);
|
||||
std::vector<MODSECTIONINFO> sections;
|
||||
|
@ -127,6 +128,11 @@ void MemUpdateMap()
|
|||
continue;
|
||||
if(!bListAllPages) //normal view
|
||||
{
|
||||
// sanity check, rest of code assumes whole module resides in one region
|
||||
// in other cases module information cannot be trusted
|
||||
if(base != modBase || currentPage.mbi.RegionSize != ModSizeFromAddr(modBase))
|
||||
continue;
|
||||
|
||||
MEMPAGE newPage;
|
||||
//remove the current module page (page = size of module at this point) and insert the module sections
|
||||
pageVector.erase(pageVector.begin() + i); //remove the SizeOfImage page
|
||||
|
@ -154,7 +160,11 @@ void MemUpdateMap()
|
|||
{
|
||||
duint start = (duint)currentPage.mbi.BaseAddress;
|
||||
duint end = start + currentPage.mbi.RegionSize;
|
||||
for(duint j = 0, k = 0; (j < (duint)SectionNumber) && (k + IMAGE_SIZEOF_SHORT_NAME < MAX_MODULE_SIZE); j++)
|
||||
duint infoOffset = 0;
|
||||
// display module name in first region (useful if PE header and first section have same protection)
|
||||
if(start == modBase)
|
||||
infoOffset = strlen(currentPage.info);
|
||||
for(duint j = 0; (j < (duint)SectionNumber) && (infoOffset + IMAGE_SIZEOF_SHORT_NAME < sizeof(currentPage.info)); j++)
|
||||
{
|
||||
const auto & currentSection = sections.at(j);
|
||||
duint secStart = currentSection.addr;
|
||||
|
@ -164,9 +174,9 @@ void MemUpdateMap()
|
|||
duint secEnd = secStart + SectionSize;
|
||||
if(start < secEnd && end > secStart) //the section and memory overlap
|
||||
{
|
||||
if(k)
|
||||
k += sprintf_s(currentPage.info + k, MAX_MODULE_SIZE - k, ",");
|
||||
k += sprintf_s(currentPage.info + k, MAX_MODULE_SIZE - k, " \"%s\"", currentSection.name);
|
||||
if(infoOffset)
|
||||
infoOffset += sprintf_s(currentPage.info + infoOffset, sizeof(currentPage.info) - infoOffset, ",");
|
||||
infoOffset += sprintf_s(currentPage.info + infoOffset, sizeof(currentPage.info) - infoOffset, " \"%s\"", currentSection.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue