Fixed vma command to show kernel memory space too, not just user

svn path=/trunk/; revision=2566
This commit is contained in:
Phillip Susi 2002-01-27 00:34:59 +00:00
parent eea1010947
commit c4a09186d3

View file

@ -1939,54 +1939,58 @@ LPSTR DecodeVmFlags(ULONG flags)
//************************************************************************* //*************************************************************************
COMMAND_PROTOTYPE(ShowVirtualMemory) COMMAND_PROTOTYPE(ShowVirtualMemory)
{ {
PEPROCESS my_current = IoGetCurrentProcess(); PEPROCESS my_current = IoGetCurrentProcess();
PLIST_ENTRY current_entry; PLIST_ENTRY current_entry;
PMADDRESS_SPACE vma = NULL; PMADDRESS_SPACE vma = NULL;
MEMORY_AREA* current; MEMORY_AREA* current;
char filename[64]; char filename[64];
DPRINT((0,"ShowVirtualMemory()\n")); DPRINT((0,"ShowVirtualMemory()\n"));
if( my_current ) if( my_current )
vma = &(my_current->AddressSpace); vma = &(my_current->AddressSpace);
if( !vma )
if(vma) vma = my_init_mm;
while( vma )
{ {
if(pArgs->Count == 0) if(pArgs->Count == 0)
{ {
PutStatusText("START END LENGTH VMA TYPE ATTR"); PutStatusText("START END LENGTH VMA TYPE ATTR");
current_entry = vma->MAreaListHead.Flink; current_entry = vma->MAreaListHead.Flink;
while (current_entry != &vma->MAreaListHead) while (current_entry != &vma->MAreaListHead)
{ {
*filename = 0; *filename = 0;
current = CONTAINING_RECORD(current_entry, current = CONTAINING_RECORD(current_entry,
MEMORY_AREA, MEMORY_AREA,
Entry); Entry);
// find the filename // find the filename
if(((current->Type == MEMORY_AREA_SECTION_VIEW_COMMIT) || if(((current->Type == MEMORY_AREA_SECTION_VIEW_COMMIT) ||
(current->Type == MEMORY_AREA_SECTION_VIEW_RESERVE) )&& (current->Type == MEMORY_AREA_SECTION_VIEW_RESERVE) )&&
current->Data.SectionData.Section->FileObject) current->Data.SectionData.Section->FileObject)
{ {
if(IsAddressValid((ULONG)current->Data.SectionData.Section->FileObject->FileName.Buffer) ) if(IsAddressValid((ULONG)current->Data.SectionData.Section->FileObject->FileName.Buffer) )
PICE_sprintf(filename,"%.64S",current->Data.SectionData.Section->FileObject->FileName.Buffer); PICE_sprintf(filename,"%.64S",current->Data.SectionData.Section->FileObject->FileName.Buffer);
} }
PICE_sprintf(tempCmd,"%.8X %.8X %.8X %.8X %x %x %s\n", PICE_sprintf(tempCmd,"%.8X %.8X %.8X %.8X %x %x %s\n",
(ULONG)current->BaseAddress, (ULONG)current->BaseAddress,
(ULONG)current->BaseAddress+current->Length, (ULONG)current->BaseAddress+current->Length,
current->Length, current->Length,
(ULONG)current, (ULONG)current,
current->Type, current->Attributes,//DecodeVmFlags(current->Type, current->Attributes), current->Type, current->Attributes,//DecodeVmFlags(current->Type, current->Attributes),
filename); filename);
Print(OUTPUT_WINDOW,tempCmd); Print(OUTPUT_WINDOW,tempCmd);
if(WaitForKey()==FALSE)break; if(WaitForKey()==FALSE)
current_entry = current_entry->Flink; break;
current_entry = current_entry->Flink;
} }
} }
if( vma == &(my_current->AddressSpace) )
vma = my_init_mm; // switch to kernel memory area
else vma = 0; // if we already did kernel, end loop
} }
return TRUE;
return TRUE;
} }
//************************************************************************* //*************************************************************************