Author: fireball
Date: Sun Oct 24 20:02:04 2010
New Revision: 49261
URL: http://svn.reactos.org/svn/reactos?rev=49261&view=rev
Log:
[N[NTOS/MM]
- Initialize Found to FALSE in NtQueryVirtualMemory. I wonder how GCC missed uninitialized var usage?
- Implement case when NtQueryVirtualMemory is called with non-existing virtual address.
See issue #3755 for more details.
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] Sun Oct 24 20:02:04 2010
@@ -2306,7 +2306,7 @@
NTSTATUS Status;
PMMVAD Vad = NULL;
PVOID Address, NextAddress;
- BOOLEAN Found;
+ BOOLEAN Found = FALSE;
ULONG NewProtect, NewState, BaseVpn;
MEMORY_BASIC_INFORMATION MemoryInfo;
KAPC_STATE ApcState;
@@ -2390,11 +2390,44 @@
/* Was a VAD found? */
if (!Found)
{
- /* We don't handle this yet */
- UNIMPLEMENTED;
- while (TRUE);
- }
-
+ Address = PAGE_ALIGN(BaseAddress);
+
+ /* Calculate region size */
+ if (Vad)
+ {
+ /* We don't handle this yet */
+ UNIMPLEMENTED;
+ while (TRUE);
+ }
+ else
+ {
+ /* Maximum possible region size with that base address */
+ MemoryInfo.RegionSize = (PCHAR)MM_HIGHEST_VAD_ADDRESS + 1 - (PCHAR)Address;
+ }
+
+ /* Check if we were attached */
+ if (ProcessHandle != NtCurrentProcess())
+ {
+ /* Detach and derefernece the process */
+ KeUnstackDetachProcess(&ApcState);
+ ObDereferenceObject(TargetProcess);
+ }
+
+ /* Build the rest of the initial information block */
+ MemoryInfo.BaseAddress = Address;
+ MemoryInfo.AllocationBase = NULL;
+ MemoryInfo.AllocationProtect = 0;
+ MemoryInfo.State = MEM_FREE;
+ MemoryInfo.Protect = PAGE_NOACCESS;
+ MemoryInfo.Type = 0;
+
+ /* Return the data (FIXME: Use SEH) */
+ *(PMEMORY_BASIC_INFORMATION)MemoryInformation = MemoryInfo;
+ if (ReturnLength) *ReturnLength = sizeof(MEMORY_BASIC_INFORMATION);
+
+ return STATUS_SUCCESS;
+ }
+
/* This must be a VM VAD */
ASSERT(Vad->u.VadFlags.PrivateMemory);
Author: cgutman
Date: Sun Oct 24 10:48:10 2010
New Revision: 49256
URL: http://svn.reactos.org/svn/reactos?rev=49256&view=rev
Log:
[HAL]
- Fix a broken loop that resulted in us registering the resources of multiple COM ports as our KD port
- Fixes bug #5530
Modified:
trunk/reactos/hal/halx86/generic/usage.c
Modified: trunk/reactos/hal/halx86/generic/usage.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/usage.c…
==============================================================================
--- trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] Sun Oct 24 10:48:10 2010
@@ -235,8 +235,9 @@
if (!HalpGetInfoFromACPI)
{
/* No, so use our local table */
- Port = HalpComPortIrqMapping[0][0];
- for (i = 0; Port; i++)
+ for (i = 0, Port = HalpComPortIrqMapping[i][0];
+ Port;
+ i++, Port = HalpComPortIrqMapping[i][0])
{
/* Is this the port we want? */
if (Port == (ULONG_PTR)KdComPortInUse)
@@ -248,9 +249,6 @@
PRIMARY_VECTOR_BASE,
HIGH_LEVEL);
}
-
- /* Next port */
- Port = HalpComPortIrqMapping[i][0];
}
}
}