Microsoft Windows CE 3.0  

LocalReAlloc

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function changes the size or the attributes of a specified local memory object. The size can increase or decrease.

HLOCAL
LocalReAlloc(
HLOCAL
hMem
,
UINT
uBytes
,
UINT
fuFlags
);

Parameters

hMem
[in] Handle to the local memory object to be reallocated. This handle is returned by either the LocalAllocor LocalReAllocfunction.
uBytes
[in] New size, in bytes, of the memory block. If fuFlagsspecifies the LMEM_MODIFY flag, this parameter is ignored.
fuFlags
[in] Flag that specifies how to reallocate the local memory object. If the LMEM_MODIFY flag is specified, this parameter modifies the attributes of the memory object, and the uBytesparameter is ignored. Otherwise, this parameter controls the reallocation of the memory object.

The LMEM_MODIFY flag can be combined with the flag listed in the following table.

Value Description
LMEM_MOVEABLE You cannot combine LMEM_MOVEABLE with LMEM_MODIFY to change a fixed memory object into a movable one. If you do, the function returns an error.

If this parameter does not specify LMEM_MODIFY, this parameter can be any combination of the flags listed in the following table.

Value Description
LMEM_MOVEABLE Enables the memory allocation to move if it cannot be allocated in place.
LMEM_ZEROINIT Causes the additional memory contents to be initialized to zero if the memory object is growing in size.

Return Values

A handle to the reallocated memory object indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

If LocalReAllocfails, the original memory is not freed and the original handle and pointer are still valid.

If LocalReAllocreallocates a movable object, the return value is a handle to the memory object.

If LocalReAllocreallocates a fixed object, the value of the handle returned is the address of the first byte of the memory block. To access the memory, a process can simply cast the return value to a pointer.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Lmem.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

GetLastError, LocalAlloc, LocalFree