//C syntax
#include <vmm.h>
ULONG EXTERNAL _HeapReAllocate(ULONG hAddress, ULONG nbytes, ULONG flags);
; assembler syntax
include vmm.inc
VMMCall _HeapReAllocate, <hAddress, nbytes, flags>
or eax, eax ; zero if error
jz error
mov [Address], eax ; address of reallocated block
Reallocates or reinitializes a memory block in the system heap. Uses EAX, ECX, EDX, and Flags.
Value | Meaning |
---|---|
HEAPNOCOPY | Does not preserve contents of existing bytes. If this value is not given, the service preserves the contents of existing bytes by copying the contents of the old memory block into the new block. |
HEAPZEROINIT | Fills any new bytes in the memory block with zeros. All existing bytes remain unchanged. |
HEAPZEROREINIT | Fills all bytes, new and existing, with zeros. |
All other values are reserved.
If this service is successful, it frees the old memory block, making the old address invalid. Virtual devices must never rely on the old and new addresses being the same. If this service returns an error, the old memory block is not freed and the old address remains valid.
Since the system offers no protection on the heap, virtual devices must provide their own protection to prevent overrunning allocated blocks.
The system offers no compaction on the heap; all memory blocks on the heap are fixed. Virtual devices must not use the heap in such a way as to severely fragment it.
Although the system can usually recover from an attempt to reallocate an invalid address, you should not rely on this.
_HeapAllocate, _HeapFree