mirror of
https://github.com/reactos/reactos.git
synced 2024-07-11 23:25:09 +00:00
[NTOSKRNL]
* Fix the locking in MiQueryBasicInformation to cover ARM3 too, not just RosMm. This makes sure we don't change the address space while querying it (or vice-versa). * Don't attempt to query information for a terminated process (fixes some kernel32 loader winetests, matches Windows behavior). * Brought to you by Alex Ionescu. svn path=/trunk/; revision=60021
This commit is contained in:
parent
a56630f977
commit
1abc05ae78
|
@ -1533,6 +1533,26 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
|
||||||
KeStackAttachProcess(&TargetProcess->Pcb, &ApcState);
|
KeStackAttachProcess(&TargetProcess->Pcb, &ApcState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lock the address space and make sure the process isn't already dead */
|
||||||
|
MmLockAddressSpace(&TargetProcess->Vm);
|
||||||
|
if (TargetProcess->VmDeleted)
|
||||||
|
{
|
||||||
|
/* Unlock the address space of the process */
|
||||||
|
MmUnlockAddressSpace(&TargetProcess->Vm);
|
||||||
|
|
||||||
|
/* Check if we were attached */
|
||||||
|
if (ProcessHandle != NtCurrentProcess())
|
||||||
|
{
|
||||||
|
/* Detach and dereference the process */
|
||||||
|
KeUnstackDetachProcess(&ApcState);
|
||||||
|
ObDereferenceObject(TargetProcess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bail out */
|
||||||
|
DPRINT1("Process is dying\n");
|
||||||
|
return STATUS_PROCESS_IS_TERMINATING;
|
||||||
|
}
|
||||||
|
|
||||||
/* Loop the VADs */
|
/* Loop the VADs */
|
||||||
ASSERT(TargetProcess->VadRoot.NumberGenericTableElements);
|
ASSERT(TargetProcess->VadRoot.NumberGenericTableElements);
|
||||||
if (TargetProcess->VadRoot.NumberGenericTableElements)
|
if (TargetProcess->VadRoot.NumberGenericTableElements)
|
||||||
|
@ -1609,6 +1629,9 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
|
||||||
MemoryInfo.RegionSize = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1 - (PCHAR)Address;
|
MemoryInfo.RegionSize = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1 - (PCHAR)Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unlock the address space of the process */
|
||||||
|
MmUnlockAddressSpace(&TargetProcess->Vm);
|
||||||
|
|
||||||
/* Check if we were attached */
|
/* Check if we were attached */
|
||||||
if (ProcessHandle != NtCurrentProcess())
|
if (ProcessHandle != NtCurrentProcess())
|
||||||
{
|
{
|
||||||
|
@ -1663,9 +1686,6 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
|
||||||
MemoryInfo.Type = MEM_MAPPED;
|
MemoryInfo.Type = MEM_MAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lock the address space of the process */
|
|
||||||
MmLockAddressSpace(&TargetProcess->Vm);
|
|
||||||
|
|
||||||
/* Find the memory area the specified address belongs to */
|
/* Find the memory area the specified address belongs to */
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(&TargetProcess->Vm, BaseAddress);
|
MemoryArea = MmLocateMemoryAreaByAddress(&TargetProcess->Vm, BaseAddress);
|
||||||
ASSERT(MemoryArea != NULL);
|
ASSERT(MemoryArea != NULL);
|
||||||
|
|
Loading…
Reference in a new issue