diff --git a/ntoskrnl/mm/ARM3/virtual.c b/ntoskrnl/mm/ARM3/virtual.c index 6c9999df9cc..227879f3d51 100644 --- a/ntoskrnl/mm/ARM3/virtual.c +++ b/ntoskrnl/mm/ARM3/virtual.c @@ -2201,7 +2201,6 @@ MiProtectVirtualMemory(IN PEPROCESS Process, IN ULONG NewAccessProtection, OUT PULONG OldAccessProtection OPTIONAL) { - PMEMORY_AREA MemoryArea; PMMVAD Vad; PMMSUPPORT AddressSpace; ULONG_PTR StartingAddress, EndingAddress; @@ -2240,19 +2239,6 @@ MiProtectVirtualMemory(IN PEPROCESS Process, goto FailPath; } - /* Check for ROS specific memory area */ - MemoryArea = MmLocateMemoryAreaByAddress(&Process->Vm, *BaseAddress); - if ((MemoryArea) && (MemoryArea->Type != MEMORY_AREA_OWNED_BY_ARM3)) - { - /* Evil hack */ - MmUnlockAddressSpace(AddressSpace); - return MiRosProtectVirtualMemory(Process, - BaseAddress, - NumberOfBytesToProtect, - NewAccessProtection, - OldAccessProtection); - } - /* Get the VAD for this address range, and make sure it exists */ Result = MiCheckForConflictingNode(StartingAddress >> PAGE_SHIFT, EndingAddress >> PAGE_SHIFT, @@ -2265,6 +2251,18 @@ MiProtectVirtualMemory(IN PEPROCESS Process, goto FailPath; } + /* Check if this is a ROSMM VAD */ + if (MI_IS_ROSMM_VAD(Vad)) + { + /* Not very awesome hack */ + MmUnlockAddressSpace(AddressSpace); + return MiRosProtectVirtualMemory(Process, + BaseAddress, + NumberOfBytesToProtect, + NewAccessProtection, + OldAccessProtection); + } + /* Make sure the address is within this VAD's boundaries */ if ((((ULONG_PTR)StartingAddress >> PAGE_SHIFT) < Vad->StartingVpn) || (((ULONG_PTR)EndingAddress >> PAGE_SHIFT) > Vad->EndingVpn))