mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[RTL]
- HEAP_ENTRY::Size is in bytes for HEAP_ENTRY_VIRTUAL_ALLOC allocations. Save it accordingly CORE-9441 svn path=/trunk/; revision=66959
This commit is contained in:
parent
c7d57b853b
commit
d78755e2b5
|
@ -427,6 +427,7 @@ RtlpGetSizeOfBigBlock(PHEAP_ENTRY HeapEntry)
|
||||||
|
|
||||||
/* Get pointer to the containing record */
|
/* Get pointer to the containing record */
|
||||||
VirtualEntry = CONTAINING_RECORD(HeapEntry, HEAP_VIRTUAL_ALLOC_ENTRY, BusyBlock);
|
VirtualEntry = CONTAINING_RECORD(HeapEntry, HEAP_VIRTUAL_ALLOC_ENTRY, BusyBlock);
|
||||||
|
ASSERT(VirtualEntry->BusyBlock.Size >= sizeof(HEAP_VIRTUAL_ALLOC_ENTRY));
|
||||||
|
|
||||||
/* Restore the real size */
|
/* Restore the real size */
|
||||||
return VirtualEntry->CommitSize - HeapEntry->Size;
|
return VirtualEntry->CommitSize - HeapEntry->Size;
|
||||||
|
@ -2096,6 +2097,7 @@ RtlAllocateHeap(IN PVOID HeapPtr,
|
||||||
|
|
||||||
/* Initialize the newly allocated block */
|
/* Initialize the newly allocated block */
|
||||||
VirtualBlock->BusyBlock.Size = (USHORT)(AllocationSize - Size);
|
VirtualBlock->BusyBlock.Size = (USHORT)(AllocationSize - Size);
|
||||||
|
ASSERT(VirtualBlock->BusyBlock.Size >= sizeof(HEAP_VIRTUAL_ALLOC_ENTRY));
|
||||||
VirtualBlock->BusyBlock.Flags = EntryFlags | HEAP_ENTRY_VIRTUAL_ALLOC | HEAP_ENTRY_EXTRA_PRESENT;
|
VirtualBlock->BusyBlock.Flags = EntryFlags | HEAP_ENTRY_VIRTUAL_ALLOC | HEAP_ENTRY_EXTRA_PRESENT;
|
||||||
VirtualBlock->CommitSize = AllocationSize;
|
VirtualBlock->CommitSize = AllocationSize;
|
||||||
VirtualBlock->ReserveSize = AllocationSize;
|
VirtualBlock->ReserveSize = AllocationSize;
|
||||||
|
@ -2648,7 +2650,8 @@ RtlReAllocateHeap(HANDLE HeapPtr,
|
||||||
if (InUseEntry->Flags & HEAP_ENTRY_VIRTUAL_ALLOC)
|
if (InUseEntry->Flags & HEAP_ENTRY_VIRTUAL_ALLOC)
|
||||||
{
|
{
|
||||||
/* Simple in case of a virtual alloc - just an unused size */
|
/* Simple in case of a virtual alloc - just an unused size */
|
||||||
InUseEntry->Size = (USHORT)((AllocationSize - Size) >> HEAP_ENTRY_SHIFT);
|
InUseEntry->Size = (USHORT)(AllocationSize - Size);
|
||||||
|
ASSERT(InUseEntry->Size >= sizeof(HEAP_VIRTUAL_ALLOC_ENTRY));
|
||||||
}
|
}
|
||||||
else if (InUseEntry->Flags & HEAP_ENTRY_EXTRA_PRESENT)
|
else if (InUseEntry->Flags & HEAP_ENTRY_EXTRA_PRESENT)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue