mirror of
https://github.com/reactos/reactos.git
synced 2024-11-07 07:00:19 +00:00
[NTOSKRNL]
Implement protection changing in NtAllocateVirtualMemory. Fixes "Assertion 'ChangeProtection == FALSE' failed" svn path=/trunk/; revision=58108
This commit is contained in:
parent
5b8fa09fc2
commit
fd43db5558
1 changed files with 20 additions and 6 deletions
|
@ -4308,7 +4308,6 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
@ -4318,11 +4317,6 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
|||
PointerPte++;
|
||||
}
|
||||
|
||||
//
|
||||
// This path is not yet handled
|
||||
//
|
||||
ASSERT(ChangeProtection == FALSE);
|
||||
|
||||
//
|
||||
// Release the working set lock, unlock the address space, and detach from
|
||||
// the target process if it was not the current process. Also dereference the
|
||||
|
@ -4332,6 +4326,26 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue