//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.
hAddress
Address of the memory block. This address must have been previously returned by the _HeapAllocate or _HeapReAllocate service.
nbytes
New size, in bytes, of the block. Must not be zero.
flags
Allocation flags. Can be zero or more of these values:
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.
See also _HeapAllocate, _HeapFree