// C syntax #include <vmm.h> ULONG EXTERN _PageReAllocate(ULONG hMem, ULONG nPages, ULONG flags); ; assembler syntax VMMcall _PageReAllocate, <hMem, nPages, flags> test eax, eax ; zero in eax if error jz error mov [Address], eax ; new linear address
Resizes and optionally reinitializes an existing memory block. The service can increase or decrease the number of pages in the memory block. Uses EAX, ECX, EDX and flags.
Returns the ring-0 linear address of the block (in the EAX register). For compatibility with Windows 3.1, the same value is returned in the EDX register.
Both registers are zero if an error occurs, such as insufficient memory, an invalid memory address, or the wrong memory type. In this case, the original memory block is unchanged.
hMem
Base linear address of the memory block to reallocate. In most cases, this should be a value returned by the _PageAllocate or _PageReAllocate service. If this parameter is a linear address returned by the _PageReserve service, see the cautions below.
nPages
Number of pages in the reallocated memory block. This parameter must not be zero. To free a memory block, use the _PageFree service.
flags
Operation flags. Can be zero or more of these values:
Value | Meaning |
PAGELOCKED | Locks the allocated pages in the memory. The pages can be subsequently unlocked using the _PageUnLock service. The service locks the memory block regardless of the type of virtual page swap device present. |
PAGELOCKEDIFDP | Locks the allocated pages in memory only if the virtual page swap device uses MS-DOS or BIOS functions to write to the hardware. If the pages are locked, they can be subsequently unlocked using the _PageUnLock service. irtual device must not specify the PAGELOCKEDIFDP value until after the Init_Complete message has been processed by all virtual devices. |
PAGENOCOPY | Does not preserve contents of existing pages. If this value is not given, the service preserves the contents of each existing page by copying the contents of the old memory block into the corresponding pages of the new block. |
PAGEZEROINIT | Fills any new pages with zeros. All existing pages remain unchanged. |
PAGEZEROREINIT | Fills all pages, new and existing, with zeros. |
All other values are reserved.
This service changes the number of committed pages for the memory block. It attempts to do so without changing the base linear address. If necessary, however, the service reserves a new memory block, copies the old data into it, and then frees the existing memory object.
If you use this service with sparse memory management services, such as _PageReserve, _PageCommit, and _PageDecommit, you must ensure that all committed pages are contiguous and that the first committed page is at the start of the memory block's reserved address range. If pages have been committed sparsely, the service may return an error or free pages unexpectedly. You can reallocate a memory block that has no committed pages. For example, you could call _PageReserve and then _PageReAllocate.
If the specified base linear address identifies a fixed memory block (allocated using the PAGEFIXED value), this service implicitly allocates fixed pages for the new memory block. The service returns an error if the block cannot be reallocated without changing the base linear address.
If the specified base linear address identifies an aligned memory block (allocated using the PAGEUSEALIGN value), this service returns an error.
If the specified base linear address identifies a memory block allocated by _PageReserve with the PR_STATIC flag, this service returns an error.
Virtual devices must never rely on the new and old starting addresses being equal.
The action specified by the PAGELOCKEDIFDP value is available only after the virtual page swap device has been initialized.
See also _PageAllocate, _PageFree, _PageLock, _PageReserve, _PageUnLock