Author: tkreuzer
Date: Fri Jan 4 01:06:51 2013
New Revision: 58108
URL:
http://svn.reactos.org/svn/reactos?rev=58108&view=rev
Log:
[NTOSKRNL]
Implement protection changing in NtAllocateVirtualMemory.
Fixes "Assertion 'ChangeProtection == FALSE' failed"
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Fri Jan 4 01:06:51 2013
@@ -4308,7 +4308,6 @@
// There's a change in protection, remember this for later, but do
// not yet handle it.
//
- DPRINT1("Protection change to: 0x%lx not implemented\n", Protect);
ChangeProtection = TRUE;
}
@@ -4317,11 +4316,6 @@
//
PointerPte++;
}
-
- //
- // This path is not yet handled
- //
- ASSERT(ChangeProtection == FALSE);
//
// Release the working set lock, unlock the address space, and detach from
@@ -4332,6 +4326,26 @@
Status = STATUS_SUCCESS;
FailPath:
MmUnlockAddressSpace(AddressSpace);
+
+ //
+ // Check if we need to update the protection
+ //
+ if (ChangeProtection)
+ {
+ PVOID ProtectBaseAddress = (PVOID)StartingAddress;
+ SIZE_T ProtectSize = PRegionSize;
+ ULONG OldProtection;
+
+ //
+ // Change the protection of the region
+ //
+ MiProtectVirtualMemory(Process,
+ &ProtectBaseAddress,
+ &ProtectSize,
+ Protect,
+ &OldProtection);
+ }
+
FailPathNoLock:
if (Attached) KeUnstackDetachProcess(&ApcState);
if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);