mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:23:05 +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
|
// There's a change in protection, remember this for later, but do
|
||||||
// not yet handle it.
|
// not yet handle it.
|
||||||
//
|
//
|
||||||
DPRINT1("Protection change to: 0x%lx not implemented\n", Protect);
|
|
||||||
ChangeProtection = TRUE;
|
ChangeProtection = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4318,11 +4317,6 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
PointerPte++;
|
PointerPte++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// This path is not yet handled
|
|
||||||
//
|
|
||||||
ASSERT(ChangeProtection == FALSE);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the working set lock, unlock the address space, and detach from
|
// 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
|
// the target process if it was not the current process. Also dereference the
|
||||||
|
@ -4332,6 +4326,26 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
FailPath:
|
FailPath:
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
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:
|
FailPathNoLock:
|
||||||
if (Attached) KeUnstackDetachProcess(&ApcState);
|
if (Attached) KeUnstackDetachProcess(&ApcState);
|
||||||
if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
|
if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue