Fixed a wrong parameter for a call to ZwFreeVirtualMemory(). This fixes a page fault at address 0 (cr2 = 0).

Fixed the calculation of the maximum heap count in RtlInitializeHeapManager().

svn path=/trunk/; revision=2812
This commit is contained in:
Hartmut Birr 2002-04-01 22:11:12 +00:00
parent c75ecda469
commit b17ab99f15

View file

@ -461,9 +461,10 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena,
subheap->magic = 0;
if (!(flags & HEAP_NO_VALLOC))
{
ULONG dummySize = 0;
ZwFreeVirtualMemory(NtCurrentProcess(),
(PVOID*)&subheap,
0,
&dummySize,
MEM_RELEASE);
}
return;
@ -622,9 +623,10 @@ static SUBHEAP *HEAP_CreateSubHeap(PVOID BaseAddress,
{
if (!(flags & HEAP_NO_VALLOC))
{
ULONG dummySize = 0;
ZwFreeVirtualMemory(NtCurrentProcess(),
address,
0,
&dummySize,
MEM_RELEASE);
return NULL;
}
@ -940,11 +942,15 @@ static BOOL HEAP_IsRealArena(
+ sizeof(ARENA_INUSE)))
{
if (quiet == NOISY)
{
ERR("Heap %08lx: block %08lx is not inside heap\n",
(DWORD)heap, (DWORD)block );
}
else if (WARN_ON(heap))
{
WARN("Heap %08lx: block %08lx is not inside heap\n",
(DWORD)heap, (DWORD)block );
}
ret = FALSE;
} else
ret = HEAP_ValidateInUseArena( subheap, (ARENA_INUSE *)block - 1, quiet );
@ -1064,9 +1070,10 @@ RtlDestroyHeap(HANDLE heap) /* [in] Handle of heap */
if (!(heapPtr->flags & HEAP_NO_VALLOC))
{
ULONG dummySize = 0;
ZwFreeVirtualMemory(NtCurrentProcess(),
(PVOID*)&subheap,
0,
&dummySize,
MEM_RELEASE);
}
subheap = next;
@ -1557,7 +1564,7 @@ RtlInitializeHeapManager(VOID)
Peb = NtCurrentPeb();
Peb->NumberOfHeaps = 0;
Peb->MaximumNumberOfHeaps = (PAGESIZE - sizeof(PPEB)) / sizeof(HANDLE);
Peb->MaximumNumberOfHeaps = (PAGESIZE - sizeof(PEB)) / sizeof(HANDLE);
Peb->ProcessHeaps = (PVOID)Peb + sizeof(PEB);
RtlInitializeCriticalSection(&RtlpProcessHeapsListLock);