[NTOS:MM] Remove one more instance of MmLocateMemoryAreaByAddress

This commit is contained in:
Timo Kreuzer 2024-04-07 10:57:03 +03:00
parent 0e58b59794
commit 2e85425c53

View file

@ -1675,7 +1675,6 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
MEMORY_BASIC_INFORMATION MemoryInfo; MEMORY_BASIC_INFORMATION MemoryInfo;
KAPC_STATE ApcState; KAPC_STATE ApcState;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PMEMORY_AREA MemoryArea;
SIZE_T ResultLength; SIZE_T ResultLength;
/* Check for illegal addresses in user-space, or the shared memory area */ /* Check for illegal addresses in user-space, or the shared memory area */
@ -1901,17 +1900,15 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
MemoryInfo.Type = MEM_MAPPED; MemoryInfo.Type = MEM_MAPPED;
} }
/* Find the memory area the specified address belongs to */ /* Check if this is a RosMM VAD */
MemoryArea = MmLocateMemoryAreaByAddress(&TargetProcess->Vm, BaseAddress); if (MI_IS_ROSMM_VAD(Vad))
/* Determine information dependent on the memory area type */
if (MemoryArea && MemoryArea->Type == MEMORY_AREA_SECTION_VIEW)
{ {
Status = MmQuerySectionView(MemoryArea, BaseAddress, &MemoryInfo, &ResultLength); ASSERT(((PMEMORY_AREA)Vad)->Type == MEMORY_AREA_SECTION_VIEW);
Status = MmQuerySectionView((PMEMORY_AREA)Vad, BaseAddress, &MemoryInfo, &ResultLength);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("MmQuerySectionView failed. MemoryArea=%p (%p-%p), BaseAddress=%p\n", DPRINT1("MmQuerySectionView failed. MemoryArea=%p (%p-%p), BaseAddress=%p\n",
MemoryArea, MA_GetStartingAddress(MemoryArea), MA_GetEndingAddress(MemoryArea), BaseAddress); Vad, Vad->StartingVpn, Vad->EndingVpn, BaseAddress);
ASSERT(NT_SUCCESS(Status)); ASSERT(NT_SUCCESS(Status));
} }
} }